Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

对versionManifest.json和version.json的解析 #32

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions PCL2.Neo.sln
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ VisualStudioVersion = 17.12.35527.113
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PCL2.Neo", "PCL2.Neo\PCL2.Neo.csproj", "{AF527853-D92E-44CE-A3EB-1E308C4FBFE2}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PCL2.NeoTests", "PCL2.NeoTests\PCL2.NeoTests.csproj", "{41B478FE-8F3D-4611-8C5F-5396FF8DF6AF}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -15,6 +17,10 @@ Global
{AF527853-D92E-44CE-A3EB-1E308C4FBFE2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AF527853-D92E-44CE-A3EB-1E308C4FBFE2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AF527853-D92E-44CE-A3EB-1E308C4FBFE2}.Release|Any CPU.Build.0 = Release|Any CPU
{41B478FE-8F3D-4611-8C5F-5396FF8DF6AF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{41B478FE-8F3D-4611-8C5F-5396FF8DF6AF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{41B478FE-8F3D-4611-8C5F-5396FF8DF6AF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{41B478FE-8F3D-4611-8C5F-5396FF8DF6AF}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
16 changes: 16 additions & 0 deletions PCL2.Neo.sln.DotSettings.user
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,20 @@
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AThrowHelper_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Ffe877ad5dc9742caa5e7dfcad5831d581e2200_003F82_003F21113a39_003FThrowHelper_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ATransitionBase_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Ffe877ad5dc9742caa5e7dfcad5831d581e2200_003F01_003Fa44768fa_003FTransitionBase_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ATransition_00601_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Ffe877ad5dc9742caa5e7dfcad5831d581e2200_003F62_003F990aa4ca_003FTransition_00601_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>

<s:String x:Key="/Default/Environment/UnitTesting/UnitTestSessionStore/Sessions/=a9115186_002D5849_002D49ef_002D86f4_002D9abe9cb909ee/@EntryIndexedValue">&lt;SessionState ContinuousTestingMode="0" IsActive="True" Name="TirmTest" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session"&gt;&#xD;
&lt;TestAncestor&gt;&#xD;
&lt;TestId&gt;MSTest::41B478FE-8F3D-4611-8C5F-5396FF8DF6AF::net9.0::PCL2.Neo.Models.Minecraft.McVersion.VersionData.Tests.MethodTest.TirmTest&lt;/TestId&gt;&#xD;
&lt;TestId&gt;MSTest::41B478FE-8F3D-4611-8C5F-5396FF8DF6AF::net9.0::PCL2.Neo.Models.Minecraft.McVersion.VersionData.Tests.VersionTests.ParserTest&lt;/TestId&gt;&#xD;
&lt;/TestAncestor&gt;&#xD;
&lt;/SessionState&gt;</s:String>
<s:String x:Key="/Default/Environment/UnitTesting/UnitTestSessionStore/Sessions/=b864a8c0_002D7434_002D413c_002D9a52_002Df616cc25c09d/@EntryIndexedValue">&lt;SessionState ContinuousTestingMode="0" Name="LibrariesParserTest" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session"&gt;&#xD;
&lt;TestAncestor&gt;&#xD;
&lt;TestId&gt;MSTest::41B478FE-8F3D-4611-8C5F-5396FF8DF6AF::net9.0::PCL2.Neo.Models.Minecraft.McVersion.VersionData.Tests.VersionTests.LibrariesParserTest&lt;/TestId&gt;&#xD;
&lt;TestId&gt;MSTest::41B478FE-8F3D-4611-8C5F-5396FF8DF6AF::net9.0::PCL2.Neo.Models.Minecraft.McVersion.VersionData.Tests.VersionTests.RebuildJsonTest&lt;/TestId&gt;&#xD;
&lt;TestId&gt;MSTest::41B478FE-8F3D-4611-8C5F-5396FF8DF6AF::net9.0::PCL2.Neo.Models.Minecraft.McVersion.VersionData.Tests.VersionTests.ParserTest&lt;/TestId&gt;&#xD;
&lt;/TestAncestor&gt;&#xD;
&lt;/SessionState&gt;</s:String>

<s:String x:Key="/Default/Profiling/Configurations/=2/@EntryIndexedValue">&lt;data&gt;&lt;HostParameters type="LocalHostParameters" /&gt;&lt;Argument type="StandaloneArgument"&gt;&lt;Arguments IsNull="False"&gt;&lt;/Arguments&gt;&lt;FileName IsNull="False"&gt;&lt;/FileName&gt;&lt;WorkingDirectory IsNull="False"&gt;&lt;/WorkingDirectory&gt;&lt;Scope&gt;&lt;ProcessFilters /&gt;&lt;/Scope&gt;&lt;/Argument&gt;&lt;Info type="TimelineInfo"&gt;&lt;LoadPdb&gt;True&lt;/LoadPdb&gt;&lt;/Info&gt;&lt;CoreOptions type="CoreOptions"&gt;&lt;CoreTempPath IsNull="False"&gt;&lt;/CoreTempPath&gt;&lt;RemoteEndPoint IsNull="False"&gt;&lt;/RemoteEndPoint&gt;&lt;AdditionalEnvironmentVariables&gt;&lt;Item&gt;&lt;Key&gt;DOTNET_ENVIRONMENT&lt;/Key&gt;&lt;Value&gt;Development&lt;/Value&gt;&lt;/Item&gt;&lt;Item&gt;&lt;Key&gt;COMPLUS_InstallRoot&lt;/Key&gt;&lt;Value IsNull="False"&gt;&lt;/Value&gt;&lt;/Item&gt;&lt;Item&gt;&lt;Key&gt;RESHARPER_HOST_VERSION&lt;/Key&gt;&lt;Value&gt;243.0.20241111.161023&lt;/Value&gt;&lt;/Item&gt;&lt;Item&gt;&lt;Key&gt;COMPLUS_Version&lt;/Key&gt;&lt;Value IsNull="False"&gt;&lt;/Value&gt;&lt;/Item&gt;&lt;Item&gt;&lt;Key&gt;RESHARPER_TESTRUNNER&lt;/Key&gt;&lt;Value&gt;Profile&lt;/Value&gt;&lt;/Item&gt;&lt;Item&gt;&lt;Key&gt;RESHARPER_HOST&lt;/Key&gt;&lt;Value&gt;ReSharperPlatformVs17&lt;/Value&gt;&lt;/Item&gt;&lt;/AdditionalEnvironmentVariables&gt;&lt;/CoreOptions&gt;&lt;HostOptions type="HostOptions"&gt;&lt;HostTempPath IsNull="False"&gt;&lt;/HostTempPath&gt;&lt;ReprofileDisableReason&gt;LaunchedByReSharperUnitTestRunner&lt;/ReprofileDisableReason&gt;&lt;/HostOptions&gt;&lt;/data&gt;</s:String>
</wpf:ResourceDictionary>
23 changes: 14 additions & 9 deletions PCL2.Neo/.editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ dotnet_search_reference_assemblies = true
# 组织 Using
dotnet_separate_import_directive_groups = false
dotnet_sort_system_directives_first = false
file_header_template = unset
file_header_template =

# this. 和 Me. 首选项
dotnet_style_qualification_for_event = false
Expand Down Expand Up @@ -219,28 +219,33 @@ dotnet_naming_rule.non_field_members_should_be_pascal_case.style = pascal_case

dotnet_naming_symbols.interface.applicable_kinds = interface
dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.interface.required_modifiers =
dotnet_naming_symbols.interface.required_modifiers =

dotnet_naming_symbols.types.applicable_kinds = class, struct, interface, enum
dotnet_naming_symbols.types.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.types.required_modifiers =
dotnet_naming_symbols.types.required_modifiers =

dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method
dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.non_field_members.required_modifiers =
dotnet_naming_symbols.non_field_members.required_modifiers =

# 命名样式

dotnet_naming_style.pascal_case.required_prefix =
dotnet_naming_style.pascal_case.required_suffix =
dotnet_naming_style.pascal_case.word_separator =
dotnet_naming_style.pascal_case.required_prefix =
dotnet_naming_style.pascal_case.required_suffix =
dotnet_naming_style.pascal_case.word_separator =
dotnet_naming_style.pascal_case.capitalization = pascal_case

dotnet_naming_style.begins_with_i.required_prefix = I
dotnet_naming_style.begins_with_i.required_suffix =
dotnet_naming_style.begins_with_i.word_separator =
dotnet_naming_style.begins_with_i.required_suffix =
dotnet_naming_style.begins_with_i.word_separator =
dotnet_naming_style.begins_with_i.capitalization = pascal_case

# ReSharper properties
resharper_int_align_fields = true
resharper_int_align_variables = true
resharper_place_accessorholder_attribute_on_same_line = false

[*.{cs,vb}]
end_of_line = crlf
dotnet_style_qualification_for_field = false:silent
Expand Down
6 changes: 3 additions & 3 deletions PCL2.Neo/Models/Audio/AudioData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ public enum FileType

public class AudioData
{
public required string Name { get; set; }
public required string Path { get; set; }
public required FileType Type { get; set; }
public string Name { get; set; }
public string Path { get; set; }
public FileType Type { get; set; }
}
}
4 changes: 2 additions & 2 deletions PCL2.Neo/Models/Minecraft/JavaData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ namespace PCL2.Neo.Models.Minecraft
{
internal record JavaExist
{
public required bool IsExist { get; set; }
public bool IsExist { get; set; }

public required string Path { get; set; }
public string Path { get; set; }
}
public class JavaEntity(string path)
{
Expand Down
42 changes: 42 additions & 0 deletions PCL2.Neo/Models/Minecraft/McVersion/Downloader.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
using PCL2.Neo.Models.Minecraft.McVersion.VersionManifest;
using System;
using System.Net.Http;
using System.Text.Json;
using System.Threading.Tasks;

namespace PCL2.Neo.Models.Minecraft.McVersion
{
public class Downloader
{
public static async Task<VersionManifestData?> GetVersionManifest()
{
try
{
using var client = new HttpClient();
var response = await client
.GetStringAsync("https://launchermeta.mojang.com/mc/game/version_manifest.json");
return JsonSerializer.Deserialize<VersionManifestData>(response);
}
catch (HttpRequestException e)
{
// TODO: Handle Exception
throw;
}
}

public static async Task<string> GetVersionInfo(VersionInfo info)
{
try
{
using var client = new HttpClient();
return await client
.GetStringAsync(info.Url);
}
catch (HttpRequestException e)
{
// TODO: Handle Exception
throw;
}
}
}
}
Loading
Loading