From d65169c2b16567d967e2f67fdabded6e6581e195 Mon Sep 17 00:00:00 2001 From: Mih4n <50325226+Mih4n@users.noreply.github.com> Date: Wed, 18 Oct 2023 20:11:13 +0300 Subject: [PATCH] yes --- spworlds-csharp-library.sln | 25 ++++++ src/Types/SkinPart.cs | 15 ++-- src/Types/User.cs | 30 ++++--- ....GeneratedMSBuildEditorConfig.editorconfig | 2 +- src/obj/Debug/net6.0/spworlds.assets.cache | Bin 0 -> 228 bytes .../spworlds.csproj.CoreCompileInputs.cache | 1 + .../spworlds.csproj.FileListAbsolute.txt | 4 + src/obj/project.assets.json | 73 ++++++++++++++++++ src/obj/project.nuget.cache | 8 ++ src/obj/spworlds.csproj.nuget.dgspec.json | 67 ++++++++++++++++ src/obj/spworlds.csproj.nuget.g.props | 16 ++++ src/obj/spworlds.csproj.nuget.g.targets | 2 + 12 files changed, 225 insertions(+), 18 deletions(-) create mode 100644 spworlds-csharp-library.sln create mode 100644 src/obj/Debug/net6.0/spworlds.assets.cache create mode 100644 src/obj/Debug/net6.0/spworlds.csproj.CoreCompileInputs.cache create mode 100644 src/obj/Debug/net6.0/spworlds.csproj.FileListAbsolute.txt create mode 100644 src/obj/project.assets.json create mode 100644 src/obj/project.nuget.cache create mode 100644 src/obj/spworlds.csproj.nuget.dgspec.json create mode 100644 src/obj/spworlds.csproj.nuget.g.props create mode 100644 src/obj/spworlds.csproj.nuget.g.targets diff --git a/spworlds-csharp-library.sln b/spworlds-csharp-library.sln new file mode 100644 index 0000000..605e735 --- /dev/null +++ b/spworlds-csharp-library.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.5.002.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "spworlds", "src\spworlds.csproj", "{9021649B-BD6F-4345-98B5-C444212798DD}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {9021649B-BD6F-4345-98B5-C444212798DD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9021649B-BD6F-4345-98B5-C444212798DD}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9021649B-BD6F-4345-98B5-C444212798DD}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9021649B-BD6F-4345-98B5-C444212798DD}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {EBAB5784-4D28-4830-AB69-BC3ECE2D13CD} + EndGlobalSection +EndGlobal diff --git a/src/Types/SkinPart.cs b/src/Types/SkinPart.cs index fe1f2b7..85c020f 100644 --- a/src/Types/SkinPart.cs +++ b/src/Types/SkinPart.cs @@ -2,12 +2,11 @@ namespace spworlds.Types; public enum SkinPart { - face; - front; - front_full; - head; - bust; - full; - skin; - + face, + front, + front_full, + head, + bust, + full, + skin } diff --git a/src/Types/User.cs b/src/Types/User.cs index 6396b12..149a1b4 100644 --- a/src/Types/User.cs +++ b/src/Types/User.cs @@ -4,22 +4,34 @@ namespace spworlds.Types; public class User { - public readonly string Name - public readonly string Uuid - public readonly JsonNode profile - - private HttpClient client = new(); + public string Name { get; } + public string Uuid { get; } + public JsonNode profile { get; } public bool IsPlayer() => Name != null ? true : false; - public User(string name) + public User(string name, string uuid, JsonNode profile) { - Uuid = JsonNode.Parse(client.GetStringAsync($"https://api.mojang.com/users/profiles/minecraft/{name}"))["id"]; - profile = JsonNode.Parse(client.GetStringAsync($"https://sessionserver.mojang.com/session/minecraft/profile/{Uuid}")); + Name = name; + Uuid = uuid; + this.profile = profile; } + public static async Task CreateUser(string name) + { + string uuid; + JsonNode profile; + using(HttpClient client = new()) + { + uuid = (string)JsonNode.Parse(await client.GetStringAsync($"https://api.mojang.com/users/profiles/minecraft/{name}"))["id"]; + profile = JsonNode.Parse(await client.GetStringAsync($"https://sessionserver.mojang.com/session/minecraft/profile/{uuid}")); + } + User user = new(name, uuid, profile); + return user; + } + public string GetSkinPart(SkinPart skinPart, string size = "64") { - return (string)$"https://visage.surgeplay.com/{skinPart}/{size}/{this.profile["profileId"]}" + return (string)$"https://visage.surgeplay.com/{skinPart}/{size}/{this.profile["profileId"]}"; } } diff --git a/src/obj/Debug/net6.0/spworlds.GeneratedMSBuildEditorConfig.editorconfig b/src/obj/Debug/net6.0/spworlds.GeneratedMSBuildEditorConfig.editorconfig index 57fd3f3..e1b4034 100644 --- a/src/obj/Debug/net6.0/spworlds.GeneratedMSBuildEditorConfig.editorconfig +++ b/src/obj/Debug/net6.0/spworlds.GeneratedMSBuildEditorConfig.editorconfig @@ -8,4 +8,4 @@ build_property.PlatformNeutralAssembly = build_property.EnforceExtendedAnalyzerRules = build_property._SupportedPlatformList = Linux,macOS,Windows build_property.RootNamespace = spworlds -build_property.ProjectDir = c:\Users\losev\OneDrive\Рабочий стол\spworlds\spworlds-csharp-library\src\ +build_property.ProjectDir = C:\Users\losev\OneDrive\Рабочий стол\spworlds\spworlds-csharp-library\src\ diff --git a/src/obj/Debug/net6.0/spworlds.assets.cache b/src/obj/Debug/net6.0/spworlds.assets.cache new file mode 100644 index 0000000000000000000000000000000000000000..a54fcc7048ed97cc736ae81c69658543dcefbb98 GIT binary patch literal 228 zcmWIWc6a1qU|{&RR6^{`pQ67jc!HzD+#eT|CoerS>;FVEhR#!;Ik!0$Jpig97BB%7 z$~#-dgche3702Y{7pIoR=;f8Br + + + True + NuGet + $(MSBuildThisFileDirectory)project.assets.json + $(UserProfile)\.nuget\packages\ + C:\Users\losev\.nuget\packages\;C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages + PackageReference + 6.7.0 + + + + + + \ No newline at end of file diff --git a/src/obj/spworlds.csproj.nuget.g.targets b/src/obj/spworlds.csproj.nuget.g.targets new file mode 100644 index 0000000..3dc06ef --- /dev/null +++ b/src/obj/spworlds.csproj.nuget.g.targets @@ -0,0 +1,2 @@ + + \ No newline at end of file