Files
brass-and-sigil/launcher/Models/LauncherSettings.cs
T
Matt Sijbers a1331212cb Initial commit: Brass & Sigil monorepo
Self-hosted Minecraft modpack distribution + administration system.

- launcher/  Avalonia 12 desktop client; single-file win-x64 publish.
             Microsoft auth via XboxAuthNet, manifest+SHA-1 mod sync,
             portable install path, sidecar settings.
- server/    brass-sigil-server daemon (.NET 8, linux-x64). Wraps the
             MC subprocess, embedded Kestrel admin panel with cookie
             auth + rate limiting, RCON bridge, scheduled backups,
             BlueMap CLI integration with player markers + skin proxy,
             friend-side whitelist request flow, world wipe with seed
             selection (keep current / random / custom).
- pack/      pack.lock.json (Modrinth + manual CurseForge entries),
             data-only tweak source under tweaks/, build outputs in
             overrides/ (gitignored).
- scripts/   Build-Pack / Build-Tweaks / Update-Pack / Check-Updates
             plus Deploy-Brass.ps1 unified one-shot deploy with
             version-bump pre-flight and daemon-state detection.
2026-05-05 00:19:05 +01:00

55 lines
1.5 KiB
C#

using System;
using System.IO;
using System.Text.Json;
using System.Text.Json.Serialization;
namespace ModpackLauncher.Models;
public sealed class LauncherSettings
{
[JsonPropertyName("memoryMB")]
public int? MemoryMB { get; set; }
[JsonPropertyName("installDirOverride")]
public string? InstallDirOverride { get; set; }
/// <summary>
/// Settings live next to the launcher exe ("sidecar"), so each copy of
/// the launcher has its own independent state. Drop the launcher in a
/// new folder on a different machine, or alongside the existing one in
/// a separate directory, and they remember their own install paths,
/// memory choices, etc. Matches the portable-app convention.
/// </summary>
private static string FilePath
=> Path.Combine(AppContext.BaseDirectory, "launcher-settings.json");
public static LauncherSettings Load()
{
try
{
if (!File.Exists(FilePath)) return new LauncherSettings();
return JsonSerializer.Deserialize<LauncherSettings>(File.ReadAllText(FilePath))
?? new LauncherSettings();
}
catch
{
return new LauncherSettings();
}
}
public void Save()
{
try
{
File.WriteAllText(
FilePath,
JsonSerializer.Serialize(this, new JsonSerializerOptions { WriteIndented = true })
);
}
catch
{
// best-effort
}
}
}