/// <summary> /// Extension method for adding the Disk watcher to the the WardenConfiguration with the default name of Disk Watcher. /// </summary> /// <param name="builder">Instance of the Warden configuration builder.</param> /// <param name="configuration">Configuration of DiskWatcher.</param> /// <param name="hooks">Optional lambda expression for configuring the watcher hooks.</param> /// <returns>Instance of fluent builder for the WardenConfiguration.</returns> public static WardenConfiguration.Builder AddDiskWatcher( this WardenConfiguration.Builder builder, DiskWatcherConfiguration configuration, Action <WatcherHooksConfiguration.Builder> hooks = null) { builder.AddWatcher(DiskWatcher.Create(configuration), hooks); return(builder); }
/// <summary> /// Extension method for adding the Disk watcher to the the WardenConfiguration. /// </summary> /// <param name="builder">Instance of the Warden configuration builder.</param> /// <param name="name">Name of the DiskWatcher.</param> /// <param name="configuration">Configuration of DiskWatcher.</param> /// <param name="hooks">Optional lambda expression for configuring the watcher hooks.</param> /// <param name="interval">Optional interval (5 seconds by default) after which the next check will be invoked.</param> /// <returns>Instance of fluent builder for the WardenConfiguration.</returns> public static WardenConfiguration.Builder AddDiskWatcher( this WardenConfiguration.Builder builder, string name, DiskWatcherConfiguration configuration, Action <WatcherHooksConfiguration.Builder> hooks = null, TimeSpan?interval = null) { builder.AddWatcher(DiskWatcher.Create(name, configuration), hooks, interval); return(builder); }
protected DiskWatcher(string name, DiskWatcherConfiguration configuration) { if (string.IsNullOrEmpty(name)) { throw new ArgumentException("Watcher name can not be empty."); } if (configuration == null) { throw new ArgumentNullException(nameof(configuration), "Disk Watcher configuration has not been provided."); } Name = name; _configuration = configuration; }
/// <summary> /// Factory method for creating a new instance of DiskWatcher. /// </summary> /// <param name="name">Name of the DiskWatcher.</param> /// <param name="configuration">Configuration of DiskWatcher.</param> /// <returns>Instance of DiskWatcher.</returns> public static DiskWatcher Create(string name, DiskWatcherConfiguration configuration) => new DiskWatcher(name, configuration);
/// <summary> /// Factory method for creating a new instance of DiskWatcher with default name of Disk DiskWatcher. /// </summary> /// <param name="configuration">Configuration of DiskWatcher.</param> /// <returns>Instance of DiskWatcher.</returns> public static DiskWatcher Create(DiskWatcherConfiguration configuration) => Create(DefaultName, configuration);
/// <summary> /// Factory method for creating a new instance of DiskWatcher. /// </summary> /// <param name="name">Name of the DiskWatcher.</param> /// <param name="configuration">Configuration of DiskWatcher.</param> /// <param name="group">Optional name of the group that DiskWatcher belongs to.</param> /// <returns>Instance of DiskWatcher.</returns> public static DiskWatcher Create(string name, DiskWatcherConfiguration configuration, string group = null) => new DiskWatcher(name, configuration, group);
/// <summary> /// Factory method for creating a new instance of DiskWatcher with default name of Disk DiskWatcher. /// </summary> /// <param name="configuration">Configuration of DiskWatcher.</param> /// <param name="group">Optional name of the group that DiskWatcher belongs to.</param> /// <returns>Instance of DiskWatcher.</returns> public static DiskWatcher Create(DiskWatcherConfiguration configuration, string group = null) => Create(DefaultName, configuration, group);
protected Configurator(DiskWatcherConfiguration configuration) : base(configuration) { }
protected Configurator() { Configuration = new DiskWatcherConfiguration(); }
public Default(DiskWatcherConfiguration configuration) : base(configuration) { SetInstance(this); }