Axiom.FileSystem.Watcher.Watcher C# (CSharp) Méthode

Watcher() public méthode

public Watcher ( string path, bool recurse ) : System
path string
recurse bool
Résultat System
		public Watcher( string path, bool recurse )
		{
#if !( XBOX || XBOX360 || WINDOWS_PHONE || ANDROID || IPHONE)
			// Initialize FileSystemWatcher
			this._monitor = new FileSystemWatcher();
			this._monitor.Path = path;
			// Watch for changes in LastAccess and LastWrite times, and the renaming of files or directories.
			this._monitor.NotifyFilter = NotifyFilters.LastWrite | NotifyFilters.FileName | NotifyFilters.DirectoryName;
			// Watch all files.
			this._monitor.Filter = "*.*";
			this._monitor.IncludeSubdirectories = recurse;

			// Add event handlers.
			this._monitor.Changed += new FileSystemEventHandler( OnChanged );
			this._monitor.Created += new FileSystemEventHandler( OnChanged );
			this._monitor.Deleted += new FileSystemEventHandler( OnChanged );
			this._monitor.Renamed += new RenamedEventHandler( OnRenamed );

			// Begin watching.
			this._monitor.EnableRaisingEvents = true;
#endif
			LogManager.Instance.Write( "File monitor created for {0}.", path );
		}