⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 umakecd.pas

📁 这个程序的基础框架部分是我在玩OOP玩得走火入魔的时候写的(当然那个时候是有意要走火入魔的了:-)。当时本来是想做一个光盘目录管理之类的东西
💻 PAS
字号:
{*******************************************************}
{                                                       }
{       DirTree Demo                                    }
{                                                       }
{       版权所有 (C) 2005 zbird                         }
{                                                       }
{*******************************************************}

unit uMakeCD;

interface

uses
  Classes, SysUtils, Dialogs, uUtils, uIntAddSubX;

type
  TvxMakeCD = class(TThread)
  private
    FDirPath: string;
    FSubXAdder: IvxAddSubFileFactory;
    procedure MakeDirList(aDirPath: string; aSubXAdder: IvxAddSubFileFactory);
  protected
    procedure Execute; override;
  public
    constructor Create(aDirPath: string; aSubXAdder: IvxAddSubFileFactory);
  end;
  
implementation

{
********************************** TvxMakeCD ***********************************
}
constructor TvxMakeCD.Create(aDirPath: string; aSubXAdder:
        IvxAddSubFileFactory);
begin
  FDirPath := aDirPath;
  FSubXAdder := aSubXAdder;
  inherited Create(False);
end;

procedure TvxMakeCD.Execute;
begin
  MakeDirList(FDirPath, FSubXAdder);
end;

procedure TvxMakeCD.MakeDirList(aDirPath: string; aSubXAdder:
        IvxAddSubFileFactory);
var
  FSearchRec, DSearchRec: TSearchRec;
  FindResult: Integer;
  
  function IsDirNotation(ADirName: string): Boolean;
  begin
    Result := (ADirName = '.') or (ADirName = '..');
  end;
  
begin
  aDirPath := GetDirectoryName(aDirPath);
  FindResult := FindFirst(aDirPath + '*.*', faDirectory, DSearchRec);//找目录
  try
    while FindResult = 0 do
    begin
      if ((DSearchRec.Attr and faDirectory) = faDirectory) and not
        IsDirNotation(DSearchRec.Name) then
      begin
        MakeDirList(aDirPath + DSearchRec.Name,
            aSubXAdder.AddSubDir(aDirPath + DSearchRec.Name, DSearchRec));
      end;
      FindResult := FindNext(DSearchRec);
    end;
  finally
    FindClose(DSearchRec);
  end;
  
  FindResult := FindFirst(aDirPath + '*.*', faAnyFile + faHidden +//找文件
    faSysFile + faReadOnly, FSearchRec);
  try
    while FindResult = 0 do
    begin
      aSubXAdder.AddSubFile(aDirPath + FSearchRec.Name, FSearchRec);
      FindResult := FindNext(FSearchRec);
    end;
  finally
    FindClose(FSearchRec);
  end;
end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -