System.Web.HttpApplicationFactory.CreateWatcher C# (CSharp) Method

CreateWatcher() static private method

static private CreateWatcher ( string file, FileSystemEventHandler hnd, RenamedEventHandler reh ) : FileSystemWatcher
file string
hnd FileSystemEventHandler
reh RenamedEventHandler
return System.IO.FileSystemWatcher
		static FileSystemWatcher CreateWatcher (string file, FileSystemEventHandler hnd, RenamedEventHandler reh)
		{
			FileSystemWatcher watcher = new FileSystemWatcher ();

			watcher.Path = Path.GetFullPath (Path.GetDirectoryName (file));
			watcher.Filter = Path.GetFileName (file);
			
			// This will enable the Modify flag for Linux/inotify
			watcher.NotifyFilter |= NotifyFilters.Size;
			
			watcher.Changed += hnd;
			watcher.Created += hnd;
			watcher.Deleted += hnd;
			watcher.Renamed += reh;

			watcher.EnableRaisingEvents = true;

			return watcher;
		}