功能:实现对文件夹得监控,并记录对该文件下所有文件的各种操作.
fswWatcher.NotifyFilter = NotifyFilters.LastWrite|NotifyFilters.FileName | NotifyFilters.Size | NotifyFilters.DirectoryName;
fswWatcher.Filter = "*.*";
//获取或设置一个值,该值指示是否监视指定路径中的子目录。
fswWatcher.IncludeSubdirectories = true;
fswWatcher.InternalBufferSize=16384;
#region 6.3 触发的事件 //根目录文件創建時事件
fswWatcher.Created += new FileSystemEventHandler(fswWatcher_Created);
//根目录文件刪除時事件
fswWatcher.Deleted += new FileSystemEventHandler(fswWatcher_Deleted);
//文件或目錄重命名時事件
fswWatcher.Renamed += new RenamedEventHandler(fswWatcher_Renamed);
//文件或目錄變更時事件
fswWatcher.Changed += new FileSystemEventHandler(fswWatcher_Changed);
//监测程序缓存发生溢出进
fswWatcher.Error += new ErrorEventHandler(fswWatcher_Error);
触发了多个事件,如何使用线程对该事件进行处理,将触发的事件进行排序.
请高手指点,谢谢
fswWatcher.NotifyFilter = NotifyFilters.LastWrite|NotifyFilters.FileName | NotifyFilters.Size | NotifyFilters.DirectoryName;
fswWatcher.Filter = "*.*";
//获取或设置一个值,该值指示是否监视指定路径中的子目录。
fswWatcher.IncludeSubdirectories = true;
fswWatcher.InternalBufferSize=16384;
#region 6.3 触发的事件 //根目录文件創建時事件
fswWatcher.Created += new FileSystemEventHandler(fswWatcher_Created);
//根目录文件刪除時事件
fswWatcher.Deleted += new FileSystemEventHandler(fswWatcher_Deleted);
//文件或目錄重命名時事件
fswWatcher.Renamed += new RenamedEventHandler(fswWatcher_Renamed);
//文件或目錄變更時事件
fswWatcher.Changed += new FileSystemEventHandler(fswWatcher_Changed);
//监测程序缓存发生溢出进
fswWatcher.Error += new ErrorEventHandler(fswWatcher_Error);
触发了多个事件,如何使用线程对该事件进行处理,将触发的事件进行排序.
请高手指点,谢谢
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货