⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 filezilla.nsi

📁 一个FTP下载的源代码。代码质量非常高
💻 NSI
📖 第 1 页 / 共 3 页
字号:
;FileZilla install script
;written by Tim Kosse (mailto:tim.kosse@gmx.de)
;Compatible with NSIS Modern UI version 1.67
;Based upon example scripts from Joost Verburg

;--------------------------------
;Include Modern UI
  
  !include "MUI.nsh"
  !include "Sections.nsh"
  !define MUI_LICENSEPAGE_BGCOLOR /grey

;--------------------------------
;Product information

  !define MUI_PRODUCT "FileZilla" ;Define your own software name here
  !define MUI_VERSION "2.2.3" ;Define your own software version here
  Name "${MUI_PRODUCT} ${MUI_VERSION}"

!define SOURCE_LOCATION "http://filezilla.sourceforge.net/install_data/mirror.php?v=2_2_3&t=src"
!define SOURCE_PACKAGE_FILE "FileZilla_2_2_3_src.zip"

!define FRENCH_DOCUMENTATION_LOCATION "http://filezilla.sourceforge.net/install_data/french_documentation/mirror.php"
!define FRENCH_DOCUMENTATION_PACKAGE_FILE "french_documentation.zip"

;--------------------------------
;Configuration

  ;Preprocessing of input files
  !system 'upx --best --crp-ms=100000 -f -q ..\release\filezilla.exe'
  !system 'upx --best --crp-ms=100000 -f -q "..\LanguageDLLs\German\release\FzResDe.dll"' ignore
  !system 'upx --best --crp-ms=100000 -f -q "..\LanguageDLLs\French\release\FzResFr.dll"' ignore
  !system 'upx --best --crp-ms=100000 -f -q "..\LanguageDLLs\Spanish\release\FzResEs.dll"' ignore
  !system 'upx --best --crp-ms=100000 -f -q "..\LanguageDLLs\Italian\release\FzResIt.dll"' ignore
  !system 'upx --best --crp-ms=100000 -f -q "..\LanguageDLLs\Korean\release\FzResKr.dll"' ignore
  !system 'upx --best --crp-ms=100000 -f -q "..\LanguageDLLs\Polish\release\FzResPo.dll"' ignore
  !system 'upx --best --crp-ms=100000 -f -q "..\LanguageDLLs\TraditionalChinese\release\FzResCh.dll"' ignore
  !system 'upx --best --crp-ms=100000 -f -q "..\LanguageDLLs\Bulgarian\release\FzResBu.dll"' ignore
  !system 'upx --best --crp-ms=100000 -f -q "..\LanguageDLLs\Hungarian\release\FzResHu.dll"' ignore
  !system 'upx --best --crp-ms=100000 -f -q "..\LanguageDLLs\SimplifiedChinese\release\FzResChs.dll"' ignore
  !system 'upx --best --crp-ms=100000 -f -q "..\LanguageDLLs\Japanese\release\FzResJp.dll"' ignore
  !system 'upx --best --crp-ms=100000 -f -q "..\LanguageDLLs\Russian\release\FzResRu.dll"' ignore
  !system 'upx --best --crp-ms=100000 -f -q dbghelp.dll' ignore
  !system 'upx --best --crp-ms=100000 -f -q ..\FzSFtp\Release\FzSFtp.exe' ignore
  !packhdr temp.dat "upx.exe --best --crp-ms=100000 temp.dat"

  ;General
  OutFile "../../FileZilla_setup.exe"

  SetOverwrite on
  AutoCloseWindow false
  ShowInstDetails show
  ShowUninstDetails show

  ;Folder selection page
  InstallDir "$PROGRAMFILES\${MUI_PRODUCT}"

  InstallDirRegKey HKCU "Software\${MUI_PRODUCT}" "Install_Dir"

  ;Remember the Start Menu Folder
  !define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKCU" 
  !define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\${MUI_PRODUCT}" 
  !define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder"
  !define MUI_STARTMENUPAGE_DEFAULTFOLDER "FileZilla"

  !define MUI_LANGDLL_ALWAYSSHOW
  !define MUI_LANGDLL_REGISTRY_ROOT      "HKCU"
  !define MUI_LANGDLL_REGISTRY_KEY       "software\${MUI_PRODUCT}"
  !define MUI_LANGDLL_REGISTRY_VALUENAME "Installer Language"

  !define TEMP $R0
 
;--------------------------------
;Modern UI Configuration
  
  !define MUI_ICON "..\res\filezilla.ico"
  !define MUI_UNICON "uninstall.ico"

  !define MUI_ABORTWARNING

;--------------------------------
; Variables

  Var STARTMENU_FOLDER
  Var MUI_TEMP
  VAR IO_HWND
  
;--------------------------------
;Pages

  !insertmacro MUI_PAGE_LICENSE "license.txt"
  !insertmacro MUI_PAGE_COMPONENTS
  !insertmacro MUI_PAGE_DIRECTORY
  !insertmacro MUI_PAGE_STARTMENU Application $STARTMENU_FOLDER
  Page custom Settings SettingsEnd
  Page custom DownloadOptions DownloadOptionsEnd
  !insertmacro MUI_PAGE_INSTFILES

  !insertmacro MUI_UNPAGE_CONFIRM
  !insertmacro MUI_UNPAGE_INSTFILES

;--------------------------------
;Languages

  ;English
  !insertmacro MUI_LANGUAGE "English"
  !include "..\LanguageDLLs\English\fz_english.nsh"

  ;Bulgarian
  !insertmacro MUI_LANGUAGE "Bulgarian"
  !include "..\LanguageDLLs\Bulgarian\fz_bulgarian.nsh"

  ;French
  !insertmacro MUI_LANGUAGE "French"
  !include "..\LanguageDLLs\French\fz_french.nsh"

  ;German
  !insertmacro MUI_LANGUAGE "German"
  !include "..\LanguageDLLs\German\fz_german.nsh"

  ;Hungarian
  !insertmacro MUI_LANGUAGE "Hungarian"
  !include "..\LanguageDLLs\Hungarian\fz_hungarian.nsh"

  ;Italian
  !insertmacro MUI_LANGUAGE "Italian"
  !include "..\LanguageDLLs\Italian\fz_italian.nsh"

  ;Polish
  !insertmacro MUI_LANGUAGE "Polish"
  !include "..\LanguageDLLs\Polish\fz_polish.nsh"

  ;Simplified Chinese
  !insertmacro MUI_LANGUAGE "SimpChinese"
  !include "..\LanguageDLLs\SimplifiedChinese\fz_simpchinese.nsh"

  ;Traditional Chinese
  !insertmacro MUI_LANGUAGE "TradChinese"
  !include "..\LanguageDLLs\TraditionalChinese\fz_tradchinese.nsh"
 
  ;Japanese
  !insertmacro MUI_LANGUAGE "Japanese"
  !include "..\LanguageDLLs\Japanese\fz_japanese.nsh"
 
  ;Russion
  !insertmacro MUI_LANGUAGE "Russian"
  !include "..\LanguageDLLs\Russian\fz_russian.nsh"
 
;--------------------------------
;Reserve Files

  ;Things that need to be extracted on first (keep these lines before any File command!)
  ;Only useful for BZIP2 compression
 
  !insertmacro MUI_RESERVEFILE_LANGDLL
 
  ReserveFile "download.ini"
  ReserveFile "settings.ini"
  !insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
  ReserveFile "${NSISDIR}\Plugins\NSISdl.dll"
  ReserveFile "${NSISDIR}\Plugins\ZipDLL.dll"

;--------------------------------
;Installer Sections

InstType $(InstTypeStandardName)
InstType $(InstTypeFullName)

Section !$(SecFileZillaName) SecFileZilla
SectionIn 1 2 RO

  ; Set output path to the installation directory.
  SetOutPath $INSTDIR
  ; Put file there
  File "..\release\FileZilla.exe"
  
  ;Delete gssapi.dll if it belongs to an old FileZilla version
  IfFileExists "$INSTDIR\FileZilla.exe" "" +2
  Delete "$INSTDIR\GSSApi.dll"

  File "FzGSS.dll"
  File "dbghelp.dll"
  File "..\openssl\ssleay32.dll"
  File "..\openssl\libeay32.dll"
  File "..\FzSFtp\Release\FzSFtp.exe"
  File "..\..\readme.htm"
  File "..\..\GPL.html"
  File "..\..\puttylicense.html"
  File "..\..\legal.htm"
  ; Write the installation path into the registry
  WriteRegStr HKCU SOFTWARE\FileZilla "Install_Dir" "$INSTDIR"
  WriteRegStr HKLM SOFTWARE\FileZilla "Install_Dir" "$INSTDIR"
  ; Write the uninstall keys for Windows
  WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\FileZilla" "DisplayName" "FileZilla (remove only)"
  WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\FileZilla" "UninstallString" '"$INSTDIR\uninstall.exe"'
 
  ;Create the uninstaller
  WriteUninstaller uninstall.exe
  
  ; Check for /secure parameter
  Call GetParameters
  Push "/secure"
  Call StrStr
  Pop $R1
  StrCpy $R1 $R1 7
  StrCmp $R1 "/secure" secure

  ; Skip "run in secure mode" question if running in silent mode
  
  IfSilent NoSecure

  !insertmacro MUI_INSTALLOPTIONS_READ $R1 settings.ini "Field 2" State
  strcmp $R1 "1" "" NoSecure
 secure:
  WriteRegStr HKLM "Software\FileZilla" "Run in Secure Mode" 1
  WriteRegStr HKCU "Software\FileZilla" "Run in Secure Mode" 1
  goto SecureDone
 NoSecure:
  WriteRegStr HKLM "Software\FileZilla" "Run in Secure Mode" 0
  WriteRegStr HKCU "Software\FileZilla" "Run in Secure Mode" 0
 SecureDone:

  ; Check for /registry parameter
  Call GetParameters
  Push "/registry"
  Call StrStr
  Pop $R1
  StrCpy $R1 $R1 9
  StrCmp $R1 "/registry" useregistry

  ; Check for /forceregistry parameter
  Call GetParameters
  Push "/forceregistry"
  Call StrStr
  Pop $R1
  StrCpy $R1 $R1 14
  StrCmp $R1 "/forceregistry" forceregistry

  ; Skip storage question if running in silent mode
  IfSilent usexml
  
  !insertmacro MUI_INSTALLOPTIONS_READ $R1 settings.ini "Field 5" State
  strcmp $R1 "1" usexml
  !insertmacro MUI_INSTALLOPTIONS_READ $R1 settings.ini "Field 7" State
  strcmp $R1 "1" forceregistry
 useregistry:
  WriteRegStr HKLM "Software\FileZilla" "Use Registry" 1
  WriteRegStr HKCU "Software\FileZilla" "Use Registry" 1
  goto storagedone
 forceregistry:
  WriteRegStr HKLM "Software\FileZilla" "Use Registry" 2
  WriteRegStr HKCU "Software\FileZilla" "Use Registry" 2
  goto storagedone
 usexml:
  WriteRegStr HKLM "Software\FileZilla" "Use Registry" 0
  WriteRegStr HKCU "Software\FileZilla" "Use Registry" 0
 storagedone:

SectionEnd

SubSection /e $(SecDocumentationName) SecDocumentation

  Section $(SecEnglishDocumentationName) SecEnglishDocumentation
    SectionIn 1 2
    SetOutPath $INSTDIR
    File "..\documentation\FileZilla.chm"
    StrCpy $1 "documentation"
  SectionEnd

  Section $(SecFrenchDocumentationName) SecFrenchDocumentation
    SectionIn 2
    AddSize 241

    Push $0
    Push $1

    SetOutPath $INSTDIR
    StrCpy $0 ${FRENCH_DOCUMENTATION_PACKAGE_FILE}
    StrCpy $1 ${FRENCH_DOCUMENTATION_LOCATION}
    StrCpy $2 $INSTDIR

    call DownloadAndExtract
    Pop $2
    StrCmp $2 success "" french_documentation_failure
    StrCpy $2 "french_documentation"
    goto french_documentation_end
   french_documentation_failure:
    StrCpy $2 ""
   french_documentation_end:

   Pop $1
   Pop $0

  SectionEnd

SubSectionEnd

Section $(SecLangFilesName) SecLangFiles
SectionIn 1 2
  SetOutPath $INSTDIR
  File "..\LanguageDLLs\Bulgarian\release\FzResBu.dll"
  File "..\LanguageDLLs\SimplifiedChinese\release\FzResChs.dll"
  File "..\LanguageDLLs\TraditionalChinese\release\FzResCh.dll"
  File "..\LanguageDLLs\German\release\FzResDe.dll"
  File "..\LanguageDLLs\Spanish\release\FzResEs.dll"
  File "..\LanguageDLLs\French\release\FzResFr.dll"
  File "..\LanguageDLLs\Hungarian\release\FzResHu.dll"
  File "..\LanguageDLLs\Italian\release\FzResIt.dll"
  File "..\LanguageDLLs\Japanese\release\FzResJp.dll"
  File "..\LanguageDLLs\Korean\release\FzResKr.dll"
  File "..\LanguageDLLs\Polish\release\FzResPo.dll"
  File "..\LanguageDLLs\Russian\release\FzResRu.dll"

  ;Write language for FileZilla into the registry
  Call WriteLanguage

SectionEnd

Section $(SecSourceCodeName) SecSourceCode
  SectionIn 2
  AddSize 4300

  Push $1
  Push $2

  SetOutPath $INSTDIR
  StrCpy $0 ${SOURCE_PACKAGE_FILE}
  StrCpy $1 ${SOURCE_LOCATION}
  StrCpy $2 $INSTDIR

  call DownloadAndExtract
  Pop $0
  StrCmp $0 success "" source_failure

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -