public void StartWatching(IBrowserRefresher refresher) { _refresher = refresher; _watcher = new FileChangeWatcher(_settings.Root, FileSet.Deep("*.*"), this); _watcher.Start(); }
public void Watch(bool refreshContent, IApplicationObserver observer) { _appDomainWatcher = new AppDomainFileChangeWatcher(observer.RecycleAppDomain); _appDomainWatcher.WatchBinariesAt(BinPath); if (!refreshContent) { return; } var watchedDirectory = PublicAssetFolder.IsNotEmpty() ? PublicAssetFolder : ApplicationPath; var pattern = "*.css;*.js"; ContentMatches.Each(ext => { if (!ext.StartsWith("*")) { ext = "*" + ext; } pattern += ";" + ext; }); var assetFileSet = FileSet.Deep(pattern); _watcher = new FileChangeWatcher(watchedDirectory, assetFileSet, new ContentRefresher(observer)); }
public void StartWatching(string path, ISpecFileObserver observer) { var fullPath = path.ToFullPath(); _watcher = new FileChangeWatcher(fullPath, FileSet.Deep("*.xml"), this); _watcher.Start(); _observer = observer; }
public AssetFileWatcher(IClientConnector connector) { _connector = connector; _watcher = new FileChangeWatcher(FindRootFolder(), FileSet.Shallow("bundle.js"), this); _watcherAssets = new FileChangeWatcher(FindClientFolder().AppendPath("public"), FileSet.Everything(), this); }
// ENDSAMPLE public AssetFileWatcher(IClientConnector connector) { _connector = connector; var path = Directory.GetCurrentDirectory().AppendPath("bundle.js"); _watcher = new FileChangeWatcher(path.ParentDirectory(), FileSet.Shallow("bundle.js"), this); }
// ENDSAMPLE public AssetFileWatcher(IAssetFinder finder, IClientConnector connector) { _connector = connector; var asset = finder.FindAsset("bundle.js"); var path = asset.File.Path; _watcher = new FileChangeWatcher(path.ParentDirectory(), FileSet.Shallow("bundle.js"), this); }
public void Dispose() { if (this.mFileChangeWatcher != null) { this.mFileChangeWatcher.Dispose(); this.mFileChangeWatcher = null; } GC.SuppressFinalize(this); }
public TextEditorDisplayBindingWrapper() { textAreaControl = CreateSharpDevelopTextAreaControl(); textAreaControl.RightToLeft = RightToLeft.No; textAreaControl.Document.DocumentChanged += new DocumentEventHandler(TextAreaChangedEvent); textAreaControl.ActiveTextAreaControl.Caret.CaretModeChanged += new EventHandler(CaretModeChanged); textAreaControl.ActiveTextAreaControl.Enter += new EventHandler(CaretUpdate); textAreaControl.ActiveTextAreaControl.Caret.PositionChanged += CaretUpdate; watcher = new FileChangeWatcher(this); }
public override List <Program> LoadPrograms() { var list = new List <Program>(); if (Directory.Exists(Location)) { GetAppFromDirectory(Location, list); FileChangeWatcher.AddWatch(Location, Suffixes); } return(list); }
public override List <Program> LoadPrograms() { List <Program> list = new List <Program>(); if (Directory.Exists(baseDirectory)) { GetAppFromDirectory(baseDirectory, list); FileChangeWatcher.AddWatch(baseDirectory); } return(list); }
public void SetUp() { _currentDirectory = Path.Combine(TestDirectory, _counter++.ToString()); CreateTestFile(_currentDirectory); _watcher?.Dispose(); _watcher = new FileChangeWatcher(_filePath); _watcher.FileChanged += FileChanged; _args = null; _signal = new SemaphoreSlim(0, 1); }
public TaskRepository(string fileUri) { _fileUri = fileUri; var fileInfo = new FileInfo(_fileUri); _resetEvent = new ManualResetEvent(false); SetJsonConvertSettings(); InitRootTask(); _watcher = new FileChangeWatcher(fileInfo.FullName); _watcher.FileChanged += OnFileChanged; }
public void no_changes() { write("foo.txt", "1"); write("bar.txt", "2"); write("baz.txt", "3"); using (var watcher = new FileChangeWatcher(theDirectory, FileSet.Shallow("*.txt"), this)) { watcher.Start(); Thread.Sleep(2000); LastChanges.ShouldBeNull(); } }
static void MainFormActivated() { if (wasChangedExternally) { if (!showingMessageBox) { if (ProjectService.OpenSolution != null) { // Set wasChangedExternally=false only after the dialog is closed, // so that additional changes to the project while the dialog is open // don't cause it to appear twice. // The MainFormActivated event occurs when the dialog is closed before // we get a change to set wasChangedExternally=false, so we use 'showingMessageBox' // to prevent the dialog from appearing infititely. showingMessageBox = true; int result = MessageService.ShowCustomDialog(MessageService.DefaultMessageBoxTitle, "${res:ICSharpCode.SharpDevelop.Project.SolutionAlteredExternallyMessage}", 0, 1, "${res:ICSharpCode.SharpDevelop.Project.ReloadSolution}", "${res:ICSharpCode.SharpDevelop.Project.KeepOldSolution}", "${res:ICSharpCode.SharpDevelop.Project.CloseSolution}"); showingMessageBox = false; wasChangedExternally = false; if (result == 1) { FileChangeWatcher.AskForReload(); } else { FileChangeWatcher.CancelReloadQueue(); if (result == 0) { SD.ProjectService.OpenSolutionOrProject(ProjectService.OpenSolution.FileName); } else { new CloseSolution().Run(); } } } else { wasChangedExternally = false; } } } else { FileChangeWatcher.AskForReload(); } }
public void see_adds() { write("foo.txt", "1"); write("bar.txt", "2"); write("baz.txt", "3"); using (var watcher = new FileChangeWatcher(theDirectory, FileSet.Shallow("*.txt"), this)) { watcher.Start(); write("new.txt", "I am new"); Wait.Until(() => LastChanges != null).ShouldBeTrue(); LastChanges.Added.Single().RelativePath.ShouldBe("new.txt"); } }
public void WatchBinariesAt(string directory) { Console.WriteLine("Watching for binary and config file changes at " + directory); var fileSet = FileSet.Deep("*.dll;*.config;*.exe"); if (Exclude.IsNotEmpty()) { fileSet.Exclude = Exclude; } _watcher = new FileChangeWatcher(directory, fileSet, this) { ChangeBuffer = 500 }; _watcher.Start(); }
public void see_changes() { write("foo.txt", "1"); write("bar.txt", "2"); write("baz.txt", "3"); using (var watcher = new FileChangeWatcher(theDirectory, FileSet.Shallow("*.txt"), this)) { watcher.Start(); write("foo.txt", "different"); write("baz.txt", "different"); Wait.Until(() => LastChanges != null).ShouldBeTrue(); LastChanges.Changed.OrderBy(x => x.RelativePath).Select(x => x.RelativePath) .ShouldHaveTheSameElementsAs("baz.txt", "foo.txt"); } }
public void see_deletes() { write("foo.txt", "1"); write("bar.txt", "2"); write("baz.txt", "3"); using (var watcher = new FileChangeWatcher(theDirectory, FileSet.Shallow("*.txt"), this)) { watcher.Start(); File.Delete(theDirectory.AppendPath("foo.txt")); File.Delete(theDirectory.AppendPath("baz.txt")); Wait.Until(() => LastChanges != null).ShouldBeTrue(); LastChanges.Deleted.OrderBy(x => x) .ShouldHaveTheSameElementsAs("baz.txt", "foo.txt"); } }
public void Watch(bool refreshContent, IApplicationObserver observer) { _appDomainWatcher = new AppDomainFileChangeWatcher(observer.RecycleAppDomain); _appDomainWatcher.WatchBinariesAt(BinPath); if (!refreshContent) { return; } var watchedDirectory = PublicAssetFolder.IsNotEmpty() ? PublicAssetFolder : ApplicationPath; var pattern = "*.css;*.js"; ContentMatches.Each(ext => { if (!ext.StartsWith("*")) ext = "*" + ext; pattern += ";" + ext; }); var assetFileSet = FileSet.Deep(pattern); _watcher = new FileChangeWatcher(watchedDirectory, assetFileSet, new ContentRefresher(observer)); }
/// <summary> /// Query sub-system for basic properties if this file is supposed to exist in persistence. /// </summary> private void QueryFileProperies() { try { if (IsReal) { FileInfo f = new FileInfo(FileNamePath); IsReadonly = f.IsReadOnly; if (_mFileChangeWatcher != null) { _mFileChangeWatcher.Dispose(); _mFileChangeWatcher = null; } _mFileChangeWatcher = new FileChangeWatcher(this); } } catch (Exception exp) { throw new Exception("Error in QueryFileProperies", exp); } }
/// <summary> /// Query sub-system for basic properties if this file is supposed to exist in persistence. /// </summary> private void QueryFileProperies() { try { if (this.IsReal == true) { System.IO.FileInfo f = new System.IO.FileInfo(this.FileNamePath); this.IsReadonly = f.IsReadOnly; if (this.mFileChangeWatcher != null) { this.mFileChangeWatcher.Dispose(); this.mFileChangeWatcher = null; } this.mFileChangeWatcher = new FileChangeWatcher(this); } } catch (Exception exp) { throw new Exception("Error in QueryFileProperies", exp); } }