From 274a75b93d08c1b022af2a4fab3fa4c313926563 Mon Sep 17 00:00:00 2001 From: PhatPhuckDave Date: Sun, 31 Aug 2025 21:37:35 +0200 Subject: [PATCH] fix(DD2Switcher): improve settings loading logging and update keybind textbox with current value --- DD2Switcher/Program.cs | 7 ++++++- DD2Switcher/SettingsForm.cs | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/DD2Switcher/Program.cs b/DD2Switcher/Program.cs index 6c37586..813b080 100644 --- a/DD2Switcher/Program.cs +++ b/DD2Switcher/Program.cs @@ -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(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}"); } } diff --git a/DD2Switcher/SettingsForm.cs b/DD2Switcher/SettingsForm.cs index dc6ed57..80bc67c 100644 --- a/DD2Switcher/SettingsForm.cs +++ b/DD2Switcher/SettingsForm.cs @@ -82,7 +82,7 @@ namespace DD2Switcher { this.sequenceKeybindTextBox.Name = "sequenceKeybindTextBox"; this.sequenceKeybindTextBox.Size = new System.Drawing.Size(111, 20); this.sequenceKeybindTextBox.TabIndex = 1; - this.sequenceKeybindTextBox.Text = "F1"; + this.sequenceKeybindTextBox.Text = Program.SequenceKeybind.ToString(); this.sequenceKeybindTextBox.Leave += new System.EventHandler(this.sequenceKeybindTextBox_Leave); // // sequenceKeybindLabel