mirror of
https://github.com/doublecmd/doublecmd.git
synced 2026-06-21 09:58:13 +00:00
ADD: Zip - show total progress when extract
(cherry picked from commit f89ab9056e)
This commit is contained in:
parent
e3664c5749
commit
b323b32a2b
1 changed files with 33 additions and 8 deletions
|
|
@ -40,6 +40,8 @@ type
|
|||
|
||||
TAbZipKitEx = class (TAbZipKit)
|
||||
private
|
||||
FItemProgress: Byte;
|
||||
FItem: TAbArchiveItem;
|
||||
FNeedPassword: Boolean;
|
||||
FOperationResult: LongInt;
|
||||
FChangeVolProcW: TChangeVolProcW;
|
||||
|
|
@ -237,6 +239,7 @@ end;
|
|||
|
||||
function ProcessFileW(hArcData : TArcHandle; Operation : Integer; DestPath, DestName : PWideChar) : Integer;dcpcall;
|
||||
var
|
||||
Abort: Boolean;
|
||||
DestNameUtf8: String;
|
||||
Arc : TAbZipKitEx absolute hArcData;
|
||||
begin
|
||||
|
|
@ -257,8 +260,9 @@ begin
|
|||
// Show progress and ask if aborting.
|
||||
if Assigned(Arc.FProcessDataProcW) then
|
||||
begin
|
||||
if Arc.FProcessDataProcW(PWideChar(CeUtf8ToUtf16(Arc.Items[Arc.Tag].FileName)), -1100) = 0 then
|
||||
Arc.FOperationResult := E_EABORTED;
|
||||
Abort := False;
|
||||
Arc.AbArchiveItemProgressEvent(Arc, Arc.Items[Arc.Tag], 100, Abort);
|
||||
if Abort then Arc.FOperationResult := E_EABORTED;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
|
@ -284,8 +288,9 @@ begin
|
|||
// Show progress and ask if aborting.
|
||||
if Assigned(Arc.FProcessDataProcW) then
|
||||
begin
|
||||
if Arc.FProcessDataProcW(PWideChar(CeUtf8ToUtf16(Arc.Items[Arc.Tag].FileName)), -1100) = 0 then
|
||||
Arc.FOperationResult := E_EABORTED;
|
||||
Abort := False;
|
||||
Arc.AbArchiveItemProgressEvent(Arc, Arc.Items[Arc.Tag], 100, Abort);
|
||||
if Abort then Arc.FOperationResult := E_EABORTED;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
|
@ -633,14 +638,34 @@ end;
|
|||
|
||||
procedure TAbZipKitEx.AbArchiveItemProgressEvent(Sender: TObject;
|
||||
Item: TAbArchiveItem; Progress: Byte; var Abort: Boolean);
|
||||
var
|
||||
ASize: Int64;
|
||||
begin
|
||||
try
|
||||
if Assigned(FProcessDataProcW) then
|
||||
begin
|
||||
if Assigned(Item) then
|
||||
Abort := (FProcessDataProcW(PWideChar(CeUtf8ToUtf16(Item.FileName)), -(Progress + 1000)) = 0)
|
||||
else
|
||||
Abort := (FProcessDataProcW(nil, -(Progress + 1000)) = 0);
|
||||
if (Item = nil) then
|
||||
Abort := (FProcessDataProcW(nil, -(Progress + 1000)) = 0)
|
||||
else begin
|
||||
if Item.UncompressedSize = 0 then
|
||||
ASize:= -(Progress + 1000)
|
||||
else begin
|
||||
if FItem <> Item then
|
||||
begin
|
||||
FItem := Item;
|
||||
FItemProgress := 0;
|
||||
end;
|
||||
if FItemProgress = Progress then
|
||||
ASize := 0
|
||||
else begin
|
||||
ASize := Item.UncompressedSize;
|
||||
ASize := (Int64(Progress) - Int64(FItemProgress)) * ASize div 100;
|
||||
if ASize > High(Int32) then ASize := -(Progress + 1000);
|
||||
FItemProgress := Progress;
|
||||
end;
|
||||
end;
|
||||
Abort := (FProcessDataProcW(PWideChar(CeUtf8ToUtf16(Item.FileName)), ASize) = 0)
|
||||
end;
|
||||
end;
|
||||
except
|
||||
Abort := True;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue