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() { private static void LoadSettings() {
Console.WriteLine($"Attempting to load settings from: {settingsPath}");
try { try {
if (File.Exists(settingsPath)) { if (File.Exists(settingsPath)) {
Console.WriteLine("Settings file exists, reading...");
string json = File.ReadAllText(settingsPath); string json = File.ReadAllText(settingsPath);
Console.WriteLine($"Read JSON: {json}");
var settings = JsonSerializer.Deserialize<Settings>(json); var settings = JsonSerializer.Deserialize<Settings>(json);
FirstIndex = settings.FirstIndex; FirstIndex = settings.FirstIndex;
LastIndex = settings.LastIndex; LastIndex = settings.LastIndex;
@@ -119,10 +122,12 @@ namespace DD2Switcher {
Console.WriteLine( Console.WriteLine(
$"Loaded settings: First={FirstIndex}, Last={LastIndex}, Keybind={SequenceKeybind}"); $"Loaded settings: First={FirstIndex}, Last={LastIndex}, Keybind={SequenceKeybind}");
} else { } 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) { } catch (Exception ex) {
Console.WriteLine($"Error loading settings: {ex.Message}"); Console.WriteLine($"Error loading settings: {ex.Message}");
Console.WriteLine($"Stack trace: {ex.StackTrace}");
} }
} }

View File

@@ -82,7 +82,7 @@ namespace DD2Switcher {
this.sequenceKeybindTextBox.Name = "sequenceKeybindTextBox"; this.sequenceKeybindTextBox.Name = "sequenceKeybindTextBox";
this.sequenceKeybindTextBox.Size = new System.Drawing.Size(111, 20); this.sequenceKeybindTextBox.Size = new System.Drawing.Size(111, 20);
this.sequenceKeybindTextBox.TabIndex = 1; this.sequenceKeybindTextBox.TabIndex = 1;
this.sequenceKeybindTextBox.Text = "F1"; this.sequenceKeybindTextBox.Text = Program.SequenceKeybind.ToString();
this.sequenceKeybindTextBox.Leave += new System.EventHandler(this.sequenceKeybindTextBox_Leave); this.sequenceKeybindTextBox.Leave += new System.EventHandler(this.sequenceKeybindTextBox_Leave);
// //
// sequenceKeybindLabel // sequenceKeybindLabel