refactor(Program.cs): remove unused FirstIndex and LastIndex properties from Settings class

This commit is contained in:
2025-08-31 22:24:26 +02:00
parent 12ac48aa76
commit f4524161ac

View File

@@ -11,8 +11,6 @@ using System.Threading.Tasks;
namespace DD2Switcher {
public class Settings {
public int FirstIndex { get; set; } = -1;
public int LastIndex { get; set; } = -1;
public Keys SequenceKeybind { get; set; } = Keys.F1;
}
@@ -90,9 +88,6 @@ namespace DD2Switcher {
string json = File.ReadAllText(settingsPath);
Console.WriteLine($"Read JSON: {json}");
var settings = JsonSerializer.Deserialize<Settings>(json);
// DO NOT load FirstIndex and LastIndex - they should be set by user only
// FirstIndex = settings.FirstIndex;
// LastIndex = settings.LastIndex;
SequenceKeybind = settings.SequenceKeybind;
Console.WriteLine($"Loaded settings: Keybind={SequenceKeybind} (First/Last indices NOT loaded)");
} else {
@@ -107,11 +102,10 @@ namespace DD2Switcher {
private static void SaveSettings() {
try {
var settings =
new Settings { FirstIndex = FirstIndex, LastIndex = LastIndex, SequenceKeybind = SequenceKeybind };
var settings = new Settings { SequenceKeybind = SequenceKeybind };
string json = JsonSerializer.Serialize(settings, new JsonSerializerOptions { WriteIndented = true });
File.WriteAllText(settingsPath, json);
Console.WriteLine($"Saved settings: First={FirstIndex}, Last={LastIndex}, Keybind={SequenceKeybind}");
Console.WriteLine($"Saved settings: Keybind={SequenceKeybind}");
} catch (Exception ex) {
Console.WriteLine($"Error saving settings: {ex.Message}");
}
@@ -222,8 +216,8 @@ namespace DD2Switcher {
private static void HandleWaitingToAdvance() {
// Start timer to advance after N milliseconds
Console.WriteLine($"Starting 20ms timer in WAITING_TO_ADVANCE state");
Task.Delay(20).ContinueWith(_ => {
Console.WriteLine($"Starting 60ms timer in WAITING_TO_ADVANCE state");
Task.Delay(60).ContinueWith(_ => {
if (CurrentState == SequenceState.WAITING_TO_ADVANCE) {
CurrentState = SequenceState.ADVANCE;
Console.WriteLine($"Timer expired, transitioning to ADVANCE state");