示例#1
0
        private void SpawnMonitorThread(Monitor monitor)
        {
            var monitorThreadStart = new ParameterizedThreadStart(this.AttatchFileCreationEventListener);
            var monitorThread      = new Thread(monitorThreadStart);

            monitorThread.Start(monitor);
        }
示例#2
0
        private void ListenForFileCreationEvents(Monitor monitor)
        {
            var fileSystemWatcher = new FileSystemWatcher(monitor.Source)
            {
                EnableRaisingEvents = true
            };

            fileSystemWatcher.Created += this.HandleFileCreationEvents;
        }
示例#3
0
 private void FileCreationHandler(Monitor monitor, FileStream fileCreated)
 {
     if (this.fileCreationEventHandlers != null && this.fileCreationEventHandlers.Count() > 0) {
         using (fileCreated) {
             foreach (var fileCreationEventHandler in this.fileCreationEventHandlers) {
                 var filename = fileCreated.Name;
                 var memoryStream = new MemoryStream();
                 fileCreated.CopyTo(memoryStream);
                 this.SpawnFileCreationHandlerThread(fileCreationEventHandler, monitor, memoryStream, filename);
             }
         }
     }
 }
示例#4
0
 private void FileCreationHandler(Monitor monitor, FileStream fileCreated)
 {
     if (this.fileCreationEventHandlers != null && this.fileCreationEventHandlers.Count() > 0)
     {
         using (fileCreated) {
             foreach (var fileCreationEventHandler in this.fileCreationEventHandlers)
             {
                 var filename     = fileCreated.Name;
                 var memoryStream = new MemoryStream();
                 fileCreated.CopyTo(memoryStream);
                 this.SpawnFileCreationHandlerThread(fileCreationEventHandler, monitor, memoryStream, filename);
             }
         }
     }
 }
示例#5
0
 private void SpawnFileCreationHandlerThread(IFileCreationEventHandler fileCreationEventHandler, Monitor monitor, Stream fileCreated, string fileName)
 {
     var parameterizedThreadStart = new ParameterizedThreadStart(this.FileCreatedEventHandlerDelegate);
     var thread = new Thread(parameterizedThreadStart);
     thread.Start(new object[] { fileCreationEventHandler, monitor, fileCreated, fileName });
 }
示例#6
0
 private void SpawnMonitorThread(Monitor monitor)
 {
     var monitorThreadStart = new ParameterizedThreadStart(this.AttatchFileCreationEventListener);
     var monitorThread = new Thread(monitorThreadStart);
     monitorThread.Start(monitor);
 }
示例#7
0
 private void ListenForFileCreationEvents(Monitor monitor)
 {
     var fileSystemWatcher = new FileSystemWatcher(monitor.Source) { EnableRaisingEvents = true };
     fileSystemWatcher.Created += this.HandleFileCreationEvents;
 }
示例#8
0
 public void Start(Monitor monitor, Expression<Action<Monitor, FileStream>> fileCreationHandler)
 {
     this.innerMonitor = monitor;
     this.innerFileCreationEventHandler = fileCreationHandler;
     this.SpawnMonitorThread(monitor);
 }
示例#9
0
 public void Start(Monitor monitor, Expression <Action <Monitor, FileStream> > fileCreationHandler)
 {
     this.innerMonitor = monitor;
     this.innerFileCreationEventHandler = fileCreationHandler;
     this.SpawnMonitorThread(monitor);
 }
示例#10
0
        private void SpawnFileCreationHandlerThread(IFileCreationEventHandler fileCreationEventHandler, Monitor monitor, Stream fileCreated, string fileName)
        {
            var parameterizedThreadStart = new ParameterizedThreadStart(this.FileCreatedEventHandlerDelegate);
            var thread = new Thread(parameterizedThreadStart);

            thread.Start(new object[] { fileCreationEventHandler, monitor, fileCreated, fileName });
        }