| 1 |
// Borland C++ Builder |
|---|
| 2 |
// Copyright (c) 1995, 2002 by Borland Software Corporation |
|---|
| 3 |
// All rights reserved |
|---|
| 4 |
|
|---|
| 5 |
// (DO NOT EDIT: machine generated header) 'ExtraFileUtils.pas' rev: 6.00 |
|---|
| 6 |
|
|---|
| 7 |
#ifndef ExtraFileUtilsHPP |
|---|
| 8 |
#define ExtraFileUtilsHPP |
|---|
| 9 |
|
|---|
| 10 |
#pragma delphiheader begin |
|---|
| 11 |
#pragma option push -w- |
|---|
| 12 |
#pragma option push -Vx |
|---|
| 13 |
#include <SyncObjs.hpp> // Pascal unit |
|---|
| 14 |
#include <ExtraFunctions.hpp> // Pascal unit |
|---|
| 15 |
#include <StrUtils.hpp> // Pascal unit |
|---|
| 16 |
#include <CodeFromLCL.hpp> // Pascal unit |
|---|
| 17 |
#include <SysUtils.hpp> // Pascal unit |
|---|
| 18 |
#include <Classes.hpp> // Pascal unit |
|---|
| 19 |
#include <Windows.hpp> // Pascal unit |
|---|
| 20 |
#include <SysInit.hpp> // Pascal unit |
|---|
| 21 |
#include <System.hpp> // Pascal unit |
|---|
| 22 |
|
|---|
| 23 |
//-- user supplied ----------------------------------------------------------- |
|---|
| 24 |
|
|---|
| 25 |
namespace Extrafileutils |
|---|
| 26 |
{ |
|---|
| 27 |
//-- type declarations ------------------------------------------------------- |
|---|
| 28 |
class DELPHICLASS IOException; |
|---|
| 29 |
class PASCALIMPLEMENTATION IOException : public Sysutils::Exception |
|---|
| 30 |
{ |
|---|
| 31 |
typedef Sysutils::Exception inherited; |
|---|
| 32 |
|
|---|
| 33 |
public: |
|---|
| 34 |
#pragma option push -w-inl |
|---|
| 35 |
/* Exception.Create */ inline __fastcall IOException(const AnsiString Msg) : Sysutils::Exception(Msg) { } |
|---|
| 36 |
#pragma option pop |
|---|
| 37 |
#pragma option push -w-inl |
|---|
| 38 |
/* Exception.CreateFmt */ inline __fastcall IOException(const AnsiString Msg, const System::TVarRec * Args, const int Args_Size) : Sysutils::Exception(Msg, Args, Args_Size) { } |
|---|
| 39 |
#pragma option pop |
|---|
| 40 |
#pragma option push -w-inl |
|---|
| 41 |
/* Exception.CreateRes */ inline __fastcall IOException(int Ident)/* overload */ : Sysutils::Exception(Ident) { } |
|---|
| 42 |
#pragma option pop |
|---|
| 43 |
#pragma option push -w-inl |
|---|
| 44 |
/* Exception.CreateResFmt */ inline __fastcall IOException(int Ident, const System::TVarRec * Args, const int Args_Size)/* overload */ : Sysutils::Exception(Ident, Args, Args_Size) { } |
|---|
| 45 |
#pragma option pop |
|---|
| 46 |
#pragma option push -w-inl |
|---|
| 47 |
/* Exception.CreateHelp */ inline __fastcall IOException(const AnsiString Msg, int AHelpContext) : Sysutils::Exception(Msg, AHelpContext) { } |
|---|
| 48 |
#pragma option pop |
|---|
| 49 |
#pragma option push -w-inl |
|---|
| 50 |
/* Exception.CreateFmtHelp */ inline __fastcall IOException(const AnsiString Msg, const System::TVarRec * Args, const int Args_Size, int AHelpContext) : Sysutils::Exception(Msg, Args, Args_Size, AHelpContext) { } |
|---|
| 51 |
#pragma option pop |
|---|
| 52 |
#pragma option push -w-inl |
|---|
| 53 |
/* Exception.CreateResHelp */ inline __fastcall IOException(int Ident, int AHelpContext)/* overload */ : Sysutils::Exception(Ident, AHelpContext) { } |
|---|
| 54 |
#pragma option pop |
|---|
| 55 |
#pragma option push -w-inl |
|---|
| 56 |
/* Exception.CreateResFmtHelp */ inline __fastcall IOException(System::PResStringRec ResStringRec, const System::TVarRec * Args, const int Args_Size, int AHelpContext)/* overload */ : Sysutils::Exception(ResStringRec, Args, Args_Size, AHelpContext) { } |
|---|
| 57 |
#pragma option pop |
|---|
| 58 |
|
|---|
| 59 |
public: |
|---|
| 60 |
#pragma option push -w-inl |
|---|
| 61 |
/* TObject.Destroy */ inline __fastcall virtual ~IOException(void) { } |
|---|
| 62 |
#pragma option pop |
|---|
| 63 |
|
|---|
| 64 |
}; |
|---|
| 65 |
|
|---|
| 66 |
|
|---|
| 67 |
typedef void __fastcall (__closure *TCopyFileProgressCallback)(const __int64 current, const __int64 total); |
|---|
| 68 |
|
|---|
| 69 |
typedef void __fastcall (__closure *TCopyFileFinishCallback)(const bool resultt); |
|---|
| 70 |
|
|---|
| 71 |
class DELPHICLASS TCopyFileThread; |
|---|
| 72 |
class PASCALIMPLEMENTATION TCopyFileThread : public Classes::TThread |
|---|
| 73 |
{ |
|---|
| 74 |
typedef Classes::TThread inherited; |
|---|
| 75 |
|
|---|
| 76 |
private: |
|---|
| 77 |
Syncobjs::TCriticalSection* curLock; |
|---|
| 78 |
Syncobjs::TCriticalSection* totalLock; |
|---|
| 79 |
__int64 _current; |
|---|
| 80 |
__int64 _total; |
|---|
| 81 |
|
|---|
| 82 |
protected: |
|---|
| 83 |
virtual void __fastcall Execute(void); |
|---|
| 84 |
__int64 __fastcall GetTotal(void); |
|---|
| 85 |
void __fastcall SetTotal(const __int64 value); |
|---|
| 86 |
__int64 __fastcall GetCurrent(void); |
|---|
| 87 |
void __fastcall SetCurrent(const __int64 value); |
|---|
| 88 |
|
|---|
| 89 |
public: |
|---|
| 90 |
bool CopyResult; |
|---|
| 91 |
TCopyFileProgressCallback CopyFileProgress; |
|---|
| 92 |
TCopyFileFinishCallback CopyFileFinish; |
|---|
| 93 |
AnsiString SourceFilePath; |
|---|
| 94 |
AnsiString DestFilePath; |
|---|
| 95 |
bool OverwriteExists; |
|---|
| 96 |
__property __int64 Total = {read=GetTotal}; |
|---|
| 97 |
__property __int64 Current = {read=GetCurrent}; |
|---|
| 98 |
__fastcall TCopyFileThread(const AnsiString source, const AnsiString dest, const bool overwriteExists, const bool startSuspended); |
|---|
| 99 |
__fastcall virtual ~TCopyFileThread(void); |
|---|
| 100 |
}; |
|---|
| 101 |
|
|---|
| 102 |
|
|---|
| 103 |
class DELPHICLASS TFileSystemElemInfo; |
|---|
| 104 |
class PASCALIMPLEMENTATION TFileSystemElemInfo : public System::TObject |
|---|
| 105 |
{ |
|---|
| 106 |
typedef System::TObject inherited; |
|---|
| 107 |
|
|---|
| 108 |
protected: |
|---|
| 109 |
Sysutils::TSearchRec SearchRec; |
|---|
| 110 |
|
|---|
| 111 |
public: |
|---|
| 112 |
AnsiString FullPath; |
|---|
| 113 |
__fastcall virtual TFileSystemElemInfo(const AnsiString filePath)/* overload */; |
|---|
| 114 |
__fastcall virtual TFileSystemElemInfo(const AnsiString filePath, const Sysutils::TSearchRec &searchInfo)/* overload */; |
|---|
| 115 |
virtual AnsiString __fastcall Name(); |
|---|
| 116 |
virtual int __fastcall Attributes(void); |
|---|
| 117 |
virtual bool __fastcall Exists(void) = 0 ; |
|---|
| 118 |
virtual bool __fastcall CopyTo(const AnsiString path, const bool overwriteExists = false) = 0 ; |
|---|
| 119 |
virtual bool __fastcall Delete(void) = 0 ; |
|---|
| 120 |
public: |
|---|
| 121 |
#pragma option push -w-inl |
|---|
| 122 |
/* TObject.Destroy */ inline __fastcall virtual ~TFileSystemElemInfo(void) { } |
|---|
| 123 |
#pragma option pop |
|---|
| 124 |
|
|---|
| 125 |
}; |
|---|
| 126 |
|
|---|
| 127 |
|
|---|
| 128 |
class DELPHICLASS TFileInfo; |
|---|
| 129 |
class PASCALIMPLEMENTATION TFileInfo : public TFileSystemElemInfo |
|---|
| 130 |
{ |
|---|
| 131 |
typedef TFileSystemElemInfo inherited; |
|---|
| 132 |
|
|---|
| 133 |
public: |
|---|
| 134 |
virtual bool __fastcall CopyTo(const AnsiString path, const bool overwriteExists = false); |
|---|
| 135 |
virtual bool __fastcall Delete(void); |
|---|
| 136 |
virtual bool __fastcall Exists(void); |
|---|
| 137 |
public: |
|---|
| 138 |
#pragma option push -w-inl |
|---|
| 139 |
/* TFileSystemElemInfo.Create */ inline __fastcall virtual TFileInfo(const AnsiString filePath)/* overload */ : TFileSystemElemInfo(filePath) { } |
|---|
| 140 |
#pragma option pop |
|---|
| 141 |
|
|---|
| 142 |
public: |
|---|
| 143 |
#pragma option push -w-inl |
|---|
| 144 |
/* TObject.Destroy */ inline __fastcall virtual ~TFileInfo(void) { } |
|---|
| 145 |
#pragma option pop |
|---|
| 146 |
|
|---|
| 147 |
}; |
|---|
| 148 |
|
|---|
| 149 |
|
|---|
| 150 |
class DELPHICLASS TDirectoryInfo; |
|---|
| 151 |
class DELPHICLASS TFileSystemIterator; |
|---|
| 152 |
class PASCALIMPLEMENTATION TDirectoryInfo : public TFileSystemElemInfo |
|---|
| 153 |
{ |
|---|
| 154 |
typedef TFileSystemElemInfo inherited; |
|---|
| 155 |
|
|---|
| 156 |
public: |
|---|
| 157 |
virtual bool __fastcall CopyTo(const AnsiString path, const bool overwriteExists = false); |
|---|
| 158 |
virtual bool __fastcall Delete(void); |
|---|
| 159 |
virtual bool __fastcall Exists(void); |
|---|
| 160 |
TFileSystemIterator* __fastcall GetFiles(void)/* overload */; |
|---|
| 161 |
TFileSystemIterator* __fastcall GetFiles(const AnsiString mask)/* overload */; |
|---|
| 162 |
TFileSystemIterator* __fastcall GetDirectories(void)/* overload */; |
|---|
| 163 |
TFileSystemIterator* __fastcall GetDirectories(const AnsiString mask)/* overload */; |
|---|
| 164 |
public: |
|---|
| 165 |
#pragma option push -w-inl |
|---|
| 166 |
/* TFileSystemElemInfo.Create */ inline __fastcall virtual TDirectoryInfo(const AnsiString filePath)/* overload */ : TFileSystemElemInfo(filePath) { } |
|---|
| 167 |
#pragma option pop |
|---|
| 168 |
|
|---|
| 169 |
public: |
|---|
| 170 |
#pragma option push -w-inl |
|---|
| 171 |
/* TObject.Destroy */ inline __fastcall virtual ~TDirectoryInfo(void) { } |
|---|
| 172 |
#pragma option pop |
|---|
| 173 |
|
|---|
| 174 |
}; |
|---|
| 175 |
|
|---|
| 176 |
|
|---|
| 177 |
class PASCALIMPLEMENTATION TFileSystemIterator : public System::TObject |
|---|
| 178 |
{ |
|---|
| 179 |
typedef System::TObject inherited; |
|---|
| 180 |
|
|---|
| 181 |
protected: |
|---|
| 182 |
Sysutils::TSearchRec searchInfo; |
|---|
| 183 |
AnsiString folder; |
|---|
| 184 |
|
|---|
| 185 |
public: |
|---|
| 186 |
TFileSystemElemInfo* Current; |
|---|
| 187 |
int SearchAttr; |
|---|
| 188 |
__fastcall TFileSystemIterator(const AnsiString folderPath, const bool onlyFiles)/* overload */; |
|---|
| 189 |
__fastcall TFileSystemIterator(const AnsiString folderPath, const int attrPredicat)/* overload */; |
|---|
| 190 |
__fastcall TFileSystemIterator(const AnsiString folderPath, const AnsiString searchMask, const bool onlyFiles)/* overload */; |
|---|
| 191 |
__fastcall TFileSystemIterator(const AnsiString folderPath, const AnsiString searchMask, const int attrPredicat)/* overload */; |
|---|
| 192 |
__fastcall virtual ~TFileSystemIterator(void); |
|---|
| 193 |
bool __fastcall Next(void); |
|---|
| 194 |
}; |
|---|
| 195 |
|
|---|
| 196 |
|
|---|
| 197 |
class DELPHICLASS TTempFolder; |
|---|
| 198 |
class PASCALIMPLEMENTATION TTempFolder : public System::TObject |
|---|
| 199 |
{ |
|---|
| 200 |
typedef System::TObject inherited; |
|---|
| 201 |
|
|---|
| 202 |
protected: |
|---|
| 203 |
AnsiString path; |
|---|
| 204 |
AnsiString name; |
|---|
| 205 |
|
|---|
| 206 |
public: |
|---|
| 207 |
__fastcall TTempFolder(const AnsiString subName); |
|---|
| 208 |
__fastcall virtual ~TTempFolder(void); |
|---|
| 209 |
AnsiString __fastcall GetTempPath(); |
|---|
| 210 |
}; |
|---|
| 211 |
|
|---|
| 212 |
|
|---|
| 213 |
//-- var, const, procedure --------------------------------------------------- |
|---|
| 214 |
static const int FILECOPY_BUFFER_SIZE = 0x14000; |
|---|
| 215 |
extern PACKAGE int INVALID_SYSFILE_ATTR; |
|---|
| 216 |
static const Shortint resOk = 0x0; |
|---|
| 217 |
static const Shortint resParametersError = 0x1; |
|---|
| 218 |
extern PACKAGE bool __fastcall CopyDirectory(const AnsiString sourceDir, const AnsiString destDir, const bool overwriteExists = false, const bool recursive = true); |
|---|
| 219 |
extern PACKAGE Classes::TThread* __fastcall AsyncCopyFileEx(const AnsiString sourcePath, const AnsiString destPath, const TCopyFileFinishCallback onFinish, const TCopyFileProgressCallback onProgress, const bool overwriteExists = false); |
|---|
| 220 |
extern PACKAGE Classes::TThread* __fastcall AsyncCopyFile(const AnsiString sourcePath, const AnsiString destPath, const TCopyFileFinishCallback onFinish, const bool overwriteExists = false); |
|---|
| 221 |
extern PACKAGE bool __fastcall FileSystemElemExists(const AnsiString path); |
|---|
| 222 |
extern PACKAGE bool __fastcall IsDirectory(const AnsiString path)/* overload */; |
|---|
| 223 |
extern PACKAGE bool __fastcall IsDirectory(const int attr)/* overload */; |
|---|
| 224 |
extern PACKAGE bool __fastcall IsLocalPath(const AnsiString PathStr); |
|---|
| 225 |
extern PACKAGE bool __fastcall IsGlobalPath(const AnsiString PathStr); |
|---|
| 226 |
extern PACKAGE AnsiString __fastcall FixLocalPath(const AnsiString PathStr); |
|---|
| 227 |
extern PACKAGE AnsiString __fastcall ResolveLocalPath(const AnsiString LocalPath, const AnsiString GlobalPath); |
|---|
| 228 |
extern PACKAGE AnsiString __fastcall GetLocalPath(const AnsiString GlobalRoot, const AnsiString FullPath); |
|---|
| 229 |
extern PACKAGE __int64 __fastcall GetFileSize(const AnsiString FileName); |
|---|
| 230 |
extern PACKAGE int __fastcall GetFilesNumber(const AnsiString DirName, const bool Recursive); |
|---|
| 231 |
extern PACKAGE bool __fastcall IsDirsChild(const AnsiString DirName, const AnsiString ChildName); |
|---|
| 232 |
extern PACKAGE AnsiString __fastcall AddExtensionIfAbsent(const AnsiString path, const AnsiString extension); |
|---|
| 233 |
extern PACKAGE AnsiString __fastcall GetFileNameWithoutExtension(const AnsiString path); |
|---|
| 234 |
extern PACKAGE bool __fastcall HasLastSlash(const AnsiString Str); |
|---|
| 235 |
extern PACKAGE AnsiString __fastcall AddLastSlash(const AnsiString str); |
|---|
| 236 |
extern PACKAGE AnsiString __fastcall DelLastSlash(const AnsiString Str); |
|---|
| 237 |
|
|---|
| 238 |
} /* namespace Extrafileutils */ |
|---|
| 239 |
using namespace Extrafileutils; |
|---|
| 240 |
#pragma option pop // -w- |
|---|
| 241 |
#pragma option pop // -Vx |
|---|
| 242 |
|
|---|
| 243 |
#pragma delphiheader end. |
|---|
| 244 |
//-- end unit ---------------------------------------------------------------- |
|---|
| 245 |
#endif // ExtraFileUtils |
|---|