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