Beispiel #1
0
 private void ProcessFile(string fullpath, WriteContainer wcontainer)
 {
     lock (this.Handlers) {
         if (!this.Handlers.ContainsKey(fullpath))
         {
             HandlerBO handler = new HandlerBO(fullpath, wcontainer);
             this.Handlers.Add(fullpath, handler);
             handler.Finished += new EventHandler(handler_Finished);
             handler.StartTimer();
         }
         else
         {
             HandlerBO handler = (HandlerBO)this.Handlers[fullpath];
             handler.ResetTimer();
         }
     }
 }
Beispiel #2
0
        private void Watcher_Event(object sender, FileSystemEventArgs args)
        {
            string         dir        = Path.GetDirectoryName(args.FullPath);
            JobContainer   container  = AcquireJobContainerByDirectory(dir);         // (JobContainer)this.WatcherContainers[dir];
            WriteContainer wcontainer = new WriteContainer(container.SourceDirectory, container);

            try {
                if (WatcherChangeTypes.Deleted != args.ChangeType)
                {
                    this.ProcessFile(args.FullPath, wcontainer);
                }
                //TODO: Give users the option to copy a "delete" action
            }
            catch (Exception ex) {
                IReporter reporter = ReporterManager.GetReporter();
                reporter.AddReport(new ActionReportContainer(ActionType.Notify, ActionReportResult.Noted, ex.ToString()));
            }
        }
Beispiel #3
0
        private void Watcher_Renamed(object sender, RenamedEventArgs args)
        {
            string dir = Path.GetDirectoryName(args.FullPath);

            if (WatcherChangeTypes.Renamed == args.ChangeType)
            {
                //at this point the renamed item could be a directory
                try {
                    JobContainer   container  = AcquireJobContainerByDirectory(dir);                  //(JobContainer)this.WatcherContainers[dir];
                    WriteContainer wcontainer = new WriteContainer(container.SourceDirectory, container);
                    wcontainer.ChangeType  = args.ChangeType;
                    wcontainer.OldFullPath = args.OldFullPath;
                    this.ProcessFile(args.FullPath, wcontainer);
                }
                catch (Exception ex) {
                    IReporter reporter = ReporterManager.GetReporter();
                    reporter.AddReport(new ActionReportContainer(ActionType.Notify, ActionReportResult.Noted, ex.ToString()));
                }
            }
        }
Beispiel #4
0
 public HandlerBO(string fullpath, WriteContainer container)
     : this()
 {
     this.fullpath = fullpath;
     this.wcontainer = container;
 }
Beispiel #5
0
 private void Watcher_Renamed(object sender, RenamedEventArgs args)
 {
     string dir = Path.GetDirectoryName(args.FullPath);
     if (WatcherChangeTypes.Renamed == args.ChangeType) {
         //at this point the renamed item could be a directory
         try {
             JobContainer container = AcquireJobContainerByDirectory(dir); //(JobContainer)this.WatcherContainers[dir];
             WriteContainer wcontainer = new WriteContainer(container.SourceDirectory, container);
             wcontainer.ChangeType = args.ChangeType;
             wcontainer.OldFullPath = args.OldFullPath;
             this.ProcessFile(args.FullPath, wcontainer);
         }
         catch (Exception ex) {
             IReporter reporter = ReporterManager.GetReporter();
             reporter.AddReport(new ActionReportContainer(ActionType.Notify, ActionReportResult.Noted, ex.ToString()));
         }
     }
 }
Beispiel #6
0
 private void Watcher_Event(object sender, FileSystemEventArgs args)
 {
     string dir = Path.GetDirectoryName(args.FullPath);
     JobContainer container = AcquireJobContainerByDirectory(dir);// (JobContainer)this.WatcherContainers[dir];
     WriteContainer wcontainer = new WriteContainer(container.SourceDirectory, container);
     try {
         if (WatcherChangeTypes.Deleted != args.ChangeType) { this.ProcessFile(args.FullPath, wcontainer); }
         //TODO: Give users the option to copy a "delete" action
     }
     catch (Exception ex) {
         IReporter reporter = ReporterManager.GetReporter();
         reporter.AddReport(new ActionReportContainer(ActionType.Notify, ActionReportResult.Noted, ex.ToString()));
     }
 }
Beispiel #7
0
 private void ProcessFile(string fullpath, WriteContainer wcontainer)
 {
     lock (this.Handlers) {
         if (!this.Handlers.ContainsKey(fullpath)) {
             HandlerBO handler = new HandlerBO(fullpath, wcontainer);
             this.Handlers.Add(fullpath, handler);
             handler.Finished += new EventHandler(handler_Finished);
             handler.StartTimer();
         }
         else {
             HandlerBO handler = (HandlerBO)this.Handlers[fullpath];
             handler.ResetTimer();
         }
     }
 }
Beispiel #8
0
 public HandlerBO(string fullpath, WriteContainer container) : this()
 {
     this.fullpath   = fullpath;
     this.wcontainer = container;
 }
Beispiel #9
0
 public ProcessMessageMacro(AccessContainer access, WriteContainer write) : base()
 {
     Access = access;
     Write  = write;
     Source = "generated";
 }