NSIS 打包(二)InetLoad::load下载文件
InetLoad::load
InetLoad::load [/PROXY IP:PORT] [/USERNAME PROXY_LOGIN /PASSWORD PROXY_PASSWD]
[/NOPROXY] [/NOCANCEL] [/POST TEXT2POST] [/TIMEOUT INT_MS] [/SILENT TEXT2DISPLAY]
[/RESUME RETRY_QUESTION] [/POPUP PREFIX | /BANNER CAPTION TEXT] [/TRANSLATE LANG_PARAMS]
URL1 local_file1 [URL2 local_file2 [...]] [/END]
- /PROXY
- Overwrites current proxy settings, not required in most cases. IE settings will be used by default.
- /USERNAME
- Proxy username (http only).
- /PASSWORD
- Proxy password (http only). For server (http/ftp) authentication it is possible to use URL encoded name and password, for example http://username:password@nsis.sourceforge.net.
- /NOPROXY
- Disables proxy settings for this connection (if any)
- /NOCANCEL
- Prevents download from being interrupted by user (locks Esc, Alt-F4, Cancel handling)
- /POST
- Sets POST http mode and defines text string to be used in the POST (http only). Disables auto re-get. No char replaces used (%20 and others).
- /TIMEOUT
- Sets INTERNET_OPTION_CONNECT_TIMEOUT, milliseconds, default - IE current parameter value.
- /SILENT
- Key hides plug-in' output (both popup dialog and embedded progress bar). Sets TEXT2DISPLAY to 1006 control, if /silent "" - displays "InetLoad plug-in" default. Not required if 'SilentInstall silent' mode was defined in script (NSIS 2.03 option).
- /RESUME
- On the permanent connection/transfer error instead of exit first displays message box with "resume download" question. Useful for dial-up connections and big files - allows user to restore connection and resume download. Default is "Your internet connection seems to have dropped out!\nPlease reconnect and click Retry to resume downloading...".
- /POPUP
- This mode displays detailed download dialog instead of embedded progress bar. PREFIX parameter sets left part of dialog caption (before '-'), default is "InetLoad plug-in" (if ""). Also useful in .onInit function (i.e. not in Section).
- /BANNER
- Displays simple popup dialog (MSI Banner mode) and sets dialog CAPTION ("NSIS Installer - InetLoad" is default) and TEXT (up to 3 lines using $\n).
- /END
- Allows to limit plug-in stack reading (optional, required if you stores other vars in the stack).
- /TRANSLATE
- Allows translating plug-in text in the POPUP or "old style" (NSISdl) modes (see Readme for parameters). In the BANNER mode text is also customizable.
Examples
InetLoad::load "http://dl.zvuki.ru/6306/mp3/12.mp3" "$EXEDIR\12.mp3" \
"ftp://dl.zvuki.ru/6306/mp3/11.mp3" "$EXEDIR\11.mp3"
Pop $0
InetLoad::load /BANNER "" "Cameron Diaz download in progress..." \
"http://www.dreamgirlswallpaper.co.uk/fiveyearsonline/wallpaper/Cameron_Diaz/camerond09big.JPG" \
"$EXEDIR\cd.jpg"
Pop $0
StrCmp $0 "OK" dlok
MessageBox MB_OK|MB_ICONEXCLAMATION "Download Error, click OK to abort installation" /SD IDOK
Abort
dlok:
...
下载地址:http://nsis.sourceforge.net/InetLoad_plug-in
MD5 plugin
OutFile "md5test.exe"
Section ""
#generate MD5sum of string
md5dll::GetMD5String "md5me"
Pop $0
DetailPrint "md5: [$0]"
# generate MD5sum of file
md5dll::GetMD5File "${NSISDIR}\makensis.exe"
Pop $0
DetailPrint "md5: [$0]"
#generate random MD5sum
md5dll::GetMD5Random
Pop $0
DetailPrint "md5: [$0]"
SectionEnd
下载地址:http://nsis.sourceforge.net/MD5_plugin
设定压缩比
SetCompressor
[/SOLID] [/FINAL] \\zlib\\|bzip2|lzma
该命令设置了安装程序压缩文件、数据使用的压缩算法。该命令只能在区段、函数之外或在任何数据被压缩之前使用。不同的压缩方式不能在同一个安装程序里用来压缩不同的文件。建议在脚本的开始处使用这个命令来尽可能避免编译错误。
支持三种压缩方式: ZLIB, BZIP2 和 LZMA 。
ZLIB (默认) 使用压缩算法,是一个快速简单的方法。默认的压缩级别它消耗大约 300 KB 内存。
BZIP2 通常比 ZLIB 的压缩率好,但是稍微慢了一点并且内存的使用也多一点。默认的压缩级别它消耗大约 4 MB 内存。
LZMA 是一个压缩率比较理想的新式压缩方式。它的解压速度非常快(在 2 GHz 的 CPU 上能达到 10-20 MB/s 的速度),但是压缩速度很慢。解压时内存的使用量是字典的大小加上一些 KB ,默认值为 8 MB 。
如果使用了 /FINAL ,则 SetCompressor 后来的调用都会被忽略。
如果使用了 /SOLID 的话,所有的数据将被压缩在一个区块里,这样可以提高压缩率。
NSIS打包相关: