|
@@ -19,6 +19,7 @@ type
|
|
destructor Destroy; override;
|
|
destructor Destroy; override;
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
+ TCheckOperationState = function(): Boolean of object;
|
|
TUpdateCopyStatisticsFunction = procedure(var NewStatistics: TFileSourceCopyOperationStatistics) of object;
|
|
TUpdateCopyStatisticsFunction = procedure(var NewStatistics: TFileSourceCopyOperationStatistics) of object;
|
|
TUpdateDeleteStatisticsFunction = procedure(var NewStatistics: TFileSourceDeleteOperationStatistics) of object;
|
|
TUpdateDeleteStatisticsFunction = procedure(var NewStatistics: TFileSourceDeleteOperationStatistics) of object;
|
|
TUpdateSetFilePropertyStatisticsFunction = procedure(var NewStatistics: TFileSourceSetFilePropertyOperationStatistics) of object;
|
|
TUpdateSetFilePropertyStatisticsFunction = procedure(var NewStatistics: TFileSourceSetFilePropertyOperationStatistics) of object;
|
|
@@ -27,6 +28,7 @@ type
|
|
|
|
|
|
TFileOperationProgressSink = class(TInterfacedObject, IFileOperationProgressSink)
|
|
TFileOperationProgressSink = class(TInterfacedObject, IFileOperationProgressSink)
|
|
private
|
|
private
|
|
|
|
+ FCheckOperationState: TCheckOperationState;
|
|
FCopyStatistics: PFileSourceCopyOperationStatistics;
|
|
FCopyStatistics: PFileSourceCopyOperationStatistics;
|
|
FUpdateCopyStatistics: TUpdateCopyStatisticsFunction;
|
|
FUpdateCopyStatistics: TUpdateCopyStatisticsFunction;
|
|
FDeleteStatistics: PFileSourceDeleteOperationStatistics;
|
|
FDeleteStatistics: PFileSourceDeleteOperationStatistics;
|
|
@@ -36,9 +38,9 @@ type
|
|
protected
|
|
protected
|
|
procedure LogMessage(sMessage: String; logOptions: TLogOptions; logMsgType: TLogMsgType);
|
|
procedure LogMessage(sMessage: String; logOptions: TLogOptions; logMsgType: TLogMsgType);
|
|
public
|
|
public
|
|
- constructor Create(AStatistics: PFileSourceCopyOperationStatistics; AUpdateStatistics: TUpdateCopyStatisticsFunction); reintroduce; overload;
|
|
|
|
- constructor Create(AStatistics: PFileSourceDeleteOperationStatistics; AUpdateStatistics: TUpdateDeleteStatisticsFunction); reintroduce; overload;
|
|
|
|
- constructor Create(AStatistics: PFileSourceSetFilePropertyOperationStatistics; AUpdateStatistics: TUpdateSetFilePropertyStatisticsFunction); reintroduce; overload;
|
|
|
|
|
|
+ constructor Create(AStatistics: PFileSourceCopyOperationStatistics; AUpdateStatistics: TUpdateCopyStatisticsFunction; ACheckOperationState: TCheckOperationState); reintroduce; overload;
|
|
|
|
+ constructor Create(AStatistics: PFileSourceDeleteOperationStatistics; AUpdateStatistics: TUpdateDeleteStatisticsFunction; ACheckOperationState: TCheckOperationState); reintroduce; overload;
|
|
|
|
+ constructor Create(AStatistics: PFileSourceSetFilePropertyOperationStatistics; AUpdateStatistics: TUpdateSetFilePropertyStatisticsFunction; ACheckOperationState: TCheckOperationState); reintroduce; overload;
|
|
public
|
|
public
|
|
function StartOperations: HResult; stdcall;
|
|
function StartOperations: HResult; stdcall;
|
|
function FinishOperations(hrResult: HResult): HResult; stdcall;
|
|
function FinishOperations(hrResult: HResult): HResult; stdcall;
|
|
@@ -77,7 +79,7 @@ var
|
|
implementation
|
|
implementation
|
|
|
|
|
|
uses
|
|
uses
|
|
- DCOSUtils, DCConvertEncoding, uLng;
|
|
|
|
|
|
+ DCOSUtils, DCConvertEncoding, uShlObjAdditional, uLng;
|
|
|
|
|
|
var
|
|
var
|
|
AModule: HMODULE;
|
|
AModule: HMODULE;
|
|
@@ -117,26 +119,32 @@ end;
|
|
|
|
|
|
constructor TFileOperationProgressSink.Create(
|
|
constructor TFileOperationProgressSink.Create(
|
|
AStatistics: PFileSourceCopyOperationStatistics;
|
|
AStatistics: PFileSourceCopyOperationStatistics;
|
|
- AUpdateStatistics: TUpdateCopyStatisticsFunction);
|
|
|
|
|
|
+ AUpdateStatistics: TUpdateCopyStatisticsFunction;
|
|
|
|
+ ACheckOperationState: TCheckOperationState);
|
|
begin
|
|
begin
|
|
FCopyStatistics:= AStatistics;
|
|
FCopyStatistics:= AStatistics;
|
|
FUpdateCopyStatistics:= AUpdateStatistics;
|
|
FUpdateCopyStatistics:= AUpdateStatistics;
|
|
|
|
+ FCheckOperationState:= ACheckOperationState;
|
|
end;
|
|
end;
|
|
|
|
|
|
constructor TFileOperationProgressSink.Create(
|
|
constructor TFileOperationProgressSink.Create(
|
|
AStatistics: PFileSourceDeleteOperationStatistics;
|
|
AStatistics: PFileSourceDeleteOperationStatistics;
|
|
- AUpdateStatistics: TUpdateDeleteStatisticsFunction);
|
|
|
|
|
|
+ AUpdateStatistics: TUpdateDeleteStatisticsFunction;
|
|
|
|
+ ACheckOperationState: TCheckOperationState);
|
|
begin
|
|
begin
|
|
FDeleteStatistics:= AStatistics;
|
|
FDeleteStatistics:= AStatistics;
|
|
FUpdateDeleteStatistics:= AUpdateStatistics;
|
|
FUpdateDeleteStatistics:= AUpdateStatistics;
|
|
|
|
+ FCheckOperationState:= ACheckOperationState;
|
|
end;
|
|
end;
|
|
|
|
|
|
constructor TFileOperationProgressSink.Create(
|
|
constructor TFileOperationProgressSink.Create(
|
|
AStatistics: PFileSourceSetFilePropertyOperationStatistics;
|
|
AStatistics: PFileSourceSetFilePropertyOperationStatistics;
|
|
- AUpdateStatistics: TUpdateSetFilePropertyStatisticsFunction);
|
|
|
|
|
|
+ AUpdateStatistics: TUpdateSetFilePropertyStatisticsFunction;
|
|
|
|
+ ACheckOperationState: TCheckOperationState);
|
|
begin
|
|
begin
|
|
FSetFilePropertyStatistics:= AStatistics;
|
|
FSetFilePropertyStatistics:= AStatistics;
|
|
FUpdateSetFilePropertyStatistics:= AUpdateStatistics;
|
|
FUpdateSetFilePropertyStatistics:= AUpdateStatistics;
|
|
|
|
+ FCheckOperationState:= ACheckOperationState;
|
|
end;
|
|
end;
|
|
|
|
|
|
function TFileOperationProgressSink.StartOperations: HResult; stdcall;
|
|
function TFileOperationProgressSink.StartOperations: HResult; stdcall;
|
|
@@ -181,7 +189,7 @@ function TFileOperationProgressSink.PostMoveItem(dwFlags: DWORD;
|
|
psiItem: IShellItem; psiDestinationFolder: IShellItem; pszNewName: LPCWSTR;
|
|
psiItem: IShellItem; psiDestinationFolder: IShellItem; pszNewName: LPCWSTR;
|
|
hrMove: HRESULT; psiNewlyCreated: IShellItem): HResult; stdcall;
|
|
hrMove: HRESULT; psiNewlyCreated: IShellItem): HResult; stdcall;
|
|
begin
|
|
begin
|
|
- if (log_cp_mv_ln in gLogOptions) then
|
|
|
|
|
|
+ if (log_cp_mv_ln in gLogOptions) and (hrMove <> COPYENGINE_E_USER_CANCELLED) then
|
|
begin
|
|
begin
|
|
with FCopyStatistics^ do
|
|
with FCopyStatistics^ do
|
|
begin
|
|
begin
|
|
@@ -232,7 +240,7 @@ function TFileOperationProgressSink.PostCopyItem(dwFlags: DWORD;
|
|
psiItem: IShellItem; psiDestinationFolder: IShellItem; pszNewName: LPCWSTR;
|
|
psiItem: IShellItem; psiDestinationFolder: IShellItem; pszNewName: LPCWSTR;
|
|
hrCopy: HRESULT; psiNewlyCreated: IShellItem): HResult; stdcall;
|
|
hrCopy: HRESULT; psiNewlyCreated: IShellItem): HResult; stdcall;
|
|
begin
|
|
begin
|
|
- if (log_cp_mv_ln in gLogOptions) then
|
|
|
|
|
|
+ if (log_cp_mv_ln in gLogOptions) and (hrCopy <> COPYENGINE_E_USER_CANCELLED) then
|
|
begin
|
|
begin
|
|
with FCopyStatistics^ do
|
|
with FCopyStatistics^ do
|
|
begin
|
|
begin
|
|
@@ -270,7 +278,7 @@ var
|
|
AText: String;
|
|
AText: String;
|
|
sfgaoAttribs: SFGAOF = 0;
|
|
sfgaoAttribs: SFGAOF = 0;
|
|
begin
|
|
begin
|
|
- if log_delete in gLogOptions then
|
|
|
|
|
|
+ if (log_delete in gLogOptions) and (hrDelete <> COPYENGINE_E_USER_CANCELLED) then
|
|
begin
|
|
begin
|
|
psiItem.GetAttributes(SFGAO_FOLDER, @sfgaoAttribs);
|
|
psiItem.GetAttributes(SFGAO_FOLDER, @sfgaoAttribs);
|
|
if (sfgaoAttribs and SFGAO_FOLDER) = 0 then
|
|
if (sfgaoAttribs and SFGAO_FOLDER) = 0 then
|
|
@@ -333,7 +341,11 @@ begin
|
|
FUpdateSetFilePropertyStatistics(FSetFilePropertyStatistics^);
|
|
FUpdateSetFilePropertyStatistics(FSetFilePropertyStatistics^);
|
|
end;
|
|
end;
|
|
|
|
|
|
- Result:= S_OK;
|
|
|
|
|
|
+ if FCheckOperationState() then
|
|
|
|
+ Result:= S_OK
|
|
|
|
+ else begin
|
|
|
|
+ Result:= COPYENGINE_E_USER_CANCELLED;
|
|
|
|
+ end;
|
|
end;
|
|
end;
|
|
|
|
|
|
function TFileOperationProgressSink.ResetTimer: HResult; stdcall;
|
|
function TFileOperationProgressSink.ResetTimer: HResult; stdcall;
|