CmisSync.Lib.Producer.Watcher.NetWatcher.NetWatcher C# (CSharp) Метод

NetWatcher() публичный Метод

Initializes a new instance of the NetWatcher class. Takes the given file system watcher and listens for events and passes them to the given queue
public NetWatcher ( FileSystemWatcher watcher, ISyncEventQueue queue, IMetaDataStorage storage, FileSystemInfoFactory fsFactory = null ) : System
watcher System.IO.FileSystemWatcher File System Watcher.
queue ISyncEventQueue Queue for the occured events.
storage IMetaDataStorage Meta Data Storage to verify, if a deleted object is a file or folder.
fsFactory CmisSync.Lib.Storage.FileSystem.FileSystemInfoFactory File system info factory. If factory is null, the normal file system is used, otherwise the given factory.
Результат System
        public NetWatcher(
            FileSystemWatcher watcher,
            ISyncEventQueue queue,
            IMetaDataStorage storage,
            FileSystemInfoFactory fsFactory = null)
        {
            if (watcher == null) {
                throw new ArgumentNullException("watcher");
            }

            if (string.IsNullOrEmpty(watcher.Path)) {
                throw new ArgumentException("The given watcher must contain a path, where it is listening");
            }

            if (queue == null) {
                throw new ArgumentNullException("queue");
            }

            if (storage == null) {
                throw new ArgumentNullException("storage");
            }

            this.fsFactory = fsFactory ?? new FileSystemInfoFactory();

            this.queue = queue;
            this.storage = storage;

            this.fileSystemWatcher = watcher;
            this.fileSystemWatcher.IncludeSubdirectories = true;
            this.fileSystemWatcher.Filter = "*";
            this.fileSystemWatcher.InternalBufferSize = 4 * 1024 * 16;
            this.fileSystemWatcher.NotifyFilter = NotifyFilters.Size | NotifyFilters.FileName | NotifyFilters.DirectoryName | NotifyFilters.LastWrite | NotifyFilters.Security;

            this.createChangeDeleteHandler = new CreatedChangedDeletedFileSystemEventHandler(this.queue, this.storage, this.fsFactory);
            this.renamedHandler = new RenamedFileSystemEventHandler(this.queue, this.fsFactory);

            this.fileSystemWatcher.Created += new FileSystemEventHandler(this.createChangeDeleteHandler.Handle);
            this.fileSystemWatcher.Deleted += new FileSystemEventHandler(this.createChangeDeleteHandler.Handle);
            this.fileSystemWatcher.Changed += new FileSystemEventHandler(this.createChangeDeleteHandler.Handle);
            this.fileSystemWatcher.Renamed += new RenamedEventHandler(this.renamedHandler.Handle);
        }