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

WatchLocationForRestart() static private method

static private WatchLocationForRestart ( string virtualPath, string filter, bool watchSubdirs ) : bool
virtualPath string
filter string
watchSubdirs bool
return bool
                internal static bool WatchLocationForRestart(string virtualPath, string filter, bool watchSubdirs)
		{
			// map the path to the physical one
			string physicalPath = HttpRuntime.AppDomainAppPath;
			physicalPath = Path.Combine(physicalPath, virtualPath);
			bool isDir = Directory.Exists(physicalPath);
			bool isFile = isDir ? false : File.Exists(physicalPath);

			if (isDir || isFile) {
				// create the watcher
				FileSystemEventHandler fseh = new FileSystemEventHandler(OnFileChanged);
				RenamedEventHandler reh = new RenamedEventHandler(OnFileRenamed);
				FileSystemWatcher watcher = CreateWatcher(Path.Combine(physicalPath, filter), fseh, reh);
				if (isDir)
					watcher.IncludeSubdirectories = watchSubdirs;
				
				lock (watchers_lock) {
					watchers.Add(watcher);
				}
				return true;
			} else {
				return false;
			}
	        }

Same methods

HttpApplicationFactory::WatchLocationForRestart ( string filter ) : bool
HttpApplicationFactory::WatchLocationForRestart ( string virtualPath, string filter ) : bool