diff options
author | Juha Vehviläinen <jusu@users.sourceforge.net> | 2003-06-03 20:46:51 +0000 |
---|---|---|
committer | Juha Vehviläinen <jusu@users.sourceforge.net> | 2003-06-03 20:46:51 +0000 |
commit | fe070b42d2ddea9ec14bb186b6cc0b6d11b490c3 (patch) | |
tree | b629021b47c7399b89955176016fe3c37b424741 /Source/Filez.pas | |
parent | ba67bbb2db6327dc0f64eab24bafe5f023ce42ed (diff) |
*** empty log message ***
svn path=/trunk/Framestein/; revision=675
Diffstat (limited to 'Source/Filez.pas')
-rw-r--r-- | Source/Filez.pas | 174 |
1 files changed, 87 insertions, 87 deletions
diff --git a/Source/Filez.pas b/Source/Filez.pas index 1560a77..8d959a4 100644 --- a/Source/Filez.pas +++ b/Source/Filez.pas @@ -1,87 +1,87 @@ -unit Filez; -{$I-} - -interface - -uses - Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs; - -type - THandleFileEvent = procedure( const SearchRec:TSearchRec; - const FullPath: String ) of object; - // fullpath contains filepath+filename - - TScanDir = class(TComponent) - private - { Private declarations } - FOnHandleFile : THandleFileEvent; - protected - { Protected declarations } - public - { Public declarations } - procedure Scan( const Path : String ); - constructor Create( AOwner:TComponent ); override; - published - { Published declarations } - property OnHandleFile : THandleFileEvent read FOnHandleFile write FOnHandleFile; - end; - - function FileSizeByName( const FileName:String ):Longint; - -procedure Register; - -implementation - -uses - Strz; - -function FileSizeByName( const FileName:String ):Longint; -var - F:file of Byte; -begin - Result := 0; - AssignFile(F, FileName); - Reset(F); - if IoResult<>0 then Exit; - Result := FileSize(F); - Close(F); -end; - -constructor TScanDir.Create( AOwner:TComponent ); -begin - inherited Create( AOwner ); - - FOnHandleFile := nil; -end; - -procedure TScanDir.Scan( const Path : String ); -var - SearchRec : TSearchRec; - Result : Integer; - S : String; -begin - if not Assigned(FOnHandleFile) then - Exit; - - S := VerifyBackSlash(Path); - Result := FindFirst( S+'*.*', faAnyFile, SearchRec); - if Result=0 then - repeat - if (SearchRec.Name='.') or (SearchRec.Name='..') then - Continue; - - FOnHandleFile( SearchRec, - S+SearchRec.Name ); - - if SearchRec.Attr and faDirectory>0 then - Scan( S+SearchRec.Name ); - until FindNext(SearchRec)<>0; -end; - -procedure Register; -begin - RegisterComponents('Labrz', [TScanDir]); -end; - -end. - +unit Filez;
+{$I-}
+
+interface
+
+uses
+ Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs;
+
+type
+ THandleFileEvent = procedure( const SearchRec:TSearchRec;
+ const FullPath: String ) of object;
+ // fullpath contains filepath+filename
+
+ TScanDir = class(TComponent)
+ private
+ { Private declarations }
+ FOnHandleFile : THandleFileEvent;
+ protected
+ { Protected declarations }
+ public
+ { Public declarations }
+ procedure Scan( const Path : String );
+ constructor Create( AOwner:TComponent ); override;
+ published
+ { Published declarations }
+ property OnHandleFile : THandleFileEvent read FOnHandleFile write FOnHandleFile;
+ end;
+
+ function FileSizeByName( const FileName:String ):Longint;
+
+procedure Register;
+
+implementation
+
+uses
+ Strz;
+
+function FileSizeByName( const FileName:String ):Longint;
+var
+ F:file of Byte;
+begin
+ Result := 0;
+ AssignFile(F, FileName);
+ Reset(F);
+ if IoResult<>0 then Exit;
+ Result := FileSize(F);
+ Close(F);
+end;
+
+constructor TScanDir.Create( AOwner:TComponent );
+begin
+ inherited Create( AOwner );
+
+ FOnHandleFile := nil;
+end;
+
+procedure TScanDir.Scan( const Path : String );
+var
+ SearchRec : TSearchRec;
+ Result : Integer;
+ S : String;
+begin
+ if not Assigned(FOnHandleFile) then
+ Exit;
+
+ S := VerifyBackSlash(Path);
+ Result := FindFirst( S+'*.*', faAnyFile, SearchRec);
+ if Result=0 then
+ repeat
+ if (SearchRec.Name='.') or (SearchRec.Name='..') then
+ Continue;
+
+ FOnHandleFile( SearchRec,
+ S+SearchRec.Name );
+
+ if SearchRec.Attr and faDirectory>0 then
+ Scan( S+SearchRec.Name );
+ until FindNext(SearchRec)<>0;
+end;
+
+procedure Register;
+begin
+ RegisterComponents('Labrz', [TScanDir]);
+end;
+
+end.
+
|