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

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

            fileSystemWatcher.Created += this.HandleFileCreationEvents;
        }
Example #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);
             }
         }
     }
 }
Example #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);
             }
         }
     }
 }
Example #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 });
 }
Example #6
0
 private void SpawnMonitorThread(Monitor monitor)
 {
     var monitorThreadStart = new ParameterizedThreadStart(this.AttatchFileCreationEventListener);
     var monitorThread = new Thread(monitorThreadStart);
     monitorThread.Start(monitor);
 }
Example #7
0
 private void ListenForFileCreationEvents(Monitor monitor)
 {
     var fileSystemWatcher = new FileSystemWatcher(monitor.Source) { EnableRaisingEvents = true };
     fileSystemWatcher.Created += this.HandleFileCreationEvents;
 }
Example #8
0
 public void Start(Monitor monitor, Expression<Action<Monitor, FileStream>> fileCreationHandler)
 {
     this.innerMonitor = monitor;
     this.innerFileCreationEventHandler = fileCreationHandler;
     this.SpawnMonitorThread(monitor);
 }
Example #9
0
 public void Start(Monitor monitor, Expression <Action <Monitor, FileStream> > fileCreationHandler)
 {
     this.innerMonitor = monitor;
     this.innerFileCreationEventHandler = fileCreationHandler;
     this.SpawnMonitorThread(monitor);
 }
Example #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 });
        }