unit Unit1;<br><br>interface<br><br>uses<br> Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,<br> Dialogs, ComCtrls, bsSkinCtrls, bsSkinShellCtrls, StdCtrls,<br> bsSkinBoxCtrls, Mask, bsSkinTabs, bsDialogs, ImgList, SkinBoxCtrls,<br> SkinCtrls, bsSkinData, BusinessSkinForm, Menus, bsSkinMenus;<br><br>type<br> TForm1 = class(TForm)<br> bsSkinStdLabel1: TbsSkinStdLabel;<br> bsSkinButton1: TbsSkinButton;<br> Edit1: TbsSkinEdit;<br> bsSkinSelectDirectoryDialog1: TbsSkinSelectDirectoryDialog;<br> bsSkinPanel1: TbsSkinPanel;<br> bsSkinGroupBox1: TbsSkinGroupBox;<br> bsSkinPageControl1: TbsSkinPageControl;<br> bsSkinTabSheet1: TbsSkinTabSheet;<br> bsSkinTabSheet2: TbsSkinTabSheet;<br> bsSkinStatusBar1: TbsSkinStatusBar;<br> bsSkinTabSheet3: TbsSkinTabSheet;<br> bsSkinTabSheet4: TbsSkinTabSheet;<br> bsSkinGroupBox2: TbsSkinGroupBox;<br> bsSkinListView1: TbsSkinListView;<br> bsSkinButton2: TbsSkinButton;<br> bsSkinButton3: TbsSkinButton;<br> bsSkinButton4: TbsSkinButton;<br> bsSkinButton5: TbsSkinButton;<br> bsSkinButton6: TbsSkinButton;<br> bsSkinScrollBar1: TbsSkinScrollBar;<br> bsSkinInputDialog1: TbsSkinInputDialog;<br> ImageList1: TImageList;<br> bsSkinListView2: TbsSkinListView;<br> bsSkinScrollBar2: TbsSkinScrollBar;<br> bsSkinButton7: TbsSkinButton;<br> bsSkinButton9: TbsSkinButton;<br> bsSkinButton11: TbsSkinButton;<br> bsSkinStatusPanel1: TbsSkinStatusPanel;<br> bsSkinStatusPanel2: TbsSkinStatusPanel;<br> bsSkinStatusPanel3: TbsSkinStatusPanel;<br> bsSkinStatusPanel4: TbsSkinStatusPanel;<br> bsSkinStatusPanel5: TbsSkinStatusPanel;<br> bsSkinStatusPanel6: TbsSkinStatusPanel;<br> spSkinStdLabel1: TspSkinStdLabel;<br> spSkinEdit1: TspSkinEdit;<br> Animate1: TAnimate;<br> bsSkinButton12: TbsSkinButton;<br> bsSkinPopupMenu1: TbsSkinPopupMenu;<br> N1: TMenuItem;<br> bsBusinessSkinForm1: TbsBusinessSkinForm;<br> bsSkinData1: TbsSkinData;<br> bsSkinButton8: TbsSkinButton;<br> procedure bsSkinButton1Click(Sender: TObject);<br> procedure bsSkinButton2Click(Sender: TObject);<br> procedure bsSkinButton5Click(Sender: TObject);<br> procedure bsSkinButton6Click(Sender: TObject);<br> procedure bsSkinButton4Click(Sender: TObject);<br> procedure bsSkinButton3Click(Sender: TObject);<br> procedure bsSkinButton11Click(Sender: TObject);<br> procedure bsSkinButton7Click(Sender: TObject);<br> procedure bsSkinButton9Click(Sender: TObject);<br> procedure FormCreate(Sender: TObject);<br> procedure bsSkinButton12Click(Sender: TObject);<br> procedure N1Click(Sender: TObject);<br> private<br> { Private declarations }<br> public<br> { Public declarations }<br> end;<br> TSearchFileThread=class(TThread)<br> private<br> MyFileName: string;<br> MyFileSize: Integer ;<br> procedure SearchFile(DirName: string);<br> procedure DeelWithFile;<br> procedure SearchComplete;<br> public<br> MyDirName: string;<br> protected<br> procedure Execute; override;<br> end;<br>var<br> Form1: TForm1;<br> SearchFileThread: TSearchFileThread ;<br> {总共查找了多少文件}<br> SumSearchFile, OverSearchFile, MyFileSize: Integer ;<br> {控制停止开关}<br> Onoff, OnOff1: Boolean ;<br> TempString: TStrings ;<br> ShowFileName, ShowFile: string ;<br>implementation<br><br>{$R *.dfm}<br>procedure TSearchFileThread.DeelWithFile;<br>begin<br> OverSearchFile := OverSearchFile + 1 ;<br> form1.bsSkinStatusPanel4.Caption := IntToStr(OverSearchFile );<br> ShowFile := ExtractFileName(MyFileName );<br> ShowFileName := ExtractFilePath(MyFileName ) + ShowFile;<br> form1.bsSkinListView2.Items.Add.Caption := ShowFileName ;<br> form1.bsSkinListView2.Items.Item[form1.bsSkinListView2.Items.Count - 1].SubItems.Text := Inttostr(MyFileSize div 1024 )+' KB';<br>end;<br><br>procedure TForm1.bsSkinButton12Click(Sender: TObject);<br>var<br> I: Integer;<br>begin<br> for i:=0 to bsSkinListView2.Items.Count-1 do<br> if bsSkinListView2.Items.Item.Checked then<br> DeleteFile(bsSkinListView2.Items.Item.Caption);<br><br>end;<br><br>procedure TSearchFileThread.SearchFile(DirName: String);<br>Var<br> I, index, s: Integer;<br> Found: integer;<br> SearchRec: TSearchRec;<br>begin<br> while onoff = false do<br> begin<br> exit ;<br> end; // while<br> Found := FindFirst(DirName + '*.*',faAnyFile,searchrec);<br> while Found = 0 do<br> begin<br> {如果加下面这行就是只查找目录,不查找文件}<br> //if ((SearchRec.Attr and faDirectory) <> 0) then //directory<br> begin<br> if(SearchRec.Name <> '.')and(SearchRec.Name <> '..') then<br> begin<br> SearchFile(DirName + SearchRec.Name + '/');<br> MyFileName := DirName + SearchRec.Name;<br> {加上判断只显示规定的类型 }<br> SumSearchFile := SumSearchFile + 1 ;<br> form1.bsSkinStatusPanel2.Caption := IntToStr( SumSearchFile ) ;<br> form1.bsSkinStatusPanel6.Caption := MyFileName ;<br> //if (ExtractFileName(Application.ExeName ) - ExtractFileExt(MyFileName) = form1.Edit2.Text then<br> i := 0 ;<br> index := 0 ;<br> if OnOff1 = true then<br> begin<br> TempString := TStringList.Create ;<br> OnOff1 := false ;<br> for I := 0 to form1.bsSkinListView1.Items.Count - 1 do // Iterate<br> begin<br> if form1.bsSkinListView1.Items.Item.Checked then<br> begin<br> TempSTring.Insert(index,form1.bsSkinListView1.Items.Item.Caption ) ;<br> index := index + 1 ;<br> end;<br> end;<br> end;<br> for I := 0 to TempString.Count - 1 do // Iterate<br> begin<br> if '*'+ExtractFileExt(MyFileName) = TempSTring.Strings then<br> begin<br> MyFileSize := searchrec.Size ;<br> Synchronize(DeelWithFile);<br> end;<br> end; // for<br> end;<br> end;<br> Found := FindNext(SearchRec);<br> end;<br> FindClose(SearchRec);<br>end;<br><br>procedure TSearchFileThread.SearchComplete;<br>begin<br> Form1.Animate1.Active := False ;<br> Application.MessageBox( PChar('搜索完毕,共找到 '+inttostr(OverSearchFile )) , PChar('提示'), MB_OK +<br> MB_ICONINFORMATION + MB_TOPMOST);<br> form1.bsSkinStatusPanel6.Caption := '扫描完成......' ;<br>end;<br><br>procedure TSearchFileThread.Execute;<br>begin<br> SearchFile(MyDirName);<br> Synchronize(SearchComplete);<br>end;<br><br>procedure TForm1.bsSkinButton1Click(Sender: TObject);<br>begin<br> if bsSkinSelectDirectoryDialog1.Execute then<br> begin<br> edit1.Text := bsSkinSelectDirectoryDialog1.Directory ;<br> end;<br>end;<br><br>procedure TForm1.bsSkinButton2Click(Sender: TObject);<br>begin<br> bsSkinListView1.Items.Item[2].Checked := true ;<br> bsSkinListView1.Items.Item[3].Checked := true ;<br> bsSkinListView1.Items.Item[4].Checked := true ;<br> bsSkinListView1.Items.Item[5].Checked := true ;<br> bsSkinListView1.Items.Item[8].Checked := true ;<br> bsSkinListView1.Items.Item[9].Checked := true ;<br> bsSkinListView1.Items.Item[10].Checked := true ;<br> bsSkinListView1.Items.Item[11].Checked := true ;<br> bsSkinListView1.Items.Item[12].Checked := true ;<br> bsSkinListView1.Items.Item[18].Checked := true ;<br> bsSkinListView1.Items.Item[27].Checked := true ;<br>end;<br><br>procedure TForm1.bsSkinButton5Click(Sender: TObject);<br>var<br> SumIndexCheck: Integer ;<br>begin<br> for sumIndexCheck := 0 to bsSkinListView1.Items.Count - 1 do // Iterate<br> begin<br> bsSkinListView1.Items.Item[SumIndexCheck].Checked := True ;<br> end; // for<br>end;<br><br>procedure TForm1.bsSkinButton6Click(Sender: TObject);<br>var<br> I: Integer;<br> sumIndexCheck: Integer ;<br>begin<br> for sumIndexCheck := 0 to bsSkinListView1.Items.Count - 1 do // Iterate<br> begin<br> bsSkinListView1.Items.Item[sumIndexCheck].Checked := false ;<br> end; // for<br>end;<br><br>procedure TForm1.bsSkinButton4Click(Sender: TObject);<br>begin<br> bsSkinListView1.DeleteSelected ;<br>end;<br>procedure TForm1.bsSkinButton3Click(Sender: TObject);<br>var<br> InputString: String ;<br> NewString: ttreenode ;<br> i: Integer;<br>begin<br> i := 0;<br> InputString := bsSkinInputDialog1.InputBox('输入信息','输入新增文件类型','*.*') ;<br> if inputString = '' then<br> begin<br> Application.MessageBox('请正确输入文件类型 !!', PChar('提示'), MB_OK +<br> MB_ICONINFORMATION + MB_TOPMOST);<br> exit ;<br> end<br> else<br> begin<br> for i := 0 to bsSkinListView1.Items.Count - 1 do<br> begin<br> if bsSkinListView1.Items.Item.Caption = InputString then<br> begin<br> Application.MessageBox('此类型已经存在 !!', PChar('提示'), MB_OK +<br> MB_ICONINFORMATION + MB_TOPMOST);<br> exit ;<br> end ;<br> end;<br> //bsSkinListView1.Items.Add.Caption := InputString ;<br> bsSkinListView1.Items.Add.Caption := InputString ;<br> InputString := bsSkinInputDialog1.InputBox('输入信息','输入文件类型详细说明','*.*') ;<br> bsSkinListView1.Items.Item[bsSkinListView1.Items.Count -1].SubItems.Text := inputString;<br> //bsSkinListView1.Items.Add.SubItems.Add(inputString);<br> //bsSkinListView1.Columns.Items.Caption := InputString ;<br> end;<br>end;<br><br>procedure TForm1.bsSkinButton11Click(Sender: TObject);<br>begin<br>bsSkinTabSheet3.Visible:=true;<br>end;<br><br>procedure TForm1.bsSkinButton7Click(Sender: TObject);<br>begin<br>try<br> if Edit1.Text[length(Edit1.Text)] <> '/' then<br> Edit1.Text := Edit1.Text + '/'; //必须以 '/' 结尾<br> SearchFileThread := TSearchFileThread.Create(true);<br> SearchFileThread.MyDirName := Edit1.Text;<br> Animate1.Active := True ;<br> bsSkinListView2.Items.Clear ;<br> bsSkinButton9.Enabled := true ;<br> bsSkinButton7.Enabled := False ;<br> SumSearchFile := 0 ;<br> OverSearchFile := 0 ;<br> onoff := true ;<br> OnOff1 := true ;<br> SearchFileThread.Resume;<br> tempstring.Free ;<br>except // wrap up<br> Animate1.Active := false ;<br> form1.bsSkinButton7.Enabled := true ;<br> form1.bsSkinButton9.Enabled := false ;<br>end; // try/finally<br>end;<br>procedure TForm1.bsSkinButton9Click(Sender: TObject);<br>begin<br> Animate1.Active := false ;<br> bsSkinButton7.Enabled := true ;<br> bsSkinButton9.Enabled := False ;<br> onoff := False ;<br> SearchFileThread.Terminate ;<br> Application.MessageBox( PChar('搜索完毕,共找到 '+inttostr(OverSearchFile )) , PChar('提示'), MB_OK +<br> MB_ICONINFORMATION + MB_TOPMOST);<br> SearchFileThread.Free ;<br>end;<br><br>procedure TForm1.FormCreate(Sender: TObject);<br>begin<br> bsSkinData1.LoadFromFile(ExtractFilePath(Application.ExeName)+'/Circuit/skin.ini')<br>end;<br><br><br><br><br><br>procedure TForm1.N1Click(Sender: TObject);<br>begin<br>deletefile(ShowFileName) ;<br>end;<br><br>end.