/// <summary> /// Notifies all subscriptions about the given change. /// </summary> /// <param name="changeType"></param> /// <param name="path"></param> private void RaiseSingleEvent(string path, FileWatchChangeType changeType) { var report = new Queue <FileWatchEvent>(1); report.Enqueue(new FileWatchEvent(changeType, path)); RaiseEvents(report); }
protected static MediaSourceChangeType TranslateChangeType(FileWatchChangeType changeType) { switch (changeType) { case FileWatchChangeType.Created: return(MediaSourceChangeType.Created); case FileWatchChangeType.Deleted: return(MediaSourceChangeType.Deleted); case FileWatchChangeType.Changed: return(MediaSourceChangeType.Changed); case FileWatchChangeType.Renamed: return(MediaSourceChangeType.Renamed); case FileWatchChangeType.All: return(MediaSourceChangeType.All); case FileWatchChangeType.DirectoryDeleted: return(MediaSourceChangeType.DirectoryDeleted); default: return(MediaSourceChangeType.None); } }
/// <summary> /// Initializes a new instance of the FileWatchEvent class. /// </summary> /// <param name="type">Type of event.</param> /// <param name="path">Affected path.</param> /// <param name="oldPath">The old path to the affected path.</param> public FileWatchEvent(FileWatchChangeType type, string path, string oldPath) { _eventMoment = DateTime.Now; _path = path; _oldPath = oldPath; _type = type; _fileSize = GetFileSize(_path); }
/// <summary> /// Initializes a new instance of the FileWatchEvent class. /// Rename events are not allowed with this constructor. /// </summary> /// <param name="type">Type of event.</param> /// <param name="path">Affected path.</param> public FileWatchEvent(FileWatchChangeType type, string path) { _eventMoment = DateTime.Now; if (type == FileWatchChangeType.Renamed) { throw new ArgumentException("The specified type indicates a Rename event. Rename events need the extra parameter \"oldPath\"."); } _path = path; _oldPath = path; _type = type; _fileSize = GetFileSize(_path); }
/// <summary> /// Initializes a new instance of the FileWatchEvent class /// based on the specified FileSystemEventArgs. /// </summary> /// <param name="args">FileSystemEventArgs to base the current FileWatchEvent on.</param> public FileWatchEvent(FileSystemEventArgs args) { _eventMoment = DateTime.Now; _path = args.FullPath; if (args is RenamedEventArgs) { _oldPath = ((RenamedEventArgs)args).OldFullPath; } else { _oldPath = _path; } switch (args.ChangeType) { case WatcherChangeTypes.All: _type = FileWatchChangeType.All; break; case WatcherChangeTypes.Changed: _type = FileWatchChangeType.Changed; break; case WatcherChangeTypes.Created: _type = FileWatchChangeType.Created; break; case WatcherChangeTypes.Deleted: _type = FileWatchChangeType.Deleted; break; case WatcherChangeTypes.Renamed: _type = FileWatchChangeType.Renamed; break; } _fileSize = GetFileSize(_path); }
public FileWatchEventArgs(FileWatchChangeType changeType, string path, string oldPath) { _path = path; _oldPath = oldPath; _changeType = changeType; }
public FileWatchEventArgs(FileWatchChangeType changeType, string path) : this(changeType, path, path) { }
/// <summary> /// Returns whether events may be raised for the given <see cref="FileWatchChangeType"/>. /// </summary> /// <param name="changeType"><see cref="FileWatchChangeType"/> to test.</param> /// <returns></returns> private bool CompliesToChangeType(FileWatchChangeType changeType) { return(_changeTypes.Count == 0 || (_changeTypes.Contains(changeType))); }
/// <summary> /// Notifies all subscriptions about the given change. /// </summary> /// <param name="changeType"></param> /// <param name="path"></param> private void RaiseSingleEvent(string path, FileWatchChangeType changeType) { var report = new Queue<FileWatchEvent>(1); report.Enqueue(new FileWatchEvent(changeType, path)); RaiseEvents(report); }
public FileWatchEventArgs(FileWatchChangeType changeType, string path, string oldPath) { _path = path; _oldPath = oldPath; _changeType = changeType; }
/// <summary> /// Returns whether events may be raised for the given <see cref="FileWatchChangeType"/>. /// </summary> /// <param name="changeType"><see cref="FileWatchChangeType"/> to test.</param> /// <returns></returns> private bool CompliesToChangeType(FileWatchChangeType changeType) { return _changeTypes.Count == 0 || (_changeTypes.Contains(changeType)); }
public FileWatchEventArgs(FileWatchChangeType changeType, string path) : this(changeType, path, path) { }
/// <summary> /// Initializes a new instance of the FileWatchEvent class. /// </summary> /// <param name="type">Type of event.</param> /// <param name="path">Affected path.</param> /// <param name="oldPath">The old path to the affected path.</param> public FileWatchEvent(FileWatchChangeType type, string path, string oldPath) { _eventMoment = DateTime.Now; _path = path; _oldPath = oldPath; _type = type; _fileSize = GetFileSize(_path); }
/// <summary> /// Initializes a new instance of the FileWatchEvent class. /// Rename events are not allowed with this constructor. /// </summary> /// <param name="type">Type of event.</param> /// <param name="path">Affected path.</param> public FileWatchEvent(FileWatchChangeType type, string path) { _eventMoment = DateTime.Now; if (type == FileWatchChangeType.Renamed) throw new ArgumentException("The specified type indicates a Rename event. Rename events need the extra parameter \"oldPath\"."); _path = path; _oldPath = path; _type = type; _fileSize = GetFileSize(_path); }
/// <summary> /// Initializes a new instance of the FileWatchEvent class /// based on the specified FileSystemEventArgs. /// </summary> /// <param name="args">FileSystemEventArgs to base the current FileWatchEvent on.</param> public FileWatchEvent(FileSystemEventArgs args) { _eventMoment = DateTime.Now; _path = args.FullPath; if (args is RenamedEventArgs) _oldPath = ((RenamedEventArgs)args).OldFullPath; else _oldPath = _path; switch (args.ChangeType) { case WatcherChangeTypes.All: _type = FileWatchChangeType.All; break; case WatcherChangeTypes.Changed: _type = FileWatchChangeType.Changed; break; case WatcherChangeTypes.Created: _type = FileWatchChangeType.Created; break; case WatcherChangeTypes.Deleted: _type = FileWatchChangeType.Deleted; break; case WatcherChangeTypes.Renamed: _type = FileWatchChangeType.Renamed; break; } _fileSize = GetFileSize(_path); }
protected static MediaSourceChangeType TranslateChangeType(FileWatchChangeType changeType) { switch (changeType) { case FileWatchChangeType.Created: return MediaSourceChangeType.Created; case FileWatchChangeType.Deleted: return MediaSourceChangeType.Deleted; case FileWatchChangeType.Changed: return MediaSourceChangeType.Changed; case FileWatchChangeType.Renamed: return MediaSourceChangeType.Renamed; case FileWatchChangeType.All: return MediaSourceChangeType.All; case FileWatchChangeType.DirectoryDeleted: return MediaSourceChangeType.DirectoryDeleted; default: return MediaSourceChangeType.None; } }