System.Web.HttpRuntime.SetupOfflineWatch C# (CSharp) Method

SetupOfflineWatch() static private method

static private SetupOfflineWatch ( ) : void
return void
 		static void SetupOfflineWatch ()
		{
			lock (appOfflineLock) {
				FileSystemEventHandler seh = new FileSystemEventHandler (AppOfflineFileChanged);
				RenamedEventHandler reh = new RenamedEventHandler (AppOfflineFileRenamed);

				string app_dir = AppDomainAppPath;
				FileSystemWatcher watcher;
				string offlineFile = null, tmp;
				
				foreach (string f in app_offline_files) {
					watcher = new FileSystemWatcher ();
					watcher.Path = Path.GetDirectoryName (app_dir);
					watcher.Filter = Path.GetFileName (f);
					watcher.NotifyFilter |= NotifyFilters.Size;
					watcher.Deleted += seh;
					watcher.Changed += seh;
					watcher.Created += seh;
					watcher.Renamed += reh;
					watcher.EnableRaisingEvents = true;

					tmp = Path.Combine (app_dir, f);
					if (File.Exists (tmp))
						offlineFile = tmp;
				}

				if (offlineFile != null)
					SetOfflineMode (true, offlineFile);
			}
		}