This commit is contained in:
Mih4n
2023-10-18 20:11:13 +03:00
parent dd711dd7c3
commit d65169c2b1
12 changed files with 225 additions and 18 deletions

View File

@@ -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

View File

@@ -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
}

View File

@@ -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<User> 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"]}";
}
}

View File

@@ -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\

Binary file not shown.

View File

@@ -0,0 +1 @@
ea2a75c5749114fe276abf3a71c3ee414ecd4625

View File

@@ -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

View File

@@ -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"
}
}
}
}

View File

@@ -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": []
}

View File

@@ -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"
}
}
}
}
}

View File

@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<RestoreSuccess Condition=" '$(RestoreSuccess)' == '' ">True</RestoreSuccess>
<RestoreTool Condition=" '$(RestoreTool)' == '' ">NuGet</RestoreTool>
<ProjectAssetsFile Condition=" '$(ProjectAssetsFile)' == '' ">$(MSBuildThisFileDirectory)project.assets.json</ProjectAssetsFile>
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">$(UserProfile)\.nuget\packages\</NuGetPackageRoot>
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">C:\Users\losev\.nuget\packages\;C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages</NuGetPackageFolders>
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">6.7.0</NuGetToolVersion>
</PropertyGroup>
<ItemGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<SourceRoot Include="C:\Users\losev\.nuget\packages\" />
<SourceRoot Include="C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages\" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" />