Session is now saved on config or wordlist selection too

This commit is contained in:
ruri
2020-03-23 03:59:37 +01:00
parent dbc8d34c95
commit 9c241e6003
2 changed files with 33 additions and 21 deletions
+26 -21
View File
@@ -35,6 +35,7 @@ namespace RuriLib.Runner
/// <summary>
/// Main class that handles all the multi-threaded checking of a Wordlist given a Config.
/// </summary>
// TODO: Split this into partial classes
public class RunnerViewModel : ViewModelBase, IRunnerMessaging, IRunner
{
#region Constructor
@@ -349,6 +350,7 @@ namespace RuriLib.Runner
Config = config;
if (setRecommended) BotsAmount = Clamp(config.Settings.SuggestedBots, 1, 200);
OnPropertyChanged("ConfigName");
RaiseConfigChanged();
}
/// <summary>
@@ -360,6 +362,7 @@ namespace RuriLib.Runner
Wordlist = wordlist;
OnPropertyChanged("WordlistName");
OnPropertyChanged("WordlistSize");
RaiseWordlistChanged();
}
#endregion
@@ -1052,41 +1055,33 @@ namespace RuriLib.Runner
#endregion
#region Events
/// <summary>
/// Fired when a new message needs to be logged.
/// </summary>
/// <summary>Fired when a new message needs to be logged.</summary>
public event Action<IRunnerMessaging, LogLevel, string, bool, int> MessageArrived;
/// <summary>
/// Fired when the Master Worker status changed.
/// </summary>
/// <summary>Fired when the Master Worker status changed.</summary>
public event Action<IRunnerMessaging> WorkerStatusChanged;
/// <summary>
/// Fired when a Hit was found.
/// </summary>
/// <summary>Fired when a Hit was found.</summary>
public event Action<IRunnerMessaging, Hit> FoundHit;
/// <summary>
/// Fired when proxies need to be reloaded.
/// </summary>
/// <summary>Fired when proxies need to be reloaded.</summary>
public event Action<IRunnerMessaging> ReloadProxies;
/// <summary>
/// Fired when an Action could change the UI and needs to be dispatched to another thread (usually it's handled by the UI thread).
/// </summary>
/// <summary>/// Fired when an Action could change the UI and needs to be dispatched to another thread (usually it's handled by the UI thread).</summary>
public event Action<IRunnerMessaging, Action> DispatchAction;
/// <summary>
/// Fired when the progress record needs to be saved to the Database.
/// </summary>
/// <summary>Fired when the progress record needs to be saved to the Database.</summary>
public event Action<IRunnerMessaging> SaveProgress;
/// <summary>
/// Fired when custom inputs from the user are required.
/// </summary>
/// <summary>Fired when custom inputs from the user are required.</summary>
public event Action<IRunnerMessaging> AskCustomInputs;
/// <summary>Fired when the currently selected Config changed.</summary>
public event Action<IRunnerMessaging> ConfigChanged;
/// <summary>Fired when the currently selected Wordlist changed.</summary>
public event Action<IRunnerMessaging> WordlistChanged;
private void RaiseMessageArrived(LogLevel level, string message, bool prompt = false, int timeout = 0)
{
MessageArrived?.Invoke(this, level, message, prompt, timeout);
@@ -1122,6 +1117,16 @@ namespace RuriLib.Runner
{
AskCustomInputs?.Invoke(this);
}
private void RaiseConfigChanged()
{
ConfigChanged?.Invoke(this);
}
private void RaiseWordlistChanged()
{
WordlistChanged?.Invoke(this);
}
#endregion
#region Proxy Management Methods