Skip to content

Commit

Permalink
综合更新
Browse files Browse the repository at this point in the history
  • Loading branch information
YangSpring114 committed Jun 1, 2024
1 parent 289d2f2 commit 5a9db32
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 8 deletions.
14 changes: 8 additions & 6 deletions MinecraftLaunch.Test/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
using MinecraftLaunch.Components.Analyzer;
using MinecraftLaunch.Components.Installer;
using MinecraftLaunch.Components.Authenticator;
using MinecraftLaunch.Extensions;
using MinecraftLaunch.Classes.Models.Auth;

MirrorDownloadManager.IsUseMirrorDownloadSource = true;

Expand Down Expand Up @@ -118,14 +120,14 @@
#endregion

#region Crash Analysis
GameResolver gameResolver = new("C:\\Users\\w\\Desktop\\总整包\\MC\\mc启动器\\BakaXL\\.minecraft");
//GameResolver gameResolver = new("C:\\Users\\w\\Desktop\\总整包\\MC\\mc启动器\\BakaXL\\.minecraft");

var crashAnalyzer = new GameCrashAnalyzer(gameResolver.GetGameEntity("1.20.1"), true);
var reports = crashAnalyzer.AnalysisLogs();
//var crashAnalyzer = new GameCrashAnalyzer(gameResolver.GetGameEntity("1.20.1"), true);
//var reports = crashAnalyzer.AnalysisLogs();

foreach (var report in reports) {
Console.WriteLine(report);
}
//foreach (var report in reports) {
// Console.WriteLine(report);
//}
#endregion

Console.ReadKey();
26 changes: 25 additions & 1 deletion MinecraftLaunch/Components/Converter/AccountJsonConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,30 @@ public override Account Read(ref Utf8JsonReader reader, Type typeToConvert, Json
}

public override void Write(Utf8JsonWriter writer, Account value, JsonSerializerOptions options) {
throw new NotImplementedException();
writer.WriteStartObject();

// Write common properties
writer.WriteString("Name", value.Name);
writer.WriteString("Uuid", value.Uuid.ToString());
writer.WriteString("AccessToken", value.AccessToken);

// Write specific properties based on account type
switch (value) {
case OfflineAccount offlineAccount:
writer.WriteNumber("Type", (int)AccountType.Offline);
break;
case MicrosoftAccount microsoftAccount:
writer.WriteNumber("Type", (int)AccountType.Microsoft);
writer.WriteString("RefreshToken", microsoftAccount.RefreshToken);
break;
case YggdrasilAccount yggdrasilAccount:
writer.WriteNumber("Type", (int)AccountType.Yggdrasil);
writer.WriteString("ClientToken", yggdrasilAccount.ClientToken);
writer.WriteString("YggdrasilServerUrl", yggdrasilAccount.YggdrasilServerUrl);
break;
}

writer.WriteEndObject();
}

}
2 changes: 1 addition & 1 deletion MinecraftLaunch/MinecraftLaunch.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Version>3.1.0-preview02</Version>
<Version>3.1.0-preview03</Version>
</PropertyGroup>

<PropertyGroup>
Expand Down

0 comments on commit 5a9db32

Please sign in to comment.