installer: wizard C# Windows d'installation guidee (WSL2, Podman, agent, desinstallation)

This commit is contained in:
EduBox Dev
2026-06-28 20:49:57 +00:00
parent d2c3edea2f
commit 0f07a2d2a3
7 changed files with 1196 additions and 0 deletions
@@ -0,0 +1,78 @@
using System.Text.Json;
using System.Text.Json.Serialization;
namespace StudioE5.SetupWizard;
public enum WizardStep
{
Welcome,
Prerequisites,
InstallVirtualEnvironment,
RestartRequired,
InstallPodman,
ConfigurePodman,
InstallAgent,
Finished,
Uninstall
}
public class InstallerState
{
[JsonPropertyName("step")]
public WizardStep Step { get; set; } = WizardStep.Welcome;
[JsonPropertyName("virtualEnvironmentInstalled")]
public bool VirtualEnvironmentInstalled { get; set; }
[JsonPropertyName("podmanInstalled")]
public bool PodmanInstalled { get; set; }
[JsonPropertyName("podmanConfigured")]
public bool PodmanConfigured { get; set; }
[JsonPropertyName("agentInstalled")]
public bool AgentInstalled { get; set; }
private static string StateFilePath
{
get
{
var dir = Path.Combine(
Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData),
"studioE5",
"installer");
Directory.CreateDirectory(dir);
return Path.Combine(dir, "installer-state.json");
}
}
public static InstallerState Load()
{
var path = StateFilePath;
if (!File.Exists(path))
return new InstallerState();
try
{
var json = File.ReadAllText(path);
return JsonSerializer.Deserialize<InstallerState>(json) ?? new InstallerState();
}
catch
{
return new InstallerState();
}
}
public void Save()
{
var json = JsonSerializer.Serialize(this, new JsonSerializerOptions { WriteIndented = true });
File.WriteAllText(StateFilePath, json);
}
public static void Delete()
{
var path = StateFilePath;
if (File.Exists(path))
File.Delete(path);
}
}