瀏覽代碼

Get rid of CodeDownloadFiles2.iss again.

Martijn Laan 3 月之前
父節點
當前提交
0daa983351
共有 5 個文件被更改,包括 43 次插入111 次删除
  1. 39 12
      Examples/CodeDownloadFiles.iss
  2. 0 93
      Examples/CodeDownloadFiles2.iss
  3. 2 3
      ISHelp/isxfunc.xml
  4. 0 1
      setup.iss
  5. 2 2
      whatsnew.htm

+ 39 - 12
Examples/CodeDownloadFiles.iss

@@ -1,11 +1,13 @@
 ; -- CodeDownloadFiles.iss --
 ; -- CodeDownloadFiles.iss --
 ;
 ;
 ; This script shows how the CreateDownloadPage support function can be used to
 ; This script shows how the CreateDownloadPage support function can be used to
-; download temporary files while showing the download progress to the user.
+; download temporary files and archives while showing the download and extraction
+; progress to the user.
 ;
 ;
 ; To verify the downloaded files, this script shows two methods:
 ; To verify the downloaded files, this script shows two methods:
-; -For innosetup-latest.exe: using the Inno Setup Signature Tool, the [ISSigKeys]
-;  section, and the issigverify flag
+; -For innosetup-latest.exe and MyProg-ExtraReadmes.7z: using Inno Setup
+;  Signature Tool, the [ISSigKeys] section, and the AddWithISSigVerify support
+;  function
 ; -For iscrypt.dll: using a simple SHA256 check
 ; -For iscrypt.dll: using a simple SHA256 check
 ; Using the Inno Setup Signature Tool has the benefit that the script does not
 ; Using the Inno Setup Signature Tool has the benefit that the script does not
 ; need to be changed when the downloaded file changes, so any installers built
 ; need to be changed when the downloaded file changes, so any installers built
@@ -19,20 +21,25 @@ DefaultDirName={autopf}\My Program
 DefaultGroupName=My Program
 DefaultGroupName=My Program
 UninstallDisplayIcon={app}\MyProg.exe
 UninstallDisplayIcon={app}\MyProg.exe
 OutputDir=userdocs:Inno Setup Examples Output
 OutputDir=userdocs:Inno Setup Examples Output
+;Use "ArchiveExtraction=enhanced" if your archive has a password
+;Use "ArchiveExtraction=full" if your archive is not a .7z file but for example a .zip file
+ArchiveExtraction=enhanced/nopassword
 
 
 [ISSigKeys]
 [ISSigKeys]
-Name: "mykey"; \
+Name: "mykey"; RuntimeID: "def02"; \
   KeyID:   "def020edee3c4835fd54d85eff8b66d4d899b22a777353ca4a114b652e5e7a28"; \
   KeyID:   "def020edee3c4835fd54d85eff8b66d4d899b22a777353ca4a114b652e5e7a28"; \
   PublicX: "515dc7d6c16d4a46272ceb3d158c5630a96466ab4d948e72c2029d737c823097"; \
   PublicX: "515dc7d6c16d4a46272ceb3d158c5630a96466ab4d948e72c2029d737c823097"; \
   PublicY: "f3c21f6b5156c52a35f6f28016ee3e31a3ded60c325b81fb7b1f88c221081a61"
   PublicY: "f3c21f6b5156c52a35f6f28016ee3e31a3ded60c325b81fb7b1f88c221081a61"
 
 
 [Files]
 [Files]
 ; Place any regular files here
 ; Place any regular files here
-Source: "MyProg.exe"; DestDir: "{app}";
-Source: "MyProg.chm"; DestDir: "{app}";
-Source: "Readme.txt"; DestDir: "{app}"; Flags: isreadme;
-; These files will be downloaded
+Source: "MyProg.exe"; DestDir: "{app}"
+Source: "MyProg.chm"; DestDir: "{app}"
+Source: "Readme.txt"; DestDir: "{app}"; Flags: isreadme
+; These files will be downloaded. If you include flag issigverify here the file will be verified
+; a second time while copying. Verification while copying is efficient, except for archives.
 Source: "{tmp}\innosetup-latest.exe"; DestDir: "{app}"; Flags: external ignoreversion issigverify
 Source: "{tmp}\innosetup-latest.exe"; DestDir: "{app}"; Flags: external ignoreversion issigverify
+Source: "{tmp}\MyProg-ExtraReadmes.7z"; DestDir: "{app}"; Flags: external extractarchive recursesubdirs ignoreversion
 Source: "{tmp}\ISCrypt.dll"; DestDir: "{app}"; Flags: external ignoreversion
 Source: "{tmp}\ISCrypt.dll"; DestDir: "{app}"; Flags: external ignoreversion
 
 
 [Icons]
 [Icons]
@@ -41,21 +48,41 @@ Name: "{group}\My Program"; Filename: "{app}\MyProg.exe"
 [Code]
 [Code]
 var
 var
   DownloadPage: TDownloadWizardPage;
   DownloadPage: TDownloadWizardPage;
+  AllowedKeysRuntimeIDs: TStringList;
 
 
 procedure InitializeWizard;
 procedure InitializeWizard;
 begin
 begin
   DownloadPage := CreateDownloadPage(SetupMessage(msgWizardPreparing), SetupMessage(msgPreparingDesc), nil);
   DownloadPage := CreateDownloadPage(SetupMessage(msgWizardPreparing), SetupMessage(msgPreparingDesc), nil);
   DownloadPage.ShowBaseNameInsteadOfUrl := True;
   DownloadPage.ShowBaseNameInsteadOfUrl := True;
+  
+  // To allow all keys you can also just pass nil instead of this list to AddWithISSigVerify 
+  AllowedKeysRuntimeIDs := TStringList.Create;
+  AllowedKeysRuntimeIDs.Add('def02');
+end;
+
+procedure DeinitializeSetup;
+begin
+  if AllowedKeysRuntimeIDs <> nil then
+    AllowedKeysRuntimeIDs.Free;
 end;
 end;
 
 
 function NextButtonClick(CurPageID: Integer): Boolean;
 function NextButtonClick(CurPageID: Integer): Boolean;
 begin
 begin
   if CurPageID = wpReady then begin
   if CurPageID = wpReady then begin
     DownloadPage.Clear;
     DownloadPage.Clear;
-    // Use AddEx to specify a username and password
-    DownloadPage.Add('https://jrsoftware.org/download.php/is.exe?dontcount=1', 'innosetup-latest.exe', '');
-    DownloadPage.Add('https://jrsoftware.org/download.php/is.exe.issig?dontcount=1', 'innosetup-latest.exe.issig', '');
-    DownloadPage.Add('https://jrsoftware.org/download.php/iscrypt.dll?dontcount=1', 'ISCrypt.dll', '2f6294f9aa09f59a574b5dcd33be54e16b39377984f3d5658cda44950fa0f8fc');
+    // Use AddEx or AddExWithISSigVerify to specify a username and password
+    DownloadPage.AddWithISSigVerify(
+      'https://jrsoftware.org/download.php/is.exe?dontcount=1',
+      'https://jrsoftware.org/download.php/is.exe.issig',
+      'innosetup-latest.exe', AllowedKeysRuntimeIDs);
+    DownloadPage.AddWithISSigVerify(
+      'https://jrsoftware.org/download.php/myprog-extrareadmes.7z',
+      'https://jrsoftware.org/download.php/myprog-extrareadmes.7z.issig',
+      'MyProg-ExtraReadmes.7z', AllowedKeysRuntimeIDs);
+    DownloadPage.Add(
+      'https://jrsoftware.org/download.php/iscrypt.dll?dontcount=1',
+      'ISCrypt.dll',
+      '2f6294f9aa09f59a574b5dcd33be54e16b39377984f3d5658cda44950fa0f8fc');
     DownloadPage.Show;
     DownloadPage.Show;
     try
     try
       try
       try

+ 0 - 93
Examples/CodeDownloadFiles2.iss

@@ -1,93 +0,0 @@
-; -- CodeDownloadFiles2.iss --
-; Same as CodeDownloadFiles1.iss but additionally downloads a 7-Zip archive and
-; shows how to verify and extract it.
-
-[Setup]
-AppName=My Program
-AppVersion=1.5
-WizardStyle=modern
-DefaultDirName={autopf}\My Program
-DefaultGroupName=My Program
-UninstallDisplayIcon={app}\MyProg.exe
-OutputDir=userdocs:Inno Setup Examples Output
-;Use "ArchiveExtraction=enhanced" if your archive has a password
-;Use "ArchiveExtraction=full" if your archive is not a .7z file but for example a .zip file
-ArchiveExtraction=enhanced/nopassword
-
-[ISSigKeys]
-Name: "mykey"; RuntimeID: "def02"; \
-  KeyID:   "def020edee3c4835fd54d85eff8b66d4d899b22a777353ca4a114b652e5e7a28"; \
-  PublicX: "515dc7d6c16d4a46272ceb3d158c5630a96466ab4d948e72c2029d737c823097"; \
-  PublicY: "f3c21f6b5156c52a35f6f28016ee3e31a3ded60c325b81fb7b1f88c221081a61"
-
-[Files]
-; Place any regular files here
-Source: "MyProg.exe"; DestDir: "{app}"
-Source: "MyProg.chm"; DestDir: "{app}"
-Source: "Readme.txt"; DestDir: "{app}"; Flags: isreadme
-; These files will be downloaded. If you include flag issigverify here the file will be verified
-; a second time while copying. Verification while copying is efficient, except for archives.
-Source: "{tmp}\innosetup-latest.exe"; DestDir: "{app}"; Flags: external ignoreversion issigverify
-Source: "{tmp}\MyProg-ExtraReadmes.7z"; DestDir: "{app}"; Flags: external extractarchive recursesubdirs ignoreversion
-Source: "{tmp}\ISCrypt.dll"; DestDir: "{app}"; Flags: external ignoreversion
-
-[Icons]
-Name: "{group}\My Program"; Filename: "{app}\MyProg.exe"
-
-[Code]
-var
-  DownloadPage: TDownloadWizardPage;
-  AllowedKeysRuntimeIDs: TStringList;
-
-procedure InitializeWizard;
-begin
-  DownloadPage := CreateDownloadPage(SetupMessage(msgWizardPreparing), SetupMessage(msgPreparingDesc), nil);
-  DownloadPage.ShowBaseNameInsteadOfUrl := True;
-  
-  // To allow all keys you can also just pass nil instead of this list to AddWithISSigVerify 
-  AllowedKeysRuntimeIDs := TStringList.Create;
-  AllowedKeysRuntimeIDs.Add('def02');
-end;
-
-procedure DeinitializeSetup;
-begin
-  if AllowedKeysRuntimeIDs <> nil then
-    AllowedKeysRuntimeIDs.Free;
-end;
-
-function NextButtonClick(CurPageID: Integer): Boolean;
-begin
-  if CurPageID = wpReady then begin
-    DownloadPage.Clear;
-    // Use AddEx or AddExWithISSigVerify to specify a username and password
-    DownloadPage.AddWithISSigVerify(
-      'https://jrsoftware.org/download.php/is.exe?dontcount=1',
-      'https://jrsoftware.org/download.php/is.exe.issig',
-      'innosetup-latest.exe', AllowedKeysRuntimeIDs);
-    DownloadPage.AddWithISSigVerify(
-      'https://jrsoftware.org/download.php/myprog-extrareadmes.7z',
-      'https://jrsoftware.org/download.php/myprog-extrareadmes.7z.issig',
-      'MyProg-ExtraReadmes.7z', AllowedKeysRuntimeIDs);
-    DownloadPage.Add(
-      'https://jrsoftware.org/download.php/iscrypt.dll?dontcount=1',
-      'ISCrypt.dll',
-      '2f6294f9aa09f59a574b5dcd33be54e16b39377984f3d5658cda44950fa0f8fc');
-    DownloadPage.Show;
-    try
-      try
-        // Downloads the files to {tmp}
-        DownloadPage.Download;
-        Result := True;
-      except
-        if DownloadPage.AbortedByUser then
-          Log('Aborted by user.')
-        else
-          SuppressibleMsgBox(AddPeriod(GetExceptionMessage), mbCriticalError, MB_OK, IDOK);
-        Result := False;
-      end;
-    finally
-      DownloadPage.Hide;
-    end;
-  end else
-    Result := True;
-end;

+ 2 - 3
ISHelp/isxfunc.xml

@@ -1884,7 +1884,7 @@ end;</pre>
 <p>An exception will be raised if there was an error.</p>
 <p>An exception will be raised if there was an error.</p>
 <p>The supported archive formats, beyond .7z, and the support for password-protected archives, depend on the <link topic="setup_archiveextraction">ArchiveExtraction</link> [Setup] section directive.</p>
 <p>The supported archive formats, beyond .7z, and the support for password-protected archives, depend on the <link topic="setup_archiveextraction">ArchiveExtraction</link> [Setup] section directive.</p>
 <p>Set OnExtractionProgress to a function to be informed of progress, or <tt>nil</tt> otherwise.</p>
 <p>Set OnExtractionProgress to a function to be informed of progress, or <tt>nil</tt> otherwise.</p>
-<p>See <i>CodeDownloadFiles2.iss</i> for an example of archive extraction using just a [Files] entry.</p></description>
+<p>See <i>CodeDownloadFiles.iss</i> for an example of archive extraction using just a [Files] entry instead.</p></description>
         <remarks><p>TOnExtractionProgress is defined as:</p>
         <remarks><p>TOnExtractionProgress is defined as:</p>
 <p><tt>TOnExtractionProgress = function(const ArchiveName, FileName: String; const Progress, ProgressMax: Int64): Boolean;</tt></p>
 <p><tt>TOnExtractionProgress = function(const ArchiveName, FileName: String; const Progress, ProgressMax: Int64): Boolean;</tt></p>
 <p>Return True to allow the extraction to continue, False otherwise.</p></remarks>
 <p>Return True to allow the extraction to continue, False otherwise.</p></remarks>
@@ -2702,8 +2702,7 @@ Page := CreateOutputMsgMemoPage(wpWelcome,
 <p>To start the extraction, call the <tt>Extract</tt> method. An exception will be raised if there was an error. Otherwise, <tt>Extract</tt> returns the number of archives extracted.</p>
 <p>To start the extraction, call the <tt>Extract</tt> method. An exception will be raised if there was an error. Otherwise, <tt>Extract</tt> returns the number of archives extracted.</p>
 <p>Set the <tt>ShowArchiveInsteadFile</tt> property to <tt>True</tt> to show the name of the archive which is being extracted to the user instead of the names of the files inside the archive.</p>
 <p>Set the <tt>ShowArchiveInsteadFile</tt> property to <tt>True</tt> to show the name of the archive which is being extracted to the user instead of the names of the files inside the archive.</p>
 <p>See <link topic="isxfunc_ExtractArchive">ExtractArchive</link> for the definition of <tt>TOnExtractionProgress</tt>.</p></remarks>
 <p>See <link topic="isxfunc_ExtractArchive">ExtractArchive</link> for the definition of <tt>TOnExtractionProgress</tt>.</p></remarks>
-        <example><p>See <i>CodeDownloadFiles.iss</i> for an example of <tt>CreateDownloadPage</tt> which works very similar to <tt>CreateExtractionPage</tt>.</p>
-<p>See <i>CodeDownloadFiles2.iss</i> for an example of archive extraction using just a [Files] entry.</p></example>
+        <example><p>See <i>CodeDownloadFiles.iss</i> for an example of <tt>CreateDownloadPage</tt> which works very similar to <tt>CreateExtractionPage</tt>, and an example of archive extraction using just a [Files] entry instead.</p></example>
         <seealso><p><link topic="scriptclasses" anchor="TExtractionWizardPage">TExtractionWizardPage</link><br />
         <seealso><p><link topic="scriptclasses" anchor="TExtractionWizardPage">TExtractionWizardPage</link><br />
 <link topic="isxfunc_ExtractArchive">ExtractArchive</link><br />
 <link topic="isxfunc_ExtractArchive">ExtractArchive</link><br />
 <link topic="isxfunc_CreateOutputProgressPage">CreateOutputProgressPage</link></p></seealso>
 <link topic="isxfunc_CreateOutputProgressPage">CreateOutputProgressPage</link></p></seealso>

+ 0 - 1
setup.iss

@@ -176,7 +176,6 @@ Source: "Examples\CodeClasses.iss"; DestDir: "{app}\Examples"; Flags: ignorevers
 Source: "Examples\CodeDlg.iss"; DestDir: "{app}\Examples"; Flags: ignoreversion touch
 Source: "Examples\CodeDlg.iss"; DestDir: "{app}\Examples"; Flags: ignoreversion touch
 Source: "Examples\CodeDll.iss"; DestDir: "{app}\Examples"; Flags: ignoreversion touch
 Source: "Examples\CodeDll.iss"; DestDir: "{app}\Examples"; Flags: ignoreversion touch
 Source: "Examples\CodeDownloadFiles.iss"; DestDir: "{app}\Examples"; Flags: ignoreversion touch
 Source: "Examples\CodeDownloadFiles.iss"; DestDir: "{app}\Examples"; Flags: ignoreversion touch
-Source: "Examples\CodeDownloadFiles2.iss"; DestDir: "{app}\Examples"; Flags: ignoreversion touch
 Source: "Examples\CodeExample1.iss"; DestDir: "{app}\Examples"; Flags: ignoreversion touch
 Source: "Examples\CodeExample1.iss"; DestDir: "{app}\Examples"; Flags: ignoreversion touch
 Source: "Examples\CodePrepareToInstall.iss"; DestDir: "{app}\Examples"; Flags: ignoreversion touch
 Source: "Examples\CodePrepareToInstall.iss"; DestDir: "{app}\Examples"; Flags: ignoreversion touch
 Source: "Examples\Components.iss"; DestDir: "{app}\Examples"; Flags: ignoreversion touch
 Source: "Examples\Components.iss"; DestDir: "{app}\Examples"; Flags: ignoreversion touch

+ 2 - 2
whatsnew.htm

@@ -70,7 +70,7 @@ Source: "{tmp}\MyProg-ExtraReadmes.7z"; DestDir: "{app}"; \
         </li>
         </li>
       </ul>
       </ul>
     </li>
     </li>
-    <li>Added example script <i>CodeDownloadFiles2.iss</i> demonstrating how to use a single <tt>[Files]</tt> entry to extract a downloaded archive.</li>
+    <li>Updated example script <i>CodeDownloadFiles.iss</i> to demonstrate how to use a single <tt>[Files]</tt> entry to extract a downloaded archive.</li>
     <li>Archive extraction now honors the file system redirection state set by 64-bit install mode, entry flags, and support function <tt>EnableFsRedirection</tt>.</li>
     <li>Archive extraction now honors the file system redirection state set by 64-bit install mode, entry flags, and support function <tt>EnableFsRedirection</tt>.</li>
   </ul>
   </ul>
   </li>
   </li>
@@ -151,7 +151,7 @@ issigtool --key-file="MyKey.ispublickey" verify "MyProg.dll"</pre>
     <li>Pascal Scripting:
     <li>Pascal Scripting:
       <ul>
       <ul>
         <li>Added new <tt>ISSigVerify</tt> support function.</li>
         <li>Added new <tt>ISSigVerify</tt> support function.</li>
-        <li>Added new <tt>AddWithISSigVerify</tt> and <tt>AddExWithISSigVerify</tt> functions to support class <tt>TDownloadWizardPage</tt>. See new example script <i>CodeDownloadFiles2.iss</i> for an example.</li>
+        <li>Added new <tt>AddWithISSigVerify</tt> and <tt>AddExWithISSigVerify</tt> functions to support class <tt>TDownloadWizardPage</tt>. See updated example script <i>CodeDownloadFiles.iss</i> for an example.</li>
       </ul>
       </ul>
     </li>
     </li>
   </ul>
   </ul>