最新消息:

Nsisunz是NSIS提取ZIP压缩包文件解压zip文件的插件

nsis 永恒心锁 4542浏览 0评论
/*
Nsisunz是NSIS提取ZIP压缩包文件解压zip文件的插件
Nsisunz允许你解压zip压缩文档,当你使用nsisdl从网上下载一个zip压缩文件的时候,你可以使用此插件将zip压缩文档解压至相应目录.
Nsisunz暂不支持使用密码保护的zip压缩文档,解压指定的压缩文件可以使用/file参数选项.
Nsisunz当使用/text参数的时候%f用于表示文件名,%c表示压缩包大小,%u表示各个文件的压缩大小.
*/
!addplugindir ".Release"
OutFile "nsisunz_test.exe"
Name "NSIS Unzip plug-in test"
Caption "NSIS Unzip plug-in test"
ShowInstDetails show
XPStyle on
CompletedText "Extracted!"
SubCaption 3 " - Extracting files"
SubCaption 4 " - Extracted"
LoadLanguageFile "${NSISDIR}ContribLanguage filesenglish.nlf"
; Installer pages
Page custom onZipPageShow onZipPageLeave " - Select Zip file"
Page instfiles
; Localized strings for use with nsisunz
; The '%f' in the string is replaced with the filename on run-time.
; "%c", "%u", "%p" and "%p" is replaced with compressed size,
; uncompressed size, percent complete (with "%") and byte complete
; respectively.
LangString nsisunz_text ${LANG_ENGLISH} "Extract: %f (%c -> %b) [%p]"
Function .onInit
 InitPluginsDir
 File "/oname=$PLUGINSDIRzippage.ini" "zippage.ini"
FunctionEnd
Function onZipPageShow
 ; Turn Text control into a button (HM NIS Edit v2.0b5 does not support "Button" type).
 WriteINIStr "$PLUGINSDIRzippage.ini" "Field 12" "Type" "Button"
 WriteINIStr "$PLUGINSDIRzippage.ini" "Field 12" "Flags" "NOTIFY"
 InstallOptions::dialog "$PLUGINSDIRzippage.ini"
FunctionEnd
Function onZipPageLeave
; $R0 = zip filename $R1 = dest. folder
 ReadINIStr $R0 "$PLUGINSDIRzippage.ini" "Field 4" "State"
 ReadINIStr $R1 "$PLUGINSDIRzippage.ini" "Field 6" "State"
 ; Remove trailing backslash if any
 StrCpy $0 $R1 1 -1
 StrCmp "$0" "" 0 notneeded
 StrCpy $R1 $R1 -1
 notneeded:
 IfFileExists $R0 checkdir
 MessageBox MB_ICONEXCLAMATION|MB_OK 'The file "$R0" does not exist!'
 Abort ;return to page
 checkdir:
 IfFileExists $R1*.* unzip
 MessageBox MB_ICONEXCLAMATION|MB_YESNO 'The folder "$R1" does not exist!$r$nDo you wish to create it?' IDNO skipcreate
 CreateDirectory $R1
 Goto unzip
 skipcreate:
 Abort ;return to page
 unzip:
; Just fall of the end, so the sections can be executed
FunctionEnd
Section -pre
 DetailPrint "ZIP file: $R0"
 DetailPrint "Dest. folder: $R1"
SectionEnd
Section
; Check if the checkbox is checked and if it is, then don't extract paths
 ReadINIStr $R2 "$PLUGINSDIRzippage.ini" "Field 7" "State"
 StrCmp $R2 "1" 0 usepaths
 nsisunz::UnzipToLog /text "$(nsisunz_text)" /noextractpath $R0 $R1
 Goto check
 usepaths:
 nsisunz::UnzipToLog /text "$(nsisunz_text)" $R0 $R1
 check:
; Always check for errors. Everything else than "success" means an error.
 Pop $0
 StrCmp $0 "success" ok
 Abort "$0"
 ok:
SectionEnd
免责声明:根据《计算机软件保护条例》第十七条规定“为了学习和研究软件内含的设计思想和原理,通过安装、显示、传输或者存储软件等方式使用软件的,可以不经软件著作权人许可,不向其支付报酬。”您需知晓本站所有内容资源均来源于网络,仅供用户交流学习与研究使用,版权归属原版权方所有,版权争议与本站无关,用户本人下载后不能用作商业或非法用途,需在24个小时之内从您的电脑中彻底删除上述内容,否则后果均由用户承担责任;如果您访问和下载此文件,表示您同意只将此文件用于参考、学习而非其他用途,否则一切后果请您自行承担,如果您喜欢该程序,请支持正版软件,购买注册,得到更好的正版服务。丨本站为个人博客非盈利性站点,所有软件信息均来自网络,所有资源仅供学习参考研究目的,并不贩卖软件,不存在任何商业目的及用途。丨本文采用知识共享 署名4.0国际许可协议 [BY-NC-SA] 进行授权BY-NC-SA协议进行授权

转载请注明:永恒心锁-分享互联网 » Nsisunz是NSIS提取ZIP压缩包文件解压zip文件的插件

您必须 登录 才能发表评论!