/// <summary> /// Publishes a FileChangedEvent to the internal event stream /// on removal, or on change as long as the file is available. /// </summary> /// <param name="e">The FileChangedEventArgs for this event</param> private void OnChange(FileChangedEventArgs e) { if (e.Type == FileChangedEvent.Removed) { _events.OnNext(e); } else if (!IsFileLocked(e.Path)) { // File is fully ready e.Type = FileChangedEvent.Ready; _events.OnNext(e); } }
/// <summary> /// Called when a change event occurs and the file was /// either removed, or was created/changed and is available for use. /// This publishes an event to the public event stream. /// </summary> /// <param name="e">The FileChangedEventArgs for this event</param> private void PublishEvent(FileChangedEventArgs e) { Events.OnNext(e); }
/// <summary> /// Called when the internal FileSystemWatcher sends an event notification /// </summary> /// <param name="state">The current FileSystemWatcher state</param> /// <param name="e">The FileSystemEventArgs associated with this event</param> private void OnFileSystemEvent(object state, FileSystemEventArgs e) { _events.OnNext(FileChangedEventArgs.Map(e)); }