資源簡介
先聲明,我是轉(zhuǎn)載的,原作者要3點積分,花的我好心痛。現(xiàn)在上傳分享給大家,只要大家1分,因為我也需要積分下載別的數(shù)據(jù),所以請大家理解。
原作者的話【自己寫的多線程文件搜索,支持全盤搜索、路徑搜索、支持?jǐn)U展,默認(rèn)搜索指定文件名的所有類型文件,可自行按需要修改。做這個東東是因為最近項目里用到了,網(wǎng)上這方面的代碼不多,特別是多線程的,所以自己就整了一個,希望能幫到需要的朋友們】

代碼片段和文件信息
using?System;
using?System.Collections.Generic;
using?System.ComponentModel;
using?System.Data;
using?System.Drawing;
using?System.Text;
using?System.Windows.Forms;
using?System.IO;
namespace?多線程文件搜索
{
????///?
????///功能描述????:????測試
????///開發(fā)者??????:????Mr?King
????///建立時間????:????2009-2-1?13:28:58
????///修訂描述????:????
????///進(jìn)度描述????:????
????///版本號??????:????1.0
????///最后修改時間:????2009-2-1?16:28:58
????///
????///Function?Description?:????Test
????///Developer????????????????:????
????///Builded?Date:????2009-2-1?13:28:58
????///Revision?Description?:????
????///Progress?Description?:????
????///Version?Number????????:????1.0
????///Last?Modify?Date?????:????2009-2-1?16:28:58
????public?partial?class?Form1?:?Form{
????????#region//字段與屬性
????????string?strFileName;
????????public?string?StrFileName{get?{?return?strFileName;?}set?{?strFileName?=?value;?}}
????????delegate?void?Temp(string?fileName);
????????delegate?void?ShowProgressDelegate(string?fileName?string?filePath?IList?objIlist);
????????IList?objIlist;
????????#endregion
????????#region//初始化與構(gòu)造函數(shù)
????????public?Form1(){
????????????InitializeComponent();
????????}
????????#endregion
????????#region//測試方法
????????///?
????????///?全盤搜索
????????///?
????????public?void?GetFoldersPath(){
????????????if?(GridSearch.InvokeRequired?==?false){}
????????????else{
????????????????objIlist?=?new?List();
????????????????string?retStr?=?null;
????????????????DriveInfo[]?allDrives?=?DriveInfo.GetDrives();//檢索計算機(jī)上的所有邏輯驅(qū)動器的驅(qū)動器名稱
????????????????foreach?(DriveInfo?driPath?in?allDrives){//循環(huán)輸出各分區(qū)的信息
????????????????????FileSeach(driPath.Name);
????????????????}
????????????}
????????}
????????///?
????????///?路徑搜索
????????///?
????????///?
????????public?void?GetFoldersPath(string?root){
????????????if?(GridSearch.InvokeRequired?==?false)?{?}
????????????else?{?objIlist?=?new?List();?FileSeach(root);?}
????????}
????????#endregion
????????#region//私有方法
????????///?
????????///?文件搜索
????????///?
????????///?搜索地址
????????public?void?FileSeach(string?root){
????????????string?strFileNameTemp?=?StrFileName;
????????????Stack?dirs?=?new?Stack(20);
????????????if?(!System.IO.Directory.Exists(root))
????????????????return;
????????????dirs.Push(root);
????????????while?(dirs.Count?>?0){
????????????????string?currentDir?=?dirs.Pop();
????????????????string[]?subDirs;
????????????????try{
????????????????????subDirs?=?System.IO.Directory.GetDirectories(currentDir);
????????????????}
????????????????catch?(UnauthorizedAccessException?e)?{?continue;?}
????????????????catch?(System.IO.DirectoryNotFoundException?e)?{?continue;?}
????????????????Temp?temp=new?Temp(Testll);
????????????????label2.Inv
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????5164??2009-02-11?13:46??多線程文件搜索\Backup\多線程文件搜索\Form1.cs
?????文件???????4412??2009-02-11?13:33??多線程文件搜索\Backup\多線程文件搜索\Form1.Designer.cs
?????文件???????5814??2009-02-11?13:33??多線程文件搜索\Backup\多線程文件搜索\Form1.resx
?????文件????????560??2009-02-11?13:28??多線程文件搜索\Backup\多線程文件搜索\IlsitFileFindModleClass.cs
?????文件????????480??2009-02-11?13:26??多線程文件搜索\Backup\多線程文件搜索\Program.cs
?????文件???????1208??2009-02-11?13:26??多線程文件搜索\Backup\多線程文件搜索\Properties\AssemblyInfo.cs
?????文件???????2898??2009-02-11?13:26??多線程文件搜索\Backup\多線程文件搜索\Properties\Resources.Designer.cs
?????文件???????5612??2009-02-11?13:26??多線程文件搜索\Backup\多線程文件搜索\Properties\Resources.resx
?????文件???????1106??2009-02-11?13:26??多線程文件搜索\Backup\多線程文件搜索\Properties\Settings.Designer.cs
?????文件????????249??2009-02-11?13:26??多線程文件搜索\Backup\多線程文件搜索\Properties\Settings.settings
?????文件???????3303??2009-02-11?13:28??多線程文件搜索\Backup\多線程文件搜索\多線程文件搜索.csproj
?????文件????????952??2009-02-11?13:26??多線程文件搜索\Backup\多線程文件搜索.sln
????..A..H.?????15360??2009-02-11?13:47??多線程文件搜索\Backup\多線程文件搜索.suo
?????文件???????5373??2013-10-02?11:09??多線程文件搜索\UpgradeLog.xm
?????文件???????3348??2013-10-02?11:09??多線程文件搜索\_UpgradeReport_Files\UpgradeReport.css
?????文件??????12505??2010-05-04?01:19??多線程文件搜索\_UpgradeReport_Files\UpgradeReport.xslt
?????文件?????????69??2013-10-02?11:09??多線程文件搜索\_UpgradeReport_Files\UpgradeReport_Minus.gif
?????文件?????????71??2013-10-02?11:09??多線程文件搜索\_UpgradeReport_Files\UpgradeReport_Plus.gif
?????文件????????144??2013-10-02?11:09??多線程文件搜索\多線程文件搜索\app.config
?????文件??????24576??2009-02-11?13:46??多線程文件搜索\多線程文件搜索\bin\Debug\多線程文件搜索.exe
?????文件????????144??2013-10-02?11:09??多線程文件搜索\多線程文件搜索\bin\Debug\多線程文件搜索.exe.config
?????文件??????32256??2009-02-11?13:46??多線程文件搜索\多線程文件搜索\bin\Debug\多線程文件搜索.pdb
?????文件??????11592??2013-10-02?11:09??多線程文件搜索\多線程文件搜索\bin\Debug\多線程文件搜索.vshost.exe
?????文件????????144??2013-10-02?11:09??多線程文件搜索\多線程文件搜索\bin\Debug\多線程文件搜索.vshost.exe.config
?????文件????????490??2010-03-17?22:39??多線程文件搜索\多線程文件搜索\bin\Debug\多線程文件搜索.vshost.exe.manifest
?????文件???????5164??2009-02-11?13:46??多線程文件搜索\多線程文件搜索\Form1.cs
?????文件???????4412??2009-02-11?13:33??多線程文件搜索\多線程文件搜索\Form1.Designer.cs
?????文件???????5814??2009-02-11?13:33??多線程文件搜索\多線程文件搜索\Form1.resx
?????文件????????560??2009-02-11?13:28??多線程文件搜索\多線程文件搜索\IlsitFileFindModleClass.cs
?????文件???????5921??2013-10-02?11:09??多線程文件搜索\多線程文件搜索\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache
............此處省略33個文件信息
評論
共有 條評論