const
{$IFDEF PAIDVERS}
SDLVersionInfo = 'filesys_r900_full';
IsLightEd = false;
{$ELSE}
SDLVersionInfo = 'filesys_r900_lighted';
IsLightEd = true;
{$ENDIF}
Release = 900;
type
ESDLFileSysError = class(ESDLError); { exception type to indicate errors }
TNumericFeedback = procedure (Sender: TObject; const num: double) of object;
{ procedure type for general numeric feedback events }
TStringFeedback = procedure (Sender: TObject; const msg: string) of object;
{ procedure type for general string feedback events }
TScanFilesFeedback = procedure (CurrentDir: string; Count: longint);
{ procedure type for callback routine of ScanFilesToStrList }
TFileCopyFeedBack = procedure (BytesCopied, SizeOfFile: longint);
{ procedure type for callback routine during filecopy }
TTreeCopyFeedBack = procedure (BytesCopied, SizeOfCurrentFile: longint;
NameOfCurrentFile: string; NrOfFilesCopiedSoFar: longint);
{ procedure type for callback routine during filecopy }
TOnFileSelectEvent = procedure (Sender: TObject; Parameters: string;
var UserAction: TModalResult; var SelectedFileName: string) of object;
TOnFileCheckEvent = procedure (Sender: TObject; FileName: string;
var FileDoesExist: boolean) of object;
TOnOverwriteEvent = procedure (Sender: TObject; FileName: string;
var OverwriteReply: TModalResult) of object;
TUnivSaveDialog = class (TComponent)
private
FParams : string;
FFileName : string;
FOnFileSelect : TOnFileSelectEvent;
FOnFileCheck : TOnFileCheckEvent;
FOnOverwrite : TOnOverwriteEvent;
FUseStdDiag : boolean;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
function Execute: boolean;
property FileName: string read FFileName write FFileName;
function ExtractParamAsInt (ParName: string): integer;
function ExtractParamAsDouble (ParName: string): double;
function ExtractParamAsString (ParName: string): string;
published
property Parameters: string
read FParams write FParams;
property OnFileSelect: TOnFileSelectEvent
read FOnFileSelect write FOnFileSelect;
property OnFileCheck: TOnFileCheckEvent
read FOnFileCheck write FOnFileCheck;
property OnOverwrite: TOnOverwriteEvent
read FOnOverwrite write FOnOverwrite;
property UseStandardDialog: boolean
read FUseStdDiag write FUseStdDiag;
end;
procedure AbortAnyFileCopying;
procedure AppendToTextFile
(FName : string; { file name of text file }
SL : TStringList); overload; { string list to be appended }
procedure AppendToTextFile
(FName, { file name of text file }
Text : string); overload; { string to be appended }
function CountLinesInTextFile
(const FVar : TextFile) { open text file }
: integer; overload; { number of lines in text file }
function CountLinesInTextFile
(const FName : string) { name of text file }
: integer; overload; { number of lines in text file }
function DelDirTree
(path : string) { path to be deleted }
: string; { empty if OK, else path which caused problems }
function DeleteFiles
(FileMask : string) { mask for file selection }
: integer; { number of deleted files }
function DetectStringInFile
(FName : string; { text file to check }
SearchString : string; { string to be searched for }
IgnoreCase : boolean; { TRUE: ignore case during search }
MaxLength : integer) { max. length to search in the file }
: integer; { position of search sString }
function DirEmpty
(DirName : string) { directory name to be checked }
: boolean; { TRUE if directory is empty or non-existing }
function DirExists
(DirName : string) { directory name to be checked }
: Boolean; { TRUE is directory exists }
function DirIsReadOnly
(Dir : string) { directory to be tested }
: boolean; { returns true if dir is readonly }
function DiskIsReadOnly
(Drive : byte) { drive to be tested; 0=A:, 1=B:, 2=C:, ... }
: boolean; { returns TRUE if disk cannot be written }
function EnsureDefaultFileExt
(FName, { filename }
Ext : string) { default file extension }
: string; { filename having guaranteed file extension }
function FileDetect
(FileMask : string) { search name }
: string; { full file name }
function GetFileSize
(FileName : string) { file name to be checked }
: Longint; { file size in bytes }
function InventPassword
(NrChars : integer) { number of characters of password }
: string; { easily readable password }
function IsRootDir
(path : string) { directory to be tested }
: boolean; { returns TRUE is path is root directory }
procedure ScanFilesToStrList
(FileMask : string; { filemask of files to be included }
SubDirs : boolean; { TRUE: recursive search in subdirectories }
SL : TStringList; { string list to be filled }
Feedback : TScanFilesFeedback); { feedback during scan process }
{$IFNDEF DOTNET}
procedure SetAllFilenameCase
(FileMask : string; { filemask of files to process }
Upc : boolean); { upper/lower case }
{$ENDIF}
function StripExtension
(FName : string) { file name }
: string; { name without extension }
function StripPath
(FName : string) { file name }
: string; { name without path }
{$IFDEF MSWINDOWS}
{$IFNDEF DOTNET}
procedure CopyFileTree
(source, { path to root of source tree }
dest : string; { path to destination tree }
RemoveReadOnly : boolean; { TRUE: remove readonly flags }
FeedBack : TTreeCopyFeedback); { feedback during copy process }
{$IFDEF DELPHI}
function DiskFreeExtended
(Drive : Byte) { drive to be tested; 0=A:, 1=B:, 2=C:, ... }
: comp; { number of free bytes }
{$ENDIF}
{$ENDIF}
function DOSToWinPath
(DOSPath : string) { DOS 8.3 path name }
: string; { long Win32 path name }
function IsDOS83Path
(Path : string) { path to be checked }
: boolean; { TRUE if path is DOS compatible }
function ExtractDrive
(Path : string) { path to be checked }
: integer; { drive number }
function GetEnviroVar
(VarName : string) { environment variable }
: string; { value of environment variable }
function GetSystemDir
: string; { returns system directory }
function GetTempDir
: string; { returns temporary directory }
{$IFNDEF DOTNET}
function FileCopyFeedBk
(SourceName, { name of source file }
DestName : string; { destination file name }
RemoveReadOnly : boolean; { TRUE: remove readonly flags }
FeedbackProc : TFileCopyFeedBack) { feedback during copy process }
: integer; { error number }
function GetDiskDriveType
(Drive : byte) { drive to be tested; 0=A:, 1=B:, 2=C:, ... }
: integer; { status of tested drive }
function GetWindowsDir
: string; { returns windows directory }
function MoveToRecycleBin
(FileMask : String) { filemask of files to move to recycle bin }
: integer; { number of moved files }
{$ENDIF}
{$ENDIF}
function ReadHeaderOfASC
(FName : string; { name of ASC file to be read }
var Comment : string; { comment line of header }
var NFeat, { number of features }
NObj : integer; { number of objects }
var ClInf, { TRUE if class info is included }
NamFeat, { TRUE if names are included }
NamObj : boolean) { TRUE if object names are included }
: integer; overload; { error number }
function ReadHeaderOfASC
(InStream : TStream; { stream to be read }
var Comment : string; { comment line of header }
var NFeat, { number of features }
NObj : integer; { number of objects }
var ClInf, { TRUE if class info is included }
NamFeat, { TRUE if names are included }
NamObj : boolean) { TRUE if object names are included }
: integer; overload; { error number }
|