The function adds a remote file to the DwinsHs_DwonloadsList download queue, the file will be downloaded when the DwinsHs_CurPageChanged procedure is executed (the Setup wizard moves to the pre-defined downloading wizard page). You can use the DwinsHs_AppendMirrorFile procedure to add one mirror source, or add multile mirror sources for the remote file in the BeforeDownlaod callback function of the DwinsHs_CurPageChanged procedure.
The function can be used as the value of "Check" parameter of entries in the "[Files]" section. When the "Components" or "Tasks" parameter exists in an entry, the remote file will be downloaded and installed if user selects a component or task from its "Components" or "Tasks" parameter value. Otherwise, the entry will be ignored, and the remote file will not be downloaded.
An entry without a "Components" or "Tasks" parameter is always processed, the remote file will be downloaded always if the DwinsHs_Check) function is used in its "Check" parameter, unless other parameters say it shouldn't be.
Note, the remote files which added by the DwinsHs_Check function will be installed automatically, you don't need to move them using the Pascal script in "[Code]" scetion.
If an entry has contained the "Check" parameter, and you want to download it from the remote server, please concatenate its value and the DwinsHs_Check function using the and operator. Note, please put the DwinsHs_Check function as the final item in the "Check" parameter, because the Inno Setup use short-circuit evaluation in the "Check" parameter.
Please add the external value to the Flags parameter of the file entry which download from remote server.
function DwinsHs_Check(Filename, URL, Agent, Method: string; FileSize, FileSizeHigh: LongInt): Boolean;
Specifies the path and name of the local file the remote file will be saved as.
Specifies the full address of remote file, or specifies the address of server script. the "http", "https" and "ftp" schemes are supported. Optional username, password and port number can be included. For "http" and "https" schemes, an optional parameters string can be included too.
Format:
[<scheme>://][<username>[:<password>]@]<host>[:<port>] [/<path>][?<parameters>]
For example:
http://username:[email protected]:8080/images/file.jpg
https://www.mywebsite.com/license/verify.php?license_key=xxx-xxx-xxx-xxx&license_type=2
ftp://username:[email protected]:2121/images/file.jpg
Specifies the user agent string. Your server can use the string to determine whether the request is sent by your installation package, or determine which installation package sends the request, etc.
Specifies the HTTP methods for an "http" or "https" request. Or the transfer mode for an "ftp" request. The parameter isn't case-sensitive. It can be one of the following values:
Together with the FileSizeHigh parameter specifies the file size in bytes. It will be used to caculate the download progress and remaining time. This avoids delays before the download begins because the script doesn't have to fetch the file size from the server.
For ANSI Inno Setup, the file size will be specified by this parameter alone, the value of FileSizeHigh parameter will be ignored. For UNICODE Inno Setup, this parameter specifies the low 31 bits of the file size, and the FileSizeHigh parameter specifies the high 31 bits of the file size. Note, not 32 bits.
Note, the file size will be fetched from the server if the parameter is set to FILESIZE_QUERY_SERVER (0), FILESIZE_UNKNOWN (-1), or FILESIZE_KEEP_FORMER (-2). In this case, the value of FileSize parameter will be ignored.
Note, only digital value can be used in this parameter, the constant identifier cannot be used.
Together with the FileSize parameter specifies the file size in bytes. It will be used to caculate the download progress and remaining time. This avoids delays before the download begins because the script doesn't have to fetch the file size from the server.
For ANSI Inno Setup, the value of this parameter will be ignored, the file size will be specified by the FileSize parameter alone. For UNICODE Inno Setup, this parameter specifies the high 31 bits of the file size, and the FileSize parameter specifies the low 31 bits of the file size.
Note, the value of this parameter will be ignored if the FileSize parameter is set to FILESIZE_QUERY_SERVER (0), FILESIZE_UNKNOWN (-1), or FILESIZE_KEEP_FORMER (-2).
Note, only digital value can be used in this parameter, the constant identifier cannot be used.
In order to conactenate the function and other check parameter values using the and operator, the function returns true always.
[Files]
...
Source: "{tmp}\main.dll"; DestDir: "{app}"; Flags: external; \
Check: DwinsHs_Check( ExpandConstant('{tmp}\main.dll'), 'http://domain.com/main.dll', \
'My_Setup', 'Get', 0, 0 );
Source: "{tmp}\ext.dll"; DestDir: "{app}"; Flags: external; Components: ext_a ext_b; \
Check: DwinsHs_Check( ExpandConstant('{tmp}\ext.dll'), 'http://domain.com/extension.dll', \
'My_Setup', 'Get', 0, 0 );
Source: "{tmp}\abc.dll"; DestDir: "{app}\abc"; Flags: external; \
Check: DirCheck(ExpandConstant('{app}\abc')) and \
DwinsHs_Check( ExpandConstant('{tmp}\abc.dll'), 'http://domain.com/abc.dll', \
'My_Setup', 'Get', 0, 0 );
Source: "{tmp}\a.exe"; DestDir: "{app}"; Flags: external; Tasks: install_a; \
Check: DwinsHs_Check( ExpandConstant('{tmp}\a.exe'), 'http://domain.com/a.exe', \
'My_Setup', 'Get', 0, 0 );
...
The function is avaliable only when the DwinsHs_Use_Predefined_Downloading_WizardPage marco is defined.
Copyright © 2001-2022, Han-soft Corporation. All rights reserved.