浏览代码

CreateDownloadPage's progress bar now supports files larger than 2 GB.

Martijn Laan 4 年之前
父节点
当前提交
763e3e3939
共有 2 个文件被更改,包括 11 次插入1 次删除
  1. 10 1
      Projects/ScriptDlg.pas
  2. 1 0
      whatsnew.htm

+ 10 - 1
Projects/ScriptDlg.pas

@@ -899,6 +899,8 @@ begin
 end;
 
 function TDownloadWizardPage.InternalOnDownloadProgress(const Url, BaseName: string; const Progress, ProgressMax: Int64): Boolean;
+var
+  Progress32, ProgressMax32: LongInt;
 begin
   if FNeedToAbortDownload then begin
     Log('Need to abort download.');
@@ -910,7 +912,14 @@ begin
       Log(Format('  %d bytes done.', [Progress]));
 
     FMsg2Label.Caption := Url;
-    SetProgress(Progress, ProgressMax); { This will process messages which we need for the abort button to work }
+    if ProgressMax > MaxLongInt then begin
+      Progress32 := Round((Progress / ProgressMax) * MaxLongInt);
+      ProgressMax32 := MaxLongInt;
+    end else begin
+      Progress32 := Progress;
+      ProgressMax32 := ProgressMax;
+    end;
+    SetProgress(Progress32, ProgressMax32); { This will process messages which we need for the abort button to work }
 
     if FShowProgressControlsOnNextProgress then begin
       ShowProgressControls(True);

+ 1 - 0
whatsnew.htm

@@ -35,6 +35,7 @@ For conditions of distribution and use, see <a href="https://jrsoftware.org/file
   <ul>
     <li>Added new <tt>ItemFontStyle</tt> and <tt>SubItemFontStyle</tt> properties to the <tt>TNewCheckListBox</tt> support class. See the <i><a href="https://jrsoftware.github.io/issrc/Examples/CodeClasses.iss">CodeClasses.iss</a></i> example script for an example.</li>
     <li>Added new <tt>IsMsiProductInstalled</tt> and <tt>StrToVersion</tt> support functions.</li>
+    <li><i>Fix:</i> <tt>CreateDownloadPage</tt>'s progress bar now supports files larger than 2 GB.</li>
   </ul>
   </li>
   <li>ISPP change: Added new <tt>StrToVersion</tt> support function.</li>