|
| 1 | +using System.Collections.Generic; |
| 2 | +using Newtonsoft.Json; |
| 3 | + |
| 4 | +namespace GeneralUpdate.Tools.Configuration; |
| 5 | + |
| 6 | +/// <summary> |
| 7 | +/// Top-level application configuration model. |
| 8 | +/// Persisted to <c>%APPDATA%/GeneralUpdate.Tools/config.json</c>. |
| 9 | +/// </summary> |
| 10 | +public class AppConfig |
| 11 | +{ |
| 12 | + /// <summary>Configuration schema version, for migration support.</summary> |
| 13 | + [JsonProperty("_schemaVersion")] |
| 14 | + public int SchemaVersion { get; set; } = 1; |
| 15 | + |
| 16 | + // ── UI Preferences ──────────────────────────────────────── |
| 17 | + |
| 18 | + [JsonProperty("language")] |
| 19 | + public string Language { get; set; } = "zh-CN"; |
| 20 | + |
| 21 | + [JsonProperty("theme")] |
| 22 | + public string Theme { get; set; } = "Light"; |
| 23 | + |
| 24 | + [JsonProperty("windowWidth")] |
| 25 | + public double WindowWidth { get; set; } = 960; |
| 26 | + |
| 27 | + [JsonProperty("windowHeight")] |
| 28 | + public double WindowHeight { get; set; } = 640; |
| 29 | + |
| 30 | + [JsonProperty("windowMaximized")] |
| 31 | + public bool WindowMaximized { get; set; } |
| 32 | + |
| 33 | + // ── Path Memory ─────────────────────────────────────────── |
| 34 | + |
| 35 | + [JsonProperty("lastPatchOldDir")] |
| 36 | + public string LastPatchOldDir { get; set; } = string.Empty; |
| 37 | + |
| 38 | + [JsonProperty("lastPatchNewDir")] |
| 39 | + public string LastPatchNewDir { get; set; } = string.Empty; |
| 40 | + |
| 41 | + [JsonProperty("lastPatchOutputDir")] |
| 42 | + public string LastPatchOutputDir { get; set; } = string.Empty; |
| 43 | + |
| 44 | + [JsonProperty("lastSimulateAppDir")] |
| 45 | + public string LastSimulateAppDir { get; set; } = string.Empty; |
| 46 | + |
| 47 | + [JsonProperty("lastSimulatePatchFile")] |
| 48 | + public string LastSimulatePatchFile { get; set; } = string.Empty; |
| 49 | + |
| 50 | + [JsonProperty("lastSimulateOutputDir")] |
| 51 | + public string LastSimulateOutputDir { get; set; } = string.Empty; |
| 52 | + |
| 53 | + [JsonProperty("lastConfigClientPath")] |
| 54 | + public string LastConfigClientPath { get; set; } = string.Empty; |
| 55 | + |
| 56 | + [JsonProperty("lastConfigUpgradePath")] |
| 57 | + public string LastConfigUpgradePath { get; set; } = string.Empty; |
| 58 | + |
| 59 | + [JsonProperty("lastOssOutputDir")] |
| 60 | + public string LastOssOutputDir { get; set; } = string.Empty; |
| 61 | + |
| 62 | + [JsonProperty("lastExtensionDir")] |
| 63 | + public string LastExtensionDir { get; set; } = string.Empty; |
| 64 | + |
| 65 | + [JsonProperty("lastExtensionOutputDir")] |
| 66 | + public string LastExtensionOutputDir { get; set; } = string.Empty; |
| 67 | + |
| 68 | + // ── Upload Configuration ────────────────────────────────── |
| 69 | + |
| 70 | + [JsonProperty("uploadServerUrl")] |
| 71 | + public string UploadServerUrl { get; set; } = string.Empty; |
| 72 | + |
| 73 | + [JsonProperty("uploadEndpoint")] |
| 74 | + public string UploadEndpoint { get; set; } = "/api/v1/packages/upload"; |
| 75 | + |
| 76 | + [JsonProperty("uploadTimeoutSeconds")] |
| 77 | + public int UploadTimeoutSeconds { get; set; } = 300; |
| 78 | + |
| 79 | + [JsonProperty("uploadRetryCount")] |
| 80 | + public int UploadRetryCount { get; set; } = 3; |
| 81 | + |
| 82 | + [JsonProperty("autoUploadEnabled")] |
| 83 | + public bool AutoUploadEnabled { get; set; } |
| 84 | + |
| 85 | + [JsonProperty("uploadAuth")] |
| 86 | + public AuthCredential UploadAuth { get; set; } = new(); |
| 87 | + |
| 88 | + // ── Simulation Configuration ────────────────────────────── |
| 89 | + |
| 90 | + [JsonProperty("simulationServerPort")] |
| 91 | + public string SimulationServerPort { get; set; } = "5000"; |
| 92 | + |
| 93 | + [JsonProperty("simulationRequireAuth")] |
| 94 | + public bool SimulationRequireAuth { get; set; } |
| 95 | + |
| 96 | + [JsonProperty("simulationAuth")] |
| 97 | + public AuthCredential SimulationAuth { get; set; } = new(); |
| 98 | + |
| 99 | + [JsonProperty("simulationPlatformType")] |
| 100 | + public string SimulationPlatformType { get; set; } = "Windows"; |
| 101 | + |
| 102 | + [JsonProperty("simulationAppType")] |
| 103 | + public string SimulationAppType { get; set; } = "Client"; |
| 104 | + |
| 105 | + // ── Feature Switches ────────────────────────────────────── |
| 106 | + |
| 107 | + [JsonProperty("encryptionScanEnabled")] |
| 108 | + public bool EncryptionScanEnabled { get; set; } = true; |
| 109 | + |
| 110 | + [JsonProperty("autoValidateSemver")] |
| 111 | + public bool AutoValidateSemver { get; set; } = true; |
| 112 | + |
| 113 | + [JsonProperty("showJsonPreview")] |
| 114 | + public bool ShowJsonPreview { get; set; } = true; |
| 115 | +} |
0 commit comments