Skip to content

Commit

Permalink
Finally, the settings persistence issue is resolved.
Browse files Browse the repository at this point in the history
  • Loading branch information
tommai78101 committed Jul 29, 2022
1 parent 69b41a9 commit d62551b
Showing 1 changed file with 23 additions and 4 deletions.
27 changes: 23 additions & 4 deletions src/GeneticAlgorithmBot.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,27 @@ public sealed partial class GeneticAlgorithmBot : ToolFormBase, IExternalToolFor
public GeneticAlgorithm populationManager;
#endregion

#region Settings
[ConfigPersist]
public RecentFiles recentFiles {
get => this.Settings.RecentBotFiles;
set => this.Settings.RecentBotFiles = value;
}
[ConfigPersist]
public bool TurboWhenBotting {
get => this.Settings.TurboWhenBotting;
set => this.Settings.TurboWhenBotting = value;
}

[ConfigPersist]
public bool InvisibleEmulation {
get => this.Settings.InvisibleEmulation;
set => this.Settings.InvisibleEmulation = value;
}

public GeneticAlgorithmBotSettings Settings { get; set; }
#endregion

#region Variable Getters and Setters
private IMovie CurrentMovie => MovieSession.Movie;

Expand Down Expand Up @@ -122,9 +143,6 @@ public long Generations {
[RequiredService]
public IMemoryDomains MemoryDomains { get; set; } = default!;

[ConfigPersist]
public GeneticAlgorithmBotSettings Settings { get; set; }

public int FrameLength {
get => (int) FrameLengthNumeric.Value;
set => FrameLengthNumeric.Value = value;
Expand Down Expand Up @@ -1581,10 +1599,11 @@ public BotAttempt(BotAttempt source) {
}
}

// Temporary class to store all of the settings (class member properties) marked with [ConfigPersist] attribute.
public class GeneticAlgorithmBotSettings {
public RecentFiles RecentBotFiles { get; set; } = new RecentFiles();
public bool TurboWhenBotting { get; set; } = true;
public bool InvisibleEmulation { get; set; }
public bool InvisibleEmulation { get; set; } = true;
}

public struct BotData {
Expand Down

0 comments on commit d62551b

Please sign in to comment.