Ejemplo n.º 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();
         }
     }
 }
Ejemplo n.º 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()));
            }
        }
Ejemplo n.º 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()));
                }
            }
        }
Ejemplo n.º 4
0
 public HandlerBO(string fullpath, WriteContainer container)
     : this()
 {
     this.fullpath = fullpath;
     this.wcontainer = container;
 }
Ejemplo n.º 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()));
         }
     }
 }
Ejemplo n.º 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()));
     }
 }
Ejemplo n.º 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();
         }
     }
 }
Ejemplo n.º 8
0
 public HandlerBO(string fullpath, WriteContainer container) : this()
 {
     this.fullpath   = fullpath;
     this.wcontainer = container;
 }
Ejemplo n.º 9
0
 public ProcessMessageMacro(AccessContainer access, WriteContainer write) : base()
 {
     Access = access;
     Write  = write;
     Source = "generated";
 }