mirror of
https://github.com/doublecmd/doublecmd.git
synced 2026-06-28 10:02:14 +00:00
UPD: WfxPluginFileSource
This commit is contained in:
parent
1c2a0c9b15
commit
43c393f359
5 changed files with 55 additions and 19 deletions
|
|
@ -24,7 +24,7 @@ type
|
|||
private
|
||||
FWfxPluginFileSource: IWfxPluginFileSource;
|
||||
FOperationHelper: TWfxPluginOperationHelper;
|
||||
FUpdateProgressClass: TUpdateProgressClass;
|
||||
FCallbackDataClass: TCallbackDataClass;
|
||||
FFullFilesTreeToCopy: TFileSystemFiles; // source files including all files/dirs in subdirectories
|
||||
FStatistics: TFileSourceCopyOperationStatistics; // local copy of statistics
|
||||
// Options
|
||||
|
|
@ -85,25 +85,26 @@ constructor TWfxPluginCopyInOperation.Create(aSourceFileSource: IFileSource;
|
|||
aTargetPath: String);
|
||||
begin
|
||||
FWfxPluginFileSource:= aTargetFileSource as IWfxPluginFileSource;
|
||||
FUpdateProgressClass:= TUpdateProgressClass.Create;
|
||||
FCallbackDataClass:= TCallbackDataClass.Create;
|
||||
FInternal:= aSourceFileSource.IsInterface(IWfxPluginFileSource);
|
||||
inherited Create(aSourceFileSource, aTargetFileSource, theSourceFiles, aTargetPath);
|
||||
end;
|
||||
|
||||
destructor TWfxPluginCopyInOperation.Destroy;
|
||||
begin
|
||||
if Assigned(FUpdateProgressClass) then
|
||||
FreeAndNil(FUpdateProgressClass);
|
||||
if Assigned(FCallbackDataClass) then
|
||||
FreeAndNil(FCallbackDataClass);
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
procedure TWfxPluginCopyInOperation.Initialize;
|
||||
begin
|
||||
FUpdateProgressClass.UpdateProgressFunction:= @UpdateProgress;
|
||||
FCallbackDataClass.FileSource:= FWfxPluginFileSource;
|
||||
FCallbackDataClass.UpdateProgressFunction:= @UpdateProgress;
|
||||
with FWfxPluginFileSource do
|
||||
begin
|
||||
WfxModule.WfxStatusInfo({CurrentPath} SourceFiles.Path, FS_STATUS_START, FS_STATUS_OP_PUT_MULTI);
|
||||
WfxOperationList.Objects[PluginNumber]:= FUpdateProgressClass;
|
||||
WfxOperationList.Objects[PluginNumber]:= FCallbackDataClass;
|
||||
end;
|
||||
// Get initialized statistics; then we change only what is needed.
|
||||
FStatistics := RetrieveStatistics;
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ type
|
|||
private
|
||||
FWfxPluginFileSource: IWfxPluginFileSource;
|
||||
FOperationHelper: TWfxPluginOperationHelper;
|
||||
FUpdateProgressClass: TUpdateProgressClass;
|
||||
FCallbackDataClass: TCallbackDataClass;
|
||||
FFullFilesTreeToCopy: TFiles; // source files including all files/dirs in subdirectories
|
||||
FStatistics: TFileSourceCopyOperationStatistics; // local copy of statistics
|
||||
// Options
|
||||
|
|
@ -83,25 +83,26 @@ constructor TWfxPluginCopyOutOperation.Create(aSourceFileSource: IFileSource;
|
|||
aTargetPath: String);
|
||||
begin
|
||||
FWfxPluginFileSource:= aSourceFileSource as IWfxPluginFileSource;
|
||||
FUpdateProgressClass:= TUpdateProgressClass.Create;
|
||||
FCallbackDataClass:= TCallbackDataClass.Create;
|
||||
FInternal:= aTargetFileSource.IsInterface(IWfxPluginFileSource);
|
||||
inherited Create(aSourceFileSource, aTargetFileSource, theSourceFiles, aTargetPath);
|
||||
end;
|
||||
|
||||
destructor TWfxPluginCopyOutOperation.Destroy;
|
||||
begin
|
||||
if Assigned(FUpdateProgressClass) then
|
||||
FreeAndNil(FUpdateProgressClass);
|
||||
if Assigned(FCallbackDataClass) then
|
||||
FreeAndNil(FCallbackDataClass);
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
procedure TWfxPluginCopyOutOperation.Initialize;
|
||||
begin
|
||||
FUpdateProgressClass.UpdateProgressFunction:= @UpdateProgress;
|
||||
FCallbackDataClass.FileSource:= FWfxPluginFileSource;
|
||||
FCallbackDataClass.UpdateProgressFunction:= @UpdateProgress;
|
||||
with FWfxPluginFileSource do
|
||||
begin
|
||||
WfxModule.WfxStatusInfo({CurrentPath}SourceFiles.Path, FS_STATUS_START, FS_STATUS_OP_PUT_MULTI);
|
||||
WfxOperationList.Objects[PluginNumber]:= FUpdateProgressClass;
|
||||
WfxOperationList.Objects[PluginNumber]:= FCallbackDataClass;
|
||||
// Get initialized statistics; then we change only what is needed.
|
||||
FStatistics := RetrieveStatistics;
|
||||
|
||||
|
|
|
|||
|
|
@ -95,17 +95,17 @@ uses
|
|||
|
||||
function MainProgressProc(PluginNr: Integer; SourceName, TargetName: UTF8String; PercentDone: Integer): Integer;
|
||||
var
|
||||
UpdateProgressClass: TUpdateProgressClass;
|
||||
CallbackDataClass: TCallbackDataClass;
|
||||
begin
|
||||
Result:= 0;
|
||||
|
||||
DebugLn('MainProgressProc ('+IntToStr(PluginNr)+','+SourceName+','+TargetName+','+IntToStr(PercentDone)+')=' ,IntTostr(Result));
|
||||
|
||||
UpdateProgressClass:= TUpdateProgressClass(WfxOperationList.Objects[PluginNr]);
|
||||
CallbackDataClass:= TCallbackDataClass(WfxOperationList.Objects[PluginNr]);
|
||||
|
||||
if not Assigned(UpdateProgressClass) then Exit;
|
||||
if not Assigned(CallbackDataClass) then Exit;
|
||||
|
||||
Result:= UpdateProgressClass.UpdateProgressFunction(SourceName, TargetName, PercentDone);
|
||||
Result:= CallbackDataClass.UpdateProgressFunction(SourceName, TargetName, PercentDone);
|
||||
end;
|
||||
|
||||
function MainProgressProcA(PluginNr: Integer; SourceName, TargetName: PAnsiChar; PercentDone: Integer): Integer; stdcall;
|
||||
|
|
|
|||
|
|
@ -8,16 +8,24 @@ uses
|
|||
Classes, SysUtils,
|
||||
uFileSourceListOperation,
|
||||
uWfxPluginFileSource,
|
||||
uWfxPluginUtil,
|
||||
uFileSource;
|
||||
|
||||
type
|
||||
|
||||
{ TWfxPluginListOperation }
|
||||
|
||||
TWfxPluginListOperation = class(TFileSourceListOperation)
|
||||
private
|
||||
FWfxPluginFileSource: IWfxPluginFileSource;
|
||||
FCallbackDataClass: TCallbackDataClass;
|
||||
public
|
||||
constructor Create(aFileSource: IFileSource; aPath: String); override;
|
||||
destructor Destroy; override;
|
||||
|
||||
procedure Initialize; override;
|
||||
procedure MainExecute; override;
|
||||
procedure Finalize; override;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
|
@ -30,9 +38,27 @@ constructor TWfxPluginListOperation.Create(aFileSource: IFileSource; aPath: Stri
|
|||
begin
|
||||
FFiles := TFiles.Create;
|
||||
FWfxPluginFileSource := aFileSource as IWfxPluginFileSource;
|
||||
FCallbackDataClass:= TCallbackDataClass.Create;
|
||||
inherited Create(aFileSource, aPath);
|
||||
end;
|
||||
|
||||
destructor TWfxPluginListOperation.Destroy;
|
||||
begin
|
||||
if Assigned(FCallbackDataClass) then
|
||||
FreeAndNil(FCallbackDataClass);
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
procedure TWfxPluginListOperation.Initialize;
|
||||
begin
|
||||
FCallbackDataClass.FileSource:= FWfxPluginFileSource;
|
||||
with FWfxPluginFileSource do
|
||||
begin
|
||||
WfxModule.WfxStatusInfo(Path, FS_STATUS_START, FS_STATUS_OP_LIST);
|
||||
WfxOperationList.Objects[PluginNumber]:= FCallbackDataClass;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TWfxPluginListOperation.MainExecute;
|
||||
var
|
||||
FindData : TWfxFindData;
|
||||
|
|
@ -43,7 +69,6 @@ begin
|
|||
with FWfxPluginFileSource.WFXModule do
|
||||
begin
|
||||
sPath:= Path;
|
||||
WFXStatusInfo(sPath, FS_STATUS_START, FS_STATUS_OP_LIST);
|
||||
|
||||
FFiles.Clear;
|
||||
FFiles.Path := IncludeTrailingPathDelimiter(sPath);
|
||||
|
|
@ -69,9 +94,17 @@ begin
|
|||
|
||||
FsFindClose(Handle);
|
||||
|
||||
WFXStatusInfo(sPath, FS_STATUS_END, FS_STATUS_OP_LIST);
|
||||
end; // with
|
||||
end;
|
||||
|
||||
procedure TWfxPluginListOperation.Finalize;
|
||||
begin
|
||||
with FWfxPluginFileSource do
|
||||
begin
|
||||
WfxModule.WfxStatusInfo(Path, FS_STATUS_END, FS_STATUS_OP_LIST);
|
||||
WfxOperationList.Objects[PluginNumber]:= nil;
|
||||
end;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
||||
|
|
|
|||
|
|
@ -18,8 +18,9 @@ type
|
|||
|
||||
TUpdateProgress = function(SourceName, TargetName: UTF8String; PercentDone: Integer): Integer of object;
|
||||
|
||||
TUpdateProgressClass = class
|
||||
TCallbackDataClass = class
|
||||
public
|
||||
FileSource: IWfxPluginFileSource;
|
||||
UpdateProgressFunction: TUpdateProgress;
|
||||
end;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue