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

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

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