diff --git a/MinecraftLaunch.Test/Program.cs b/MinecraftLaunch.Test/Program.cs index 7b3db3b..1d1845f 100644 --- a/MinecraftLaunch.Test/Program.cs +++ b/MinecraftLaunch.Test/Program.cs @@ -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; @@ -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(); \ No newline at end of file diff --git a/MinecraftLaunch/Components/Converter/AccountJsonConverter.cs b/MinecraftLaunch/Components/Converter/AccountJsonConverter.cs index f29cdd3..25d6660 100644 --- a/MinecraftLaunch/Components/Converter/AccountJsonConverter.cs +++ b/MinecraftLaunch/Components/Converter/AccountJsonConverter.cs @@ -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(); } + } \ No newline at end of file diff --git a/MinecraftLaunch/MinecraftLaunch.csproj b/MinecraftLaunch/MinecraftLaunch.csproj index 2623f94..4e54b9e 100644 --- a/MinecraftLaunch/MinecraftLaunch.csproj +++ b/MinecraftLaunch/MinecraftLaunch.csproj @@ -1,6 +1,6 @@  - 3.1.0-preview02 + 3.1.0-preview03