diff --git a/src/Models/SimulateConfigModel.cs b/src/Models/SimulateConfigModel.cs
index beb9539..64832c4 100644
--- a/src/Models/SimulateConfigModel.cs
+++ b/src/Models/SimulateConfigModel.cs
@@ -5,38 +5,16 @@ namespace GeneralUpdate.Tools.Models;
public record PlatformItem(int Value, string DisplayName) { public override string ToString() => DisplayName; }
public record AppTypeItem(int Value, string DisplayName) { public override string ToString() => DisplayName; }
-///
-/// Configuration for the simulate-update module.
-///
public partial class SimulateConfigModel : ObservableObject
{
- /// User-provided old-version app directory to test against.
[ObservableProperty] private string _appDirectory = string.Empty;
-
- /// Path to a patch .zip generated by the Patch module.
[ObservableProperty] private string _patchFilePath = string.Empty;
-
- /// The current version of the app being tested.
[ObservableProperty] private string _currentVersion = "1.0.0.0";
-
- /// The target version the patch upgrades to.
[ObservableProperty] private string _targetVersion = "2.0.0.0";
-
- /// Platform selector.
- [ObservableProperty] private PlatformItem _platform = new(1, "Windows");
-
- /// AppType selector.
- [ObservableProperty] private AppTypeItem _appType = new(1, "ClientApp");
-
- /// Application secret key for the update API.
+ [ObservableProperty] private int _platform = 1;
+ [ObservableProperty] private int _appType = 1;
[ObservableProperty] private string _appSecretKey = "dfeb5833-975e-4afb-88f1-6278ee9aeff6";
-
- /// Product identifier.
[ObservableProperty] private string _productId = "2d974e2a-31e6-4887-9bb1-b4689e98c77a";
-
- /// Directory where client.cs / upgrade.cs and server are generated.
[ObservableProperty] private string _outputDirectory = string.Empty;
-
- /// Server port assigned at runtime (set by SimulationService).
public int ServerPort { get; set; } = 5000;
}
diff --git a/src/Services/ReportGeneratorService.cs b/src/Services/ReportGeneratorService.cs
index 45dba05..899cb92 100644
--- a/src/Services/ReportGeneratorService.cs
+++ b/src/Services/ReportGeneratorService.cs
@@ -26,8 +26,8 @@ public async Task GenerateAsync(
sb.AppendLine("|-------|-------|");
sb.AppendLine($"| Patch | {EscapeMd(config.PatchFilePath)} |");
sb.AppendLine($"| App Directory | {EscapeMd(config.AppDirectory)} |");
- sb.AppendLine($"| Platform | {config.Platform.DisplayName} |");
- sb.AppendLine($"| AppType | {config.AppType.DisplayName} |");
+ sb.AppendLine($"| Platform | {config.Platform} |");
+ sb.AppendLine($"| AppType | {config.AppType} |");
sb.AppendLine($"| Version | {config.CurrentVersion} → {config.TargetVersion} |");
sb.AppendLine($"| Server Port | {config.ServerPort} |");
sb.AppendLine($"| Simulation Time | {DateTime.Now:yyyy-MM-dd HH:mm:ss} |");
diff --git a/src/Services/SimulationService.cs b/src/Services/SimulationService.cs
index 9e7d6c0..0e828d9 100644
--- a/src/Services/SimulationService.cs
+++ b/src/Services/SimulationService.cs
@@ -50,7 +50,7 @@ public async Task RunAsync(
var hash = ComputeQuickHash(patchDest);
LocalUpdateServerFiles.Register(patchName, patchDest);
- _server.Updates.Add((config.CurrentVersion, config.TargetVersion, hash, patchDest, config.AppType.Value));
+ _server.Updates.Add((config.CurrentVersion, config.TargetVersion, hash, patchDest, config.AppType));
await _server.StartAsync(config.ServerPort);
Log($" Server running on {_server.BaseUrl}", progress);
diff --git a/src/ViewModels/SimulateViewModel.cs b/src/ViewModels/SimulateViewModel.cs
index c419a1b..0bc67c0 100644
--- a/src/ViewModels/SimulateViewModel.cs
+++ b/src/ViewModels/SimulateViewModel.cs
@@ -1,6 +1,7 @@
using System;
using System.Collections.ObjectModel;
using System.IO;
+using System.Linq;
using System.Threading.Tasks;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
@@ -36,8 +37,26 @@ public partial class SimulateViewModel : ViewModelBase
public SimulateViewModel()
{
_status = _loc["Patch.Ready"];
- Config.Platform = Platforms[0];
- Config.AppType = AppTypes[0];
+ }
+
+ ///
+ /// Maps Config.Platform (int) to Platforms collection index.
+ /// 1 (Windows) → 0, 2 (Linux) → 1.
+ ///
+ public int PlatformIndex
+ {
+ get => Config.Platform == 2 ? 1 : 0;
+ set => Config.Platform = value == 1 ? 2 : 1;
+ }
+
+ ///
+ /// Maps Config.AppType (int) to AppTypes collection index.
+ /// 1 (ClientApp) → 0, 2 (UpgradeApp) → 1.
+ ///
+ public int AppTypeIndex
+ {
+ get => Config.AppType == 2 ? 1 : 0;
+ set => Config.AppType = value == 1 ? 2 : 1;
}
async Task PickFolder(string title)
@@ -87,7 +106,6 @@ async Task StartSimulation()
foreach (var note in result.Notes)
L($" Note: {note}");
- // Generate report
var reportPath = await _report.GenerateAsync(Config, result, Config.OutputDirectory);
L($"Report: {reportPath}");
}
diff --git a/src/Views/SimulateView.axaml b/src/Views/SimulateView.axaml
index 4c27b84..e09b162 100644
--- a/src/Views/SimulateView.axaml
+++ b/src/Views/SimulateView.axaml
@@ -38,10 +38,10 @@
+ SelectedIndex="{Binding PlatformIndex}" Margin="8,0,16,0"/>
+ SelectedIndex="{Binding AppTypeIndex}" Margin="8,0"/>