- .NET 8 WPF app with full MVVM architecture - One-click boost: CPU, RAM, GPU, network, services, timer resolution - Real-time system monitor (LibreHardwareMonitor) - Auto game detection (30+ games) - RAM optimizer with kernel-level cleanup - Network optimizer (TCP registry tweaks) - Service manager, process manager, shader cache cleaner - Desktop widget overlay - Debug log viewer - Custom dark gaming theme with trans pride colors - 84 unit tests (xUnit) - Inno Setup installer script - Landing page website
78 lines
3.4 KiB
C#
78 lines
3.4 KiB
C#
using System.IO;
|
|
using System.Text.Json;
|
|
|
|
namespace SpdUp.Models;
|
|
|
|
/// <summary>
|
|
/// Persisted application settings.
|
|
/// </summary>
|
|
public sealed class AppSettings
|
|
{
|
|
private static readonly string _filePath = Path.Combine(
|
|
Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "SpdUp", "settings.json");
|
|
|
|
// ── General ────────────────────────────────────────────────────────
|
|
public bool MinimizeToTray { get; set; } = true;
|
|
public bool StartWithWindows { get; set; } = false;
|
|
public bool AutoDetectGames { get; set; } = true;
|
|
public bool AutoBoostOnGameLaunch { get; set; } = true;
|
|
|
|
// ── Widget ─────────────────────────────────────────────────────────
|
|
public bool ShowWidget { get; set; } = false;
|
|
public bool WidgetCompactMode { get; set; } = true;
|
|
public double WidgetLeft { get; set; } = 100;
|
|
public double WidgetTop { get; set; } = 100;
|
|
public double WidgetOpacity { get; set; } = 0.85;
|
|
public int WidgetUpdateIntervalMs { get; set; } = 1000;
|
|
public bool WidgetClickThrough { get; set; } = false;
|
|
|
|
// ── Monitoring ─────────────────────────────────────────────────────
|
|
public int MonitoringIntervalMs { get; set; } = 1000;
|
|
|
|
// ── Network ────────────────────────────────────────────────────────
|
|
public string PingTarget { get; set; } = "8.8.8.8";
|
|
public string PreferredDns { get; set; } = "1.1.1.1";
|
|
|
|
// ── Game Library ───────────────────────────────────────────────────
|
|
public List<GameEntry> Games { get; set; } = new();
|
|
|
|
// ── Boost services to stop ─────────────────────────────────────────
|
|
public List<string> ServicesToStop { get; set; } = new()
|
|
{
|
|
"SysMain", "WSearch", "DiagTrack", "TabletInputService", "MapsBroker",
|
|
"PcaSvc", "wisvc"
|
|
};
|
|
|
|
// ── Persistence ────────────────────────────────────────────────────
|
|
private static readonly JsonSerializerOptions _jsonOpts = new()
|
|
{
|
|
WriteIndented = true,
|
|
PropertyNameCaseInsensitive = true
|
|
};
|
|
|
|
public static AppSettings Load()
|
|
{
|
|
try
|
|
{
|
|
if (File.Exists(_filePath))
|
|
{
|
|
var json = File.ReadAllText(_filePath);
|
|
return JsonSerializer.Deserialize<AppSettings>(json, _jsonOpts) ?? new AppSettings();
|
|
}
|
|
}
|
|
catch { /* return default */ }
|
|
return new AppSettings();
|
|
}
|
|
|
|
public void Save()
|
|
{
|
|
try
|
|
{
|
|
var dir = Path.GetDirectoryName(_filePath)!;
|
|
Directory.CreateDirectory(dir);
|
|
File.WriteAllText(_filePath, JsonSerializer.Serialize(this, _jsonOpts));
|
|
}
|
|
catch { /* best-effort */ }
|
|
}
|
|
}
|