using System.Collections.Generic; using System.Reflection; namespace RuriLib.ViewModels { /// /// The level of detail of a bot's status. /// public enum BotsDisplayMode { /// No information is displayed. None, /// Every information is displayed. Everything, /// Only information about the end result is displayed. EndResultOnly } /// /// Provides settings for general purposes. /// public class SettingsGeneral : ViewModelBase { private int _waitTime = 100; /// The amount of time the Bot needs to wait after completing a check, in milliseconds. public int WaitTime { get { return _waitTime; } set { _waitTime = value; OnPropertyChanged(); } } private int _requestsTimeout = 10; /// The maximum amount of time to wait for a response from the server for any HTTP request, in seconds. public int RequestTimeout { get { return _requestsTimeout; } set { _requestsTimeout = value; OnPropertyChanged(); } } private int _maxHits = 0; /// The maximum number of hits before the Runner automatically stops (0 for infinite). public int MaxHits { get { return _maxHits; } set { _maxHits = value; OnPropertyChanged(); } } private BotsDisplayMode _botsDisplayMode = BotsDisplayMode.Everything; /// The rate and detail of information to display in the Bot Status column. public BotsDisplayMode BotsDisplayMode { get { return _botsDisplayMode; } set { _botsDisplayMode = value; OnPropertyChanged(); } } private bool _enableBotLog = false; /// Whether to keep the LogBuffer from BotData stored for future use (slows down the Runner). public bool EnableBotLog { get { return _enableBotLog; } set { _enableBotLog = value; OnPropertyChanged(); } } private bool saveLastSource = false; /// Whether to store the last Response Source after a successful check. public bool SaveLastSource { get { return saveLastSource; } set { saveLastSource = value; OnPropertyChanged(); } } private bool webhookEnabled = false; /// Whether to activate the hit webhook that gets called upon a SUCCESS or a custom result. public bool WebhookEnabled { get { return webhookEnabled; } set { webhookEnabled = value; OnPropertyChanged(); } } private string webhookURL = ""; /// The URL where the JSON-encoded hit gets sent. public string WebhookURL { get { return webhookURL; } set { webhookURL = value; OnPropertyChanged(); } } /// /// Resets the properties to their default value. /// public void Reset() { SettingsGeneral def = new SettingsGeneral(); IList props = new List(typeof(SettingsGeneral).GetProperties()); foreach (PropertyInfo prop in props) { prop.SetValue(this, prop.GetValue(def, null)); } } } }