filewatcher能實現對某一目錄的檔案(新建,改名,內容修改,刪除)的實時監視
using
system;
using
system.io;
using
system.windows.forms;
namespace
fwpublic
void
updatewatchtext(
string
newtext)
public
void
writelog(
string
logcontent) }
void
watcher_created(
object
sender, filesystemeventargs e)
created
", e.fullpath));
this
.begininvoke(
newupdatewatchtextdelegate(updatewatchtext), "檔案
"+e.fullpath +"
被建立");}
catch
(ioexception)
}void
watcher_changed(
object
sender, filesystemeventargs e) "
, e.fullpath, e.changetype.tostring()));
this
.begininvoke(
newupdatewatchtextdelegate(updatewatchtext), "檔案
"+e.fullpath +"
被修改");}
catch
(ioexception)
}void
watcher_renamed(
object
sender, renamedeventargs e)
to ", e.oldname, e.fullpath));
this
.begininvoke(
newupdatewatchtextdelegate(updatewatchtext), "檔案
"+e.oldname +"
被重新命名為"+
e.fullpath);
}catch
(ioexception)
}void
watcher_deleted(
object
sender, filesystemeventargs e)
deleted
", e.fullpath));
this
.begininvoke(
newupdatewatchtextdelegate(updatewatchtext), "檔案
"+e.fullpath +"
被刪除");}
catch
(ioexception)
}private
void
cmdbrowse_click(
object
sender, eventargs e)
}private
void
cmdwatch_click(
object
sender, eventargs e)
watcher.path
=txtlocation.text;
//監控路徑(資料夾)
watcher.filter ="
*.*";//
如果filter為檔名稱則表示監控該檔案,如果為*.txt則表示要監控指定目錄當中的所有.txt檔案
watcher.notifyfilter
=notifyfilters.lastwrite
|notifyfilters.filename
|notifyfilters.size;
lblwatch.text
=watcher.path +"
監視中";
注:如果目錄下還有子目錄,filewatcher預設情況下並不能監視到子目錄下的檔案,可以通過設定watcher.includesubdirectories = true; 解決這個問題
利用VSTS實現Daily Build
1 新建team build type,project1build 2 建立批處理,c program files microsoft visual studio 8 common7 ide tfsbuild.exe start server1 project1 project1build 利用wi...
利用uploadprogress實現上傳進度條
繼上次運用了uploadprogress上傳擴充套件,自己弄了乙個簡單的例項,實現原理和apc實現的方法基本一樣。1.安裝php uploadprogress.dll擴充套件,重啟apache 2.實現 以下 upload.php php code 複製內容到剪貼簿 id get id target...
Python 利用pymmseq cpp實現分詞
在python這pymmseg cpp 還是十分方便的!環境 ubuntu10.04 python2.65 步驟 2 tar zxf pymmseg cpp tar.gz 解壓後得到pymmseg 目錄 cd pymmseg mmseg cpp python build.py 生成 mmseg.so...