public void Bootstrap(string watchToken) { _watchToken = watchToken; BootStrapper.Configure(new LocalAppDataConfigurationLocator("AutoTest.config.template.VS")); BootStrapper.Container .Register(Component.For <IMessageProxy>() .Forward <IRunFeedbackView>() .Forward <IInformationFeedbackView>() .Forward <IConsumerOf <AbortMessage> >() .ImplementedBy <MessageProxy>().LifeStyle.Singleton); BootStrapper.Services .Locate <IRunResultCache>().EnabledDeltas(); BootStrapper.InitializeCache(_watchToken); BootStrapper.Services .Locate <IMessageProxy>() .SetMessageForwarder(new FeedbackListener(_window)); _configuredCustomOutput = BootStrapper.Services.Locate <IConfiguration>().CustomOutputPath; _watcher = BootStrapper.Services.Locate <IDirectoryWatcher>(); _watcher.Watch(_watchToken); _window.DebugTest += new EventHandler <UI.DebugTestArgs>(_window_DebugTest); _window.SetMessageBus(BootStrapper.Services.Locate <IMessageBus>()); setCustomOutputPath(); _window.Clear(); }
public Worker(IDirectoryWatcher directoryWatcher, ICSVLoader csvLoader, IMessageSender <string, string> messageSender, ILogger <Worker> logger) { _logger = logger; _messageSender = messageSender; _directoryWatcher = directoryWatcher; _csvLoader = csvLoader; }
public MainWindowViewModel( IDirectoryWatcher watcher, INotifier toaster, IDirectoryOpener opener, IFilePathInquirer filePathInquirer) { _watcher = watcher; _toaster = toaster; _opener = opener; _filePathInquirer = filePathInquirer; var path = _filePathInquirer.InqueryDirectoryPath(); _watcher.Path = path; _watcher.Filter = "*.*"; _watcher .Throttle(TimeSpan.FromMilliseconds(100)) .Select(e => new StringBuilder() .Append($"{e.Name} ") .Append(e.ChangeType switch { WatcherChangeTypes.Created => "が作られたよ", WatcherChangeTypes.Deleted => "が削除されたよ", WatcherChangeTypes.Changed => "が変更されたよ", WatcherChangeTypes.Renamed => "が改名されたよ", _ => "になんかあったよ" })
public DirectoryService(IDirectoryWatcher watcher, IMailService <string> mailService, ISetUpManager setUpManager, ILogger logger) { _watcher = watcher ?? throw new ArgumentNullException(nameof(watcher)); _mailService = mailService ?? throw new ArgumentNullException(nameof(mailService)); _setUpManager = setUpManager ?? throw new ArgumentNullException(nameof(setUpManager)); _logger = logger ?? throw new ArgumentNullException(nameof(logger)); }
public void Bootstrap(string watchToken) { _watchToken = watchToken; BootStrapper.Configure(new LocalAppDataConfigurationLocator("AutoTest.config.template.VS")); BootStrapper.Container .Register(Component.For<IMessageProxy>() .Forward<IRunFeedbackView>() .Forward<IInformationFeedbackView>() .Forward<IConsumerOf<AbortMessage>>() .ImplementedBy<MessageProxy>().LifeStyle.Singleton); BootStrapper.Services .Locate<IRunResultCache>().EnabledDeltas(); BootStrapper.InitializeCache(_watchToken); BootStrapper.Services .Locate<IMessageProxy>() .SetMessageForwarder(new FeedbackListener(_window)); _configuredCustomOutput = BootStrapper.Services.Locate<IConfiguration>().CustomOutputPath; _watcher = BootStrapper.Services.Locate<IDirectoryWatcher>(); _watcher.Watch(_watchToken); _window.DebugTest += new EventHandler<UI.DebugTestArgs>(_window_DebugTest); setCustomOutputPath(); _window.Clear(); }
// TO DO: Write "ADD" function public virtual void Add(IDirectoryWatcher dw) { if (dw == null) { throw new ArgumentNullException(nameof(dw)); } var comp = this._dirWatchers.Values.Where(x => x.Directory == dw.Directory); if (comp.Any()) { if ((dw.FileFilter == "*.*" || dw.FileFilter == ".*")) { throw new Exception($"Cannot add a universal filter to an already watched path {dw.Directory}"); } if (comp.Any(p => p.FileFilter == "*.*" || p.FileFilter == ".*")) { throw new Exception($"Cannot add a filter to a path that has a universal filter {dw.Directory}"); } if (comp.Any(p => p.FileFilter.Equals(dw.FileFilter, StringComparison.CurrentCultureIgnoreCase))) { throw new Exception($"Given filter, {dw.FileFilter}, already exists for {dw.Directory}"); } } dw.InitializeWatcher(); this._dirWatchers.Add(dw.Id, dw); }
public EmailDaemon(ISettings settings, IEmailManager emailManager, IDirectoryWatcher directoryWatcher, ILogger logger) { _emailManager = emailManager; _directoryWatcher = directoryWatcher; _logger = logger; _directoryWatcher.AddDirectory(settings.Read <string>(TechnicalConstants.Settings.DropFolder), "*.eml"); }
public App(IDirectoryWatcher watcher, IPipeLineBuilder <IFileInfo> pipeLineBuilder, CriticalAndCancelExceptionHandler criticalAndCancelExceptionHandler, FileDeleteHandler fileDaleteHandler, FileSendHandler fileSendHandler) { _watcher = watcher; _pipeLineBuilder = pipeLineBuilder; _criticalAndCancelExceptionHandler = criticalAndCancelExceptionHandler; _fileDaleteHandler = fileDaleteHandler; _fileSendHandler = fileSendHandler; }
protected override void OnStart(string[] args) { watcher = new DirectoryWatcher( new FileSystemWatcher(ConfigurationManager.AppSettings["sourceFolder"], ConfigurationManager.AppSettings["searchPattern"])); manager = new TaskManager(2); manager.RegisterWatcherEventHandlers(watcher); watcher.Start(); }
public ConsoleApplication(IInformationFeedbackPresenter informationFeedback, IRunFeedbackPresenter runFeedbackPresenter, IDirectoryWatcher watcher, IConfiguration configuration) { _watcher = watcher; _informationFeedback = informationFeedback; _informationFeedback.View = this; _runFeedback = runFeedbackPresenter; _runFeedback.View = this; configuration.ValidateSettings(); }
public MergeService(IPDFGenerator pdfGenerator, IDirectoryWatcher directoryWatcher, IAppDataManager appDataManager) { _pdfGenerator = pdfGenerator; _directoryWatcher = directoryWatcher; _appDataManager = appDataManager; _timer = new Timer(); _timer.Elapsed += OnTimedEvent; _timer.Interval = 5000; }
public DirectoryWatchService( DirectoryWatchConfig config, ICommandArgsService processFileCommandArgsService, IDirectoryWatcher directoryWatcher) { this.Config = config; this.ProcessFileCommandArgsService = processFileCommandArgsService; this.DirectoryWatcher = directoryWatcher; this.DirectoryWatcher.Changed += _fileSystemWatcher_Changed; }
public EmailManager(ISettings settings, IDirectoryWatcher directoryWatcher, IEmailDao emailDao, IEmailMessageParser emailMessageParser, ILogger logger) { _emailDao = emailDao; _emailMessageParser = emailMessageParser; _logger = logger; _directoryWatcher = directoryWatcher; _archiveEmails = settings.Read(TechnicalConstants.Settings.ArchiveProcessed, false); _mailToAddress = settings.Read(TechnicalConstants.Settings.MailTo, String.Empty); _mailFromAddress = settings.Read(TechnicalConstants.Settings.MailFrom, String.Empty); _mailFromDisplayName = settings.Read(TechnicalConstants.Settings.MailFromDisplay, String.Empty); }
public ConsoleApplication(IInformationFeedbackPresenter informationFeedback, IRunFeedbackPresenter runFeedbackPresenter, IDirectoryWatcher watcher, IConfiguration configuration, ILogger logger, ISendNotifications notifier) { _logger = logger; _notifier = notifier; _watcher = watcher; _configuration = configuration; _informationFeedback = informationFeedback; _informationFeedback.View = this; _runFeedback = runFeedbackPresenter; _runFeedback.View = this; }
public Watcher(IMessageSender <BusMessage> sender, IDirectoryWatcher directoryWatcher, IFileManager fileManager, bool?isDelete) { _sender = sender ?? throw new ArgumentNullException(nameof(sender)); _directoryWatcher = directoryWatcher ?? throw new ArgumentNullException(nameof(directoryWatcher)); _fileManager = fileManager ?? throw new ArgumentNullException(nameof(fileManager)); if (isDelete != null) { _shouldDelete = (bool)isDelete; } _directoryWatcher.NewFile += OnNewFile; _directoryWatcher.BeginWatch(); }
public void Dispose() { if (_rootWatcher != null) { _rootWatcher.Dispose(); _rootWatcher = null; } foreach (var watcher in _watchers) { watcher.Value.Dispose(); } _watchers.Clear(); }
public FileExplorerNodeBuilder( IDirectoryWatcher directoryWatcher, string path) { _directoryWatcher = directoryWatcher; Root = new FileExplorerNodeModel { IsRoot = true, IsFile = false, IsDirectory = true, Path = GetPath(path) }; }
public FeedbackForm(IDirectoryWatcher watcher, IConfiguration configuration, IRunFeedbackPresenter runPresenter, IInformationForm informationForm, IRunResultCache runResultCache, IMessageBus bus) { _syncContext = AsyncOperationManager.SynchronizationContext; _toolTipProvider.AutoPopDelay = 30000; _watcher = watcher; _runResultCache = runResultCache; _bus = bus; _runPresenter = runPresenter; _runPresenter.View = this; _informationForm = informationForm; _informationForm.MessageArrived += new EventHandler<MessageRecievedEventArgs>(_informationForm_MessageArrived); InitializeComponent(); configuration.ValidateSettings(); readFormSpacing(); FeedbackForm_Resize(this, new EventArgs()); }
public FeedbackView(Action<RunMessages> onMessage, Action<IRunResultCache> onCacheUpdate, DTE2 application) { _onMessage = onMessage; _onCacheUpdate = onCacheUpdate; _application = application; _presenter = BootStrapper.Services.Locate<IRunFeedbackPresenter>(); _presenter.View = this; _resultsCache = BootStrapper.Services.Locate<IRunResultCache>(); var infoPresenter = BootStrapper.Services.Locate<IInformationFeedbackPresenter>(); _infoWindow = new InformationWindow(infoPresenter); _itemInfoWindow = new FeedbackItemWindow(); _itemInfoWindow.LinkClicked += new EventHandler<StringArgs>(_itemInfoWindow_LinkClicked); BootStrapper.Services.Locate<IConfiguration>().ValidateSettings(); _watcher = BootStrapper.Services.Locate<IDirectoryWatcher>(); if (Connect.WatchFolder != null) _watcher.Watch(Connect.WatchFolder); }
public Facade(DirectoryWatcherConfig config) { _context = new SalesInfoContext(); _locker = new ReaderWriterLockSlim(); _logger = new Logger(); _directoryWatcher = new Classes.DirectoryWatchers.DirectoryWatcher(config["directoryPath"], config["filesFilter"], _logger); _saleUnitOfWork = new SaleUnitOfWork(_context, _locker); _parser = new Parser(); _fileProcessor = new FileProcessor(_saleUnitOfWork, _parser, _logger, _locker, config); _fileProcessor.FileProcessedEvent += OnFileProcessedEvent; }
public FeedbackForm(IDirectoryWatcher watcher, IConfiguration configuration, IRunFeedbackPresenter runPresenter, IInformationForm informationForm, IRunResultCache runResultCache, IMessageBus bus, ISendNotifications notifier) { _syncContext = AsyncOperationManager.SynchronizationContext; _toolTipProvider.AutoPopDelay = 30000; _watcher = watcher; _configuration = configuration; _runResultCache = runResultCache; _bus = bus; _notifier = notifier; _runPresenter = runPresenter; _runPresenter.View = this; _informationForm = informationForm; _informationForm.MessageArrived += new EventHandler <MessageRecievedEventArgs>(_informationForm_MessageArrived); InitializeComponent(); readFormSpacing(); FeedbackForm_Resize(this, new EventArgs()); }
private void ProcessFailedWatchersQueue(object sender, DoWorkEventArgs e) { var worker = sender as BackgroundWorker; IDirectoryWatcher watcher = null; bool enqueueWatcher = true; do { if (this._failedWatchers.TryDequeue(out watcher)) { try { var errArgs = watcher.CheckMonitoredPath().Result; if (errArgs == null) {// no errors detected watcher.InitializeWatcher(); watcher.FileArrivedAsync += HandleFileArrivalAsync; watcher.ErrorAsync += HandleWatcherErrorAsync; watcher.IsEnabled = true; watcher.CheckForExistingFiles(); enqueueWatcher = false; } } catch { // log error } finally { if (enqueueWatcher) { this._failedWatchers.Enqueue(watcher); } else { // log re init } } } } while (watcher != null); }
public FeedbackView(Action <RunMessages> onMessage, Action <IRunResultCache> onCacheUpdate, DTE2 application) { _onMessage = onMessage; _onCacheUpdate = onCacheUpdate; _application = application; _presenter = BootStrapper.Services.Locate <IRunFeedbackPresenter>(); _presenter.View = this; _resultsCache = BootStrapper.Services.Locate <IRunResultCache>(); var infoPresenter = BootStrapper.Services.Locate <IInformationFeedbackPresenter>(); _infoWindow = new InformationWindow(infoPresenter); _itemInfoWindow = new FeedbackItemWindow(); _itemInfoWindow.LinkClicked += new EventHandler <StringArgs>(_itemInfoWindow_LinkClicked); BootStrapper.Services.Locate <IConfiguration>().ValidateSettings(); _watcher = BootStrapper.Services.Locate <IDirectoryWatcher>(); if (Connect.WatchFolder != null) { _watcher.Watch(Connect.WatchFolder); } }
public DirectoryWatcherWithLogging(IDirectoryWatcher inner, string path, ILogger log) { this.inner = inner; this.path = path; this.log = log; }
public DirectoryWatcherWithBatching(IDirectoryWatcher inner, string path, BatchedEvents <FileInfo> batchedEvents) { this.inner = inner; this.path = path; this.batchedEvents = batchedEvents; }
public virtual void RegisterWatcherEventHandlers(IDirectoryWatcher watcher) { watcher.New += RunLogicTask; watcher.Stopping += CancelTasks; }
public EngineControlHandler(IDirectoryWatcher watcher, IMergeRunResults resultCache) { _resultCache = resultCache; _watcher = watcher; }
public DirectoryChangedDelegate(IDirectoryWatcher watcher) { m_watcher = watcher; }
public void Start() { lock (_padlock) { Logger.WriteDebug("Starting autotest.net engine"); BootStrapper.SetBuildConfiguration( new BuildConfiguration((original, @new) => { var detector = new PublicContractChangeDetector(); var changes = detector.GetAllPublicContractChangesBetween(original, @new).ToArray(); var optimisticBuildPossible = changes.Length == 0; if (!optimisticBuildPossible) { Debug.WriteDebug("Optimistic build changes"); foreach (var change in changes) { Debug.WriteDebug("\t" + change.ItemChanged); } } return(optimisticBuildPossible); })); BootStrapper.Configure(_writeLocator); Logger.WriteDebug("Setting up log writer"); Logger.SetWriter(BootStrapper.Services.Locate <IWriteDebugInfo>()); BootStrapper.Container.Register(Component.For <IMessageProxy>() .Forward <IConsumerOf <AssembliesMinimizedMessage> >() .Forward <IConsumerOf <AbortMessage> >() .ImplementedBy <AutoTestMessageProxy>().LifeStyle.Singleton); BootStrapper.Container.Register(Component.For <IPreProcessTestruns>().ImplementedBy <MinimizingPreProcessor>().LifeStyle.Singleton); BootStrapper.Container.Register(Component.For <IPreProcessBuildruns>().ImplementedBy <MinimizingBuildPreProcessor>()); BootStrapper.Container.Register(Component.For <IPreProcessBuildruns>().Forward <IPreProcessTestruns>().ImplementedBy <OnDemanTestrunPreprocessor>().LifeStyle.Singleton); BootStrapper.Container.Register(Component.For <IPreProcessBuildruns>().ImplementedBy <RealtimeChangePreProcessor>().LifeStyle.Singleton); BootStrapper.Container.Register(Component.For <IConsumerOf <FileChangeMessage> >().ImplementedBy <RecursiveRunCauseConsumer>().Named("RecursiveRunConsumer")); BootStrapper.Container.Register(Component.For <ICustomIgnoreProvider>().ImplementedBy <IgnoreProvider>()); Logger.WriteDebug("Setting up message proxy"); _proxy = BootStrapper.Services.Locate <IMessageProxy>(); _proxy.SetMessageForwarder(_server); _proxy.RunStarted += _proxy_RunStarted; _proxy.RunFinished += _proxy_RunFinished; _configuration = BootStrapper.Services.Locate <IConfiguration>(); if (_configuration.DebuggingEnabled) { Logger.EnableWriter(); } Logger.WriteDebug("Checking license"); if (licenseIsInvalid()) { return; } _realtimeChangeTracker = new ChangeTracker(getRealtimeRunPreprocessor(), _configuration, BootStrapper.Services.Locate <IMessageBus>(), BootStrapper.Services.Locate <IGenerateBuildList>()); Logger.WriteDebug("Setting up cache"); var runCache = BootStrapper.Services.Locate <IRunResultCache>(); runCache.EnabledDeltas(); BootStrapper.InitializeCache(_watchPath); _watcher = BootStrapper.Services.Locate <IDirectoryWatcher>(); _watcher.Watch(_watchPath); _configuration.ValidateSettings(); _configuredCustomOutput = _configuration.CustomOutputPath; var disableAll = _configuration.AllSettings("mm-AllDisabled").ToLower().Equals("true"); StartedPaused = _configuration.StartPaused || disableAll; _isPaused = StartedPaused; setCustomOutputPath(); var minimizer = getMinimizer(); minimizer.ProfilerCompletedUpdate += minimizer_ProfilerCompletedUpdate; minimizer.ProfilerInitialized += minimizer_ProfilerInitialized; minimizer.MinimizerInitialized += minimizer_MinimizerInitialized; minimizer.ProfilingStarted += (sender, e) => _server.Send(new ProfiledTestRunStarted()); minimizer.ProfilerLoadError += profiler_profilercorrupted; minimizer.SetManualUpdateProvider(() => _isPaused); initializeAllForPreProcessor(minimizer); if (disableAll) { Pause(); } IsRunning = true; } }
public void Start() { lock (_padlock) { Logger.WriteDebug("Starting autotest.net engine"); BootStrapper.SetBuildConfiguration( new BuildConfiguration((original, @new) => { var detector = new PublicContractChangeDetector(); var changes = detector.GetAllPublicContractChangesBetween(original, @new).ToArray(); var optimisticBuildPossible = changes.Length == 0; if (!optimisticBuildPossible) { Debug.WriteDebug("Optimistic build changes"); foreach (var change in changes) Debug.WriteDebug("\t" + change.ItemChanged); } return optimisticBuildPossible; })); BootStrapper.Configure(_writeLocator); Logger.WriteDebug("Setting up log writer"); Logger.SetWriter(BootStrapper.Services.Locate<IWriteDebugInfo>()); BootStrapper.Container.Register(Component.For<IMessageProxy>() .Forward<IConsumerOf<AssembliesMinimizedMessage>>() .Forward<IConsumerOf<AbortMessage>>() .ImplementedBy<AutoTestMessageProxy>().LifeStyle.Singleton); BootStrapper.Container.Register(Component.For<IPreProcessTestruns>().ImplementedBy<MinimizingPreProcessor>().LifeStyle.Singleton); BootStrapper.Container.Register(Component.For<IPreProcessBuildruns>().ImplementedBy<MinimizingBuildPreProcessor>()); BootStrapper.Container.Register(Component.For<IPreProcessBuildruns>().Forward<IPreProcessTestruns>().ImplementedBy<OnDemanTestrunPreprocessor>().LifeStyle.Singleton); BootStrapper.Container.Register(Component.For<IPreProcessBuildruns>().ImplementedBy<RealtimeChangePreProcessor>().LifeStyle.Singleton); BootStrapper.Container.Register(Component.For<IConsumerOf<FileChangeMessage>>().ImplementedBy<RecursiveRunCauseConsumer>().Named("RecursiveRunConsumer")); BootStrapper.Container.Register(Component.For<ICustomIgnoreProvider>().ImplementedBy<IgnoreProvider>()); Logger.WriteDebug("Setting up message proxy"); _proxy = BootStrapper.Services.Locate<IMessageProxy>(); _proxy.SetMessageForwarder(_server); _proxy.RunStarted += _proxy_RunStarted; _proxy.RunFinished += _proxy_RunFinished; _configuration = BootStrapper.Services.Locate<IConfiguration>(); if (_configuration.DebuggingEnabled) Logger.EnableWriter(); Logger.WriteDebug("Checking license"); if (licenseIsInvalid()) return; _realtimeChangeTracker = new ChangeTracker(getRealtimeRunPreprocessor(), _configuration, BootStrapper.Services.Locate<IMessageBus>(), BootStrapper.Services.Locate<IGenerateBuildList>()); Logger.WriteDebug("Setting up cache"); var runCache = BootStrapper.Services.Locate<IRunResultCache>(); runCache.EnabledDeltas(); BootStrapper.InitializeCache(_watchPath); _watcher = BootStrapper.Services.Locate<IDirectoryWatcher>(); Logger.WriteDebug("Looking for config in "+_localConfigLocation); _watcher.LocalConfigurationIsLocatedAt(_localConfigLocation); _watcher.Watch(_watchPath); _configuration.ValidateSettings(); _configuredCustomOutput = _configuration.CustomOutputPath; var disableAll = _configuration.AllSettings("mm-AllDisabled").ToLower().Equals("true"); StartedPaused = _configuration.StartPaused || disableAll; _isPaused = StartedPaused; setCustomOutputPath(); var minimizer = getMinimizer(); minimizer.ProfilerCompletedUpdate += minimizer_ProfilerCompletedUpdate; minimizer.ProfilerInitialized += minimizer_ProfilerInitialized; minimizer.MinimizerInitialized += minimizer_MinimizerInitialized; minimizer.ProfilingStarted += (sender, e) => _server.Send(new ProfiledTestRunStarted()); minimizer.ProfilerLoadError += profiler_profilercorrupted; minimizer.SetManualUpdateProvider(() => _isPaused); initializeAllForPreProcessor(minimizer); if (disableAll) Pause(); IsRunning = true; } }
public void SetUp() { _directoryWatcher = new DirectoryWatcher(_settings, _fileSystemWatcherFactory, _fileInfoFactory); }
public Worker(IDirectoryWatcher directoryWatcher, IFileSender fileSender, ILogger <Worker> logger) { _logger = logger; _fileSender = fileSender; _directoryWatcher = directoryWatcher; }