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 0000000..a54fcc7 Binary files /dev/null and b/src/obj/Debug/net6.0/spworlds.assets.cache differ diff --git a/src/obj/Debug/net6.0/spworlds.csproj.CoreCompileInputs.cache b/src/obj/Debug/net6.0/spworlds.csproj.CoreCompileInputs.cache new file mode 100644 index 0000000..1bc6301 --- /dev/null +++ b/src/obj/Debug/net6.0/spworlds.csproj.CoreCompileInputs.cache @@ -0,0 +1 @@ +ea2a75c5749114fe276abf3a71c3ee414ecd4625 diff --git a/src/obj/Debug/net6.0/spworlds.csproj.FileListAbsolute.txt b/src/obj/Debug/net6.0/spworlds.csproj.FileListAbsolute.txt new file mode 100644 index 0000000..a5f2b70 --- /dev/null +++ b/src/obj/Debug/net6.0/spworlds.csproj.FileListAbsolute.txt @@ -0,0 +1,4 @@ +C:\Users\losev\OneDrive\Рабочий стол\spworlds\spworlds-csharp-library\src\obj\Debug\net6.0\spworlds.GeneratedMSBuildEditorConfig.editorconfig +C:\Users\losev\OneDrive\Рабочий стол\spworlds\spworlds-csharp-library\src\obj\Debug\net6.0\spworlds.AssemblyInfoInputs.cache +C:\Users\losev\OneDrive\Рабочий стол\spworlds\spworlds-csharp-library\src\obj\Debug\net6.0\spworlds.AssemblyInfo.cs +C:\Users\losev\OneDrive\Рабочий стол\spworlds\spworlds-csharp-library\src\obj\Debug\net6.0\spworlds.csproj.CoreCompileInputs.cache diff --git a/src/obj/project.assets.json b/src/obj/project.assets.json new file mode 100644 index 0000000..13f5896 --- /dev/null +++ b/src/obj/project.assets.json @@ -0,0 +1,73 @@ +{ + "version": 3, + "targets": { + "net6.0": {} + }, + "libraries": {}, + "projectFileDependencyGroups": { + "net6.0": [] + }, + "packageFolders": { + "C:\\Users\\losev\\.nuget\\packages\\": {}, + "C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages": {} + }, + "project": { + "version": "1.0.1", + "restore": { + "projectUniqueName": "C:\\Users\\losev\\OneDrive\\Рабочий стол\\spworlds\\spworlds-csharp-library\\src\\spworlds.csproj", + "projectName": "spworlds", + "projectPath": "C:\\Users\\losev\\OneDrive\\Рабочий стол\\spworlds\\spworlds-csharp-library\\src\\spworlds.csproj", + "packagesPath": "C:\\Users\\losev\\.nuget\\packages\\", + "outputPath": "C:\\Users\\losev\\OneDrive\\Рабочий стол\\spworlds\\spworlds-csharp-library\\src\\obj\\", + "projectStyle": "PackageReference", + "fallbackFolders": [ + "C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages" + ], + "configFilePaths": [ + "C:\\Users\\losev\\AppData\\Roaming\\NuGet\\NuGet.Config", + "C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.FallbackLocation.config", + "C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config" + ], + "originalTargetFrameworks": [ + "net6.0" + ], + "sources": { + "C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {}, + "https://api.nuget.org/v3/index.json": {} + }, + "frameworks": { + "net6.0": { + "targetAlias": "net6.0", + "projectReferences": {} + } + }, + "warningProperties": { + "warnAsError": [ + "NU1605" + ] + } + }, + "frameworks": { + "net6.0": { + "targetAlias": "net6.0", + "imports": [ + "net461", + "net462", + "net47", + "net471", + "net472", + "net48", + "net481" + ], + "assetTargetFallback": true, + "warn": true, + "frameworkReferences": { + "Microsoft.NETCore.App": { + "privateAssets": "all" + } + }, + "runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\7.0.401\\RuntimeIdentifierGraph.json" + } + } + } +} \ No newline at end of file diff --git a/src/obj/project.nuget.cache b/src/obj/project.nuget.cache new file mode 100644 index 0000000..5048a3a --- /dev/null +++ b/src/obj/project.nuget.cache @@ -0,0 +1,8 @@ +{ + "version": 2, + "dgSpecHash": "BcScqcBajGeCpumrD0XHCVXubY8iGSvVtyfgtqEr1b+ZFER5tFI/jvxsd7fM+aNBX0ZgxKhrR3Trd/3mtyDYsQ==", + "success": true, + "projectFilePath": "C:\\Users\\losev\\OneDrive\\Рабочий стол\\spworlds\\spworlds-csharp-library\\src\\spworlds.csproj", + "expectedPackageFiles": [], + "logs": [] +} \ No newline at end of file diff --git a/src/obj/spworlds.csproj.nuget.dgspec.json b/src/obj/spworlds.csproj.nuget.dgspec.json new file mode 100644 index 0000000..fe9171f --- /dev/null +++ b/src/obj/spworlds.csproj.nuget.dgspec.json @@ -0,0 +1,67 @@ +{ + "format": 1, + "restore": { + "C:\\Users\\losev\\OneDrive\\Рабочий стол\\spworlds\\spworlds-csharp-library\\src\\spworlds.csproj": {} + }, + "projects": { + "C:\\Users\\losev\\OneDrive\\Рабочий стол\\spworlds\\spworlds-csharp-library\\src\\spworlds.csproj": { + "version": "1.0.1", + "restore": { + "projectUniqueName": "C:\\Users\\losev\\OneDrive\\Рабочий стол\\spworlds\\spworlds-csharp-library\\src\\spworlds.csproj", + "projectName": "spworlds", + "projectPath": "C:\\Users\\losev\\OneDrive\\Рабочий стол\\spworlds\\spworlds-csharp-library\\src\\spworlds.csproj", + "packagesPath": "C:\\Users\\losev\\.nuget\\packages\\", + "outputPath": "C:\\Users\\losev\\OneDrive\\Рабочий стол\\spworlds\\spworlds-csharp-library\\src\\obj\\", + "projectStyle": "PackageReference", + "fallbackFolders": [ + "C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages" + ], + "configFilePaths": [ + "C:\\Users\\losev\\AppData\\Roaming\\NuGet\\NuGet.Config", + "C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.FallbackLocation.config", + "C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config" + ], + "originalTargetFrameworks": [ + "net6.0" + ], + "sources": { + "C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {}, + "https://api.nuget.org/v3/index.json": {} + }, + "frameworks": { + "net6.0": { + "targetAlias": "net6.0", + "projectReferences": {} + } + }, + "warningProperties": { + "warnAsError": [ + "NU1605" + ] + } + }, + "frameworks": { + "net6.0": { + "targetAlias": "net6.0", + "imports": [ + "net461", + "net462", + "net47", + "net471", + "net472", + "net48", + "net481" + ], + "assetTargetFallback": true, + "warn": true, + "frameworkReferences": { + "Microsoft.NETCore.App": { + "privateAssets": "all" + } + }, + "runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\7.0.401\\RuntimeIdentifierGraph.json" + } + } + } + } +} \ No newline at end of file diff --git a/src/obj/spworlds.csproj.nuget.g.props b/src/obj/spworlds.csproj.nuget.g.props new file mode 100644 index 0000000..631dc36 --- /dev/null +++ b/src/obj/spworlds.csproj.nuget.g.props @@ -0,0 +1,16 @@ + + + + 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