fix: loading JetBrains Toolbox stage.json crash

This commit is contained in:
leo 2024-04-27 22:05:17 +08:00
parent cdaa2d7548
commit fdf95e39a7

View file

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
using System.IO; using System.IO;
using System.Text.Json; using System.Text.Json;
using System.Text.Json.Serialization;
using Avalonia.Media.Imaging; using Avalonia.Media.Imaging;
using Avalonia.Platform; using Avalonia.Platform;
@ -51,21 +52,33 @@ namespace SourceGit.Models
public class JetBrainsState public class JetBrainsState
{ {
public int Version { get; set; } [JsonPropertyName("version")]
public string AppVersion { get; set; } public int Version { get; set; } = 0;
public List<JetBrainsTool> Tools { get; set; } [JsonPropertyName("appVersion")]
public string AppVersion { get; set; } = string.Empty;
[JsonPropertyName("tools")]
public List<JetBrainsTool> Tools { get; set; } = new List<JetBrainsTool>();
} }
public class JetBrainsTool public class JetBrainsTool
{ {
[JsonPropertyName("channelId")]
public string ChannelId { get; set; } public string ChannelId { get; set; }
[JsonPropertyName("toolId")]
public string ToolId { get; set; } public string ToolId { get; set; }
[JsonPropertyName("productCode")]
public string ProductCode { get; set; } public string ProductCode { get; set; }
[JsonPropertyName("tag")]
public string Tag { get; set; } public string Tag { get; set; }
[JsonPropertyName("displayName")]
public string DisplayName { get; set; } public string DisplayName { get; set; }
[JsonPropertyName("displayVersion")]
public string DisplayVersion { get; set; } public string DisplayVersion { get; set; }
[JsonPropertyName("buildNumber")]
public string BuildNumber { get; set; } public string BuildNumber { get; set; }
[JsonPropertyName("installLocation")]
public string InstallLocation { get; set; } public string InstallLocation { get; set; }
[JsonPropertyName("launchCommand")]
public string LaunchCommand { get; set; } public string LaunchCommand { get; set; }
} }