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