ADD: Some functions in WFX plugin support

This commit is contained in:
Alexander Koblov 2007-06-29 20:34:45 +00:00
commit cb6a306ee4
9 changed files with 114 additions and 54 deletions

View file

@ -1,3 +1,4 @@
$$$*** This is unit history file ***$$$ ###encoding="UTF-8"###
22.06.2007 Добавил функции VFSCopyOutEx, VFSCopyInEx которые выполняют
копирование в потоке
копирование в потоке
30.06.2007 Добавил параметр Flags к функциям: VFSCopyOut, VFSCopyOutEx

5
doc/uwfxmodule.txt Normal file
View file

@ -0,0 +1,5 @@
$$$*** This is unit history file ***$$$ ###encoding="UTF-8"###
28.06.2007 Был создан данный модуль, добавлены основные функции:
инициализация, открытие, получение списка файлов.
Плагин можно вызвать двойным щелчком по *.wfx файлу.
30.06.2007 Добавил функции создания каталога, копирования, удаления файлов.

View file

@ -1,7 +1,7 @@
inherited frmMain: TfrmMain
Left = 253
Left = 240
Height = 336
Top = 169
Top = 97
Width = 525
HorzScrollBar.Page = 524
VertScrollBar.Page = 315

View file

@ -724,6 +724,16 @@ begin
sPath:=ActiveDir;
if not ShowMkDir(sPath) then Exit;
if (sPath='') then Exit;
{ Create directory in VFS }
if ActiveFrame.pnlFile.PanelMode in [pmArchive, pmVFS] then
begin
DebugLN('+++ Create directory in VFS +++');
ActiveFrame.pnlFile.VFS.VFSmodule.VFSMkDir(ActiveDir + sPath);
ActiveFrame.RefreshPanel;
end
else
{ /Create directory in VFS }
if (DirectoryExists(ActiveDir+sPath)) then
begin
@ -1850,11 +1860,11 @@ begin
(* Check active panel *)
try
(*Extract files from archive*)
(*Copy files from VFS*)
if ActiveFrame.pnlFile.PanelMode in [pmArchive, pmVFS] then
begin
DebugLN('+++ Copy files from VFS +++');
ActiveFrame.pnlFile.VFS.VFSmodule.VFSCopyOutEx(fl, sDestPath);
ActiveFrame.pnlFile.VFS.VFSmodule.VFSCopyOutEx(fl, sDestPath, 0);
NotActiveFrame.RefreshPanel;
end
else

View file

@ -150,6 +150,9 @@ const FS_BITMAP_NONE=0;
FS_BITMAP_CACHE=256;
const
MAXDWORD = DWORD($FFFFFFFF);
type
TFileTime = record
dwLowDateTime: DWORD;
@ -157,6 +160,39 @@ type
end;
PFileTime = ^TFileTime;
type
TInt64Rec = packed record
case Boolean of
True : (Value : Int64);
False : (Low,High : DWORD);
end;
type
{$ifdef UNICODE}
TBYTE = word;
TCHAR = widechar;
BCHAR = word;
{$else}
TBYTE = byte;
TCHAR = char;
BCHAR = BYTE;
{$endif}
WIN32_FIND_DATA = record
dwFileAttributes : DWORD;
ftCreationTime : TFILETIME;
ftLastAccessTime : TFILETIME;
ftLastWriteTime : TFILETIME;
nFileSizeHigh : DWORD;
nFileSizeLow : DWORD;
dwReserved0 : DWORD;
dwReserved1 : DWORD;
cFileName : array[0..(MAX_PATH)-1] of TCHAR;
cAlternateFileName : array[0..13] of TCHAR;
end;
tWIN32FINDDATA = WIN32_FIND_DATA;
HICON = THANDLE;
type
tRemoteInfo=record

View file

@ -44,9 +44,9 @@ Type
function VFSMkDir(const sDirName:String ):Boolean;virtual;abstract;
function VFSRmDir(const sDirName:String):Boolean;virtual;abstract;
function VFSCopyOut(var flSrcList : TFileList; sDstPath:String):Boolean;virtual;abstract;
function VFSCopyOut(var flSrcList : TFileList; sDstPath:String; Flags: Integer):Boolean;virtual;abstract;
function VFSCopyIn(var flSrcList : TFileList; sDstName:String; Flags : Integer):Boolean;virtual;abstract;
function VFSCopyOutEx(var flSrcList : TFileList; sDstPath:String):Boolean;virtual;abstract;
function VFSCopyOutEx(var flSrcList : TFileList; sDstPath:String; Flags: Integer):Boolean;virtual;abstract;
function VFSCopyInEx(var flSrcList : TFileList; sDstName:String; Flags : Integer):Boolean;virtual;abstract;
function VFSRename(const sSrcName, sDstName:String):Boolean;virtual;abstract;
function VFSRun(const sName:String):Boolean;virtual;abstract;

View file

@ -105,9 +105,9 @@ Type
function VFSMkDir(const sDirName:String ):Boolean;override;{Create a directory}
function VFSRmDir(const sDirName:String):Boolean;override; {Remove a directory}
function VFSCopyOut(var flSrcList : TFileList; sDstPath:String):Boolean;override;{Extract files from archive}
function VFSCopyOut(var flSrcList : TFileList; sDstPath:String; Flags: Integer):Boolean;override;{Extract files from archive}
function VFSCopyIn(var flSrcList : TFileList; sDstName:String; Flags : Integer):Boolean;override;{Pack files in archive}
function VFSCopyOutEx(var flSrcList : TFileList; sDstPath:String):Boolean;override;{Extract files from archive in thread}
function VFSCopyOutEx(var flSrcList : TFileList; sDstPath:String; Flags: Integer):Boolean;override;{Extract files from archive in thread}
function VFSCopyInEx(var flSrcList : TFileList; sDstName:String; Flags : Integer):Boolean;override;{Pack files in archive in thread}
function VFSRename(const sSrcName, sDstName:String):Boolean;override;{Rename or move file}
@ -622,8 +622,8 @@ end;
{Extract files from archive}
function TWCXModule.VFSCopyOut(var flSrcList: TFileList; sDstPath: String
): Boolean;
function TWCXModule.VFSCopyOut(var flSrcList: TFileList; sDstPath: String;
Flags: Integer): Boolean;
begin
Result := True;
try
@ -675,8 +675,8 @@ end;
{Extract files from archive in thread}
function TWCXModule.VFSCopyOutEx(var flSrcList: TFileList; sDstPath: String
): Boolean;
function TWCXModule.VFSCopyOutEx(var flSrcList: TFileList; sDstPath: String;
Flags: Integer): Boolean;
begin
Result := True;
try

View file

@ -51,6 +51,7 @@ Type
FsDeleteFile : TFsDeleteFile;
FsRemoveDir : TFsRemoveDir;
FsExecuteFile : TFsExecuteFile;
FsMkDir : TFsMkDir;
public
constructor Create;
destructor Destroy; override;
@ -67,9 +68,9 @@ Type
function VFSMkDir(const sDirName:String ):Boolean;override;
function VFSRmDir(const sDirName:String):Boolean;override;
function VFSCopyOut(var flSrcList : TFileList; sDstPath:String):Boolean;override;
function VFSCopyOut(var flSrcList : TFileList; sDstPath:String; Flags: Integer):Boolean;override;
function VFSCopyIn(var flSrcList : TFileList; sDstName:String; Flags : Integer):Boolean;override;
function VFSCopyOutEx(var flSrcList : TFileList; sDstPath:String):Boolean;override;
function VFSCopyOutEx(var flSrcList : TFileList; sDstPath:String; Flags: Integer):Boolean;override;
function VFSCopyInEx(var flSrcList : TFileList; sDstName:String; Flags : Integer):Boolean;override;
function VFSRename(const sSrcName, sDstName:String):Boolean;override;
function VFSRun(const sName:String):Boolean;override;
@ -120,6 +121,8 @@ begin
FsGetFile := TFsGetFile(GetProcAddress(FModuleHandle,'FsGetFile'));
FsPutFile := TFsPutFile(GetProcAddress(FModuleHandle,'FsPutFile'));
FsDeleteFile := TFsDeleteFile(GetProcAddress(FModuleHandle,'FsDeleteFile'));
FsMkDir := TFsMkDir(GetProcAddress(FModuleHandle,'FsMkDir'));
FsRemoveDir := TFsRemoveDir(GetProcAddress(FModuleHandle,'FsRemoveDir'));
end;
procedure TWFXModule.UnloadModule;
@ -138,7 +141,7 @@ begin
FsDeleteFile := nil;
FsRemoveDir := nil;
FsExecuteFile := nil;
FsMkDir := nil;
end;
{CallBack functions}
@ -270,17 +273,40 @@ end;
function TWFXModule.VFSMkDir(const sDirName: String): Boolean;
begin
Result := FsMkDir(PChar(sDirName));
end;
function TWFXModule.VFSRmDir(const sDirName: String): Boolean;
begin
Result := FsRemoveDir(PChar(sDirName));
end;
function TWFXModule.VFSCopyOut(var flSrcList: TFileList; sDstPath: String
): Boolean;
function TWFXModule.VFSCopyOut(var flSrcList: TFileList; sDstPath: String;
Flags: Integer): Boolean;
var
Count, I : Integer;
ri : pRemoteInfo;
iInt64Rec : TInt64Rec;
CurrFileName : String;
begin
Count := flSrcList.Count - 1;
for I := 0 to Count do
begin
CurrFileName := ExtractFilePath(sDstPath) + ExtractFileName(flSrcList.GetFileName(I));
DebugLN('Local name == ' + CurrFileName);
with ri^, flSrcList.GetItem(I)^ do
begin
iInt64Rec.Value := iSize;
SizeLow := iInt64Rec.Low;
SizeHigh := iInt64Rec.High;
//LastWriteTime := fTimeI;
Attr := iMode;
end;
Result := (FsGetFile(PChar(flSrcList.GetFileName(I)), PChar(CurrFileName), Flags, ri) = FS_FILE_OK)
end;
end;
@ -288,19 +314,23 @@ function TWFXModule.VFSCopyIn(var flSrcList: TFileList; sDstName: String;
Flags: Integer): Boolean;
var
Count, I : Integer;
CurrFileName : String;
begin
Count := flSrcList.Count - 1;
for I := 0 to Count do
begin
DebugLN('Remout name == ' + (ExtractFileName(sDstName + flSrcList.GetFileName(I))));
FsPutFile(PChar(flSrcList.GetFileName(I)), PChar(ExtractFileName(sDstName + flSrcList.GetFileName(I))), Flags);
CurrFileName := ExtractFilePath(sDstName) + ExtractFileName(flSrcList.GetFileName(I));
DebugLN('Remout name == ' + CurrFileName);
Result := (FsPutFile(PChar(flSrcList.GetFileName(I)), PChar(CurrFileName), Flags) = FS_FILE_OK)
end;
end;
function TWFXModule.VFSCopyOutEx(var flSrcList: TFileList; sDstPath: String
): Boolean;
function TWFXModule.VFSCopyOutEx(var flSrcList: TFileList; sDstPath: String;
Flags: Integer): Boolean;
begin
VFSCopyOut(flSrcList, sDstPath, Flags);
end;
function TWFXModule.VFSCopyInEx(var flSrcList: TFileList; sDstName: String;
@ -327,7 +357,11 @@ begin
for I := 0 to Count do
begin
DebugLN('Delete name == ' + flNameList.GetFileName(I));
Result := FsDeleteFile(PChar(flNameList.GetFileName(I)));
if FPS_ISDIR(flNameList.GetItem(I)^.iMode) then
Result := FsRemoveDir(PChar(flNameList.GetFileName(I)))
else
Result := FsDeleteFile(PChar(flNameList.GetFileName(I)));
end;
end;

View file

@ -5,34 +5,8 @@ unit uWFXprototypes;
interface
uses
{Classes,} SysUtils, ufsplugin;
type
{$ifdef UNICODE}
TBYTE = word;
TCHAR = widechar;
BCHAR = word;
{$else}
TBYTE = byte;
TCHAR = char;
BCHAR = BYTE;
{$endif}
{Classes, SysUtils,} ufsplugin;
WIN32_FIND_DATA = record
dwFileAttributes : DWORD;
ftCreationTime : TFILETIME;
ftLastAccessTime : TFILETIME;
ftLastWriteTime : TFILETIME;
nFileSizeHigh : DWORD;
nFileSizeLow : DWORD;
dwReserved0 : DWORD;
dwReserved1 : DWORD;
cFileName : array[0..(MAX_PATH)-1] of TCHAR;
cAlternateFileName : array[0..13] of TCHAR;
end;
tWIN32FINDDATA = WIN32_FIND_DATA;
HICON = THANDLE;
const
MAXDWORD = DWORD($FFFFFFFF);
type
{Mandatory}
TFsInit=function(PluginNr:Integer; pProgressProc:tProgressProc; pLogProc:tlogProc; pRequestProc:tRequestProc):integer;stdcall;