fix(DD2Switcher): improve settings loading logging and update keybind textbox with current value

This commit is contained in:
2025-08-31 21:37:35 +02:00
parent 3b038b0fc9
commit 274a75b93d
2 changed files with 7 additions and 2 deletions

View File

@@ -109,9 +109,12 @@ namespace DD2Switcher {
}
private static void LoadSettings() {
Console.WriteLine($"Attempting to load settings from: {settingsPath}");
try {
if (File.Exists(settingsPath)) {
Console.WriteLine("Settings file exists, reading...");
string json = File.ReadAllText(settingsPath);
Console.WriteLine($"Read JSON: {json}");
var settings = JsonSerializer.Deserialize<Settings>(json);
FirstIndex = settings.FirstIndex;
LastIndex = settings.LastIndex;
@@ -119,10 +122,12 @@ namespace DD2Switcher {
Console.WriteLine(
$"Loaded settings: First={FirstIndex}, Last={LastIndex}, Keybind={SequenceKeybind}");
} else {
Console.WriteLine("No settings file found, using defaults");
Console.WriteLine($"Settings file does not exist at: {settingsPath}");
Console.WriteLine("Using default settings");
}
} catch (Exception ex) {
Console.WriteLine($"Error loading settings: {ex.Message}");
Console.WriteLine($"Stack trace: {ex.StackTrace}");
}
}