!include "StrFunc.nsh" !include "WordFunc.nsh" ${StrRep} ${StrStr} !include "LogicLib.nsh" !include "nsDialogs.nsh" !include "common.nsh" !include "x64.nsh" !include "MUI2.nsh" !include "WinVer.nsh" !include "commonfunc.nsh" !define MB_OK 0x00000000L !include "FileFunc.nsh" VIProductVersion "${PRODUCT_VERSION}" VIAddVersionKey "ProductVersion" "${PRODUCT_VERSION}" VIAddVersionKey "ProductName" "${PRODUCT_NAME}" VIAddVersionKey "CompanyName" "${PRODUCT_PUBLISHER}" VIAddVersionKey "FileVersion" "${PRODUCT_VERSION}" VIAddVersionKey "InternalName" "${EXE_NAME}" VIAddVersionKey "FileDescription" "${PRODUCT_NAME}" VIAddVersionKey "LegalCopyright" "${PRODUCT_LEGAL}" !define INSTALL_PAGE_REG 0 !define INSTALL_PAGE_CONFIG 1 ;!define INSTALL_PAGE_LICENSE 1 !define INSTALL_PAGE_PROCESSING 2 !define INSTALL_PAGE_FINISH 3 !define INSTALL_PAGE_UNISTCONFIG 4 !define INSTALL_PAGE_UNISTPROCESSING 5 !define INSTALL_PAGE_UNISTFINISH 6 Page custom DUIPage UninstPage custom un.DUIPage Var hInstallDlg Var hInstallSubDlg Var sSetupPath Var sReserveData Var InstallState Var UnInstallValue Var basedir Var datadir Var logError Var buildModelPath Var profilePath Var buildCallPath Var dbpath Var logpath Var binPath Var javaPath Var OLD_VER Var vc_flag Var IREAL_PATH Var SMART3D_PATH Var reboot_flag Var update !include "ui_laser_lang.nsi" Function SelectLanguage ;根据windowsapi返回值选择语言,不支持语言默认显示英文 System::Call 'Kernel32::GetUserDefaultUILanguage() i.r0' ${If} $0 == '1033' StrCpy $LANGUAGE 1033 ${ElseIf} $0 == '1041' StrCpy $LANGUAGE 1041 ${ElseIf} $0 == '1042' StrCpy $LANGUAGE 1042 ${ElseIf} $0 == '2052' StrCpy $LANGUAGE 2052 ${Else} StrCpy $LANGUAGE 1033 ${EndIf} FunctionEnd Function langSelectPush Push "" ; Start dynamic language pushing StrCpy $0 0 ; Get the length of LANG_LIST StrLen $1 ${LANG_LIST} loop: ; If we reached the end of the list, exit the loop IntCmp $0 $1 done ; Get the next language code (2 characters) StrCpy $2 ${LANG_LIST} 2 $0 ; Determine the language and push its code and name ${If} $2 == "zh" Push ${LANG_SIMPCHINESE} Push "简体中文" ${ElseIf} $2 == "en" Push ${LANG_ENGLISH} Push "English" ${ElseIf} $2 == "ja" Push ${LANG_JAPANESE} Push "日本語" ${ElseIf} $2 == "kr" Push ${LANG_KOREAN} Push "한국어" ${ElseIf} $2 == "" Goto done ${EndIf} ; Move to the next language code in the list IntOp $0 $0 + 3 ; Loop again Goto loop done: FunctionEnd ;在安装程序运行前的回调函数前实现 Function .onInit ;Debug::Watcher Call SelectLanguage Call checkInstall Call langSelectPush ;MessageBox mb_ok "$0-------$LANGUAGE" Push A ; A means auto count languages for the auto count to work the first empty push (Push "") must remain ${If} $LANGUAGE == '2052' LangDLL::LangDialog "安装程序语言" "请选择安装程序的语言" ;显示语言选择对话框 ${ElseIf} $LANGUAGE == '1033' LangDLL::LangDialog "Installer Language" "Please select the language of the installer" ;显示语言选择对话框 ${ElseIf} $LANGUAGE == '1041' LangDLL::LangDialog "インストーラ言語" "インストーラの言語を選択してください" ;显示语言选择对话框 ${ElseIf} $LANGUAGE == '1042' LangDLL::LangDialog "설치 프로그램 언어" "설치 프로그램의 언어를 선택하십시오" ;显示语言选择对话框 ${Else} LangDLL::LangDialog "Installer Language" "Please select the language of the installer" ;显示语言选择对话框 ${EndIf} Pop $LANGUAGE ;获得用户对于语言的选择结果 ‘$LANGUAGE’是多语言变量,在安装程序结束后,语言代码会存储在这个变量中,手动修改‘$LANGUAGE’的值后,安装包会重新选择最匹配的语言,参考最上面NSIS手册中选择界面语言步骤 StrCmp $LANGUAGE "cancel" 0 +2 Abort ${If} $LANGUAGE == '1033' Call startCheckEn ${ElseIf} $LANGUAGE == '1041' Call startCheckJp ${ElseIf} $LANGUAGE == '1042' Call startCheckKr ${ElseIf} $LANGUAGE == '2052' Call startCheck ${Else} Call startCheckEn ${EndIf} FunctionEnd Function checkInstall System::Call 'kernel32::CreateMutexA(i 0, i 0, t"Winsnap_installer") i .r1 ?e' Pop $R0 StrCmp $R0 0 SKIP RUN RUN: ${If} $LANGUAGE == '1033' System::Call 'USER32::MessageBox(i $hwndparent, t "An installation wizard is already running, please do not turn it on repeatedly.", t "4DKanKan offline Version", i ${MB_OK})i .r1' Abort ${ElseIf} $LANGUAGE == '1041' System::Call 'USER32::MessageBox(i $hwndparent, t "インストールが既に起動されています。重複起動を避けてください。", t "4DKanKan offline Version", i ${MB_OK})i .r1' Abort ${ElseIf} $LANGUAGE == '1042' System::Call 'USER32::MessageBox(i $hwndparent, t "설치 마법사가 이미 실행 중입니다. 반복적으로 켜지 마십시오.", t "4DKanKan offline Version", i ${MB_OK})i .r1' Abort ${ElseIf} $LANGUAGE == '2052' System::Call 'USER32::MessageBox(i $hwndparent, t "有一个安装向导已经运行,请勿重复打开。", t "3D数字化重建", i ${MB_OK})i .r1' Abort ${Else} System::Call 'USER32::MessageBox(i $hwndparent, t "An installation wizard is already running, please do not turn it on repeatedly.", t "4DKanKan offline Version", i ${MB_OK})i .r1' Abort ${EndIf} Goto END SKIP: Goto END END: FunctionEnd Function startCheck StrCpy $update "1" ${IfNot} ${AtLeastWin10} System::Call 'USER32::MessageBox(i $hwndparent, t "本程序只能安装在windows-10(64位)系统及以上", t "3D数字化重建", i ${MB_OK})i .r1' Abort ${EndIf} SetRegView 64 ReadRegStr $OLD_VER HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_PATHNAME}" "DisplayVersion" ${IF} $OLD_VER != "" ${VersionCompare} $OLD_VER ${PRODUCT_VERSION} $R0 ${If} $R0 == "0" System::Call 'USER32::MessageBox(i $hwndparent, t "版本 $OLD_VER 已安装在计算机中。如需重新安装,请卸载已有的安装", t "3D数字化重建", i ${MB_OK})i .r1' Quit ${EndIf} ${If} $R0 == "1" System::Call 'USER32::MessageBox(i $hwndparent, t "版本 $OLD_VER 已安装在计算机中。如需重新安装,请卸载已有的安装", t "3D数字化重建", i ${MB_OK})i .r1' Quit ${EndIf} ${If} $R0 == "2" System::Call 'USER32::MessageBox(i $hwndparent, t "您安装的版本是 ${PRODUCT_VERSION} ,高于版本 $OLD_VER,可以执行更新操作", t "3D数字化重建", i ${MB_OK})i .r1' StrCpy $update "0" ${EndIf} ${EndIf} FunctionEnd Function startCheckEn StrCpy $update "1" ${IfNot} ${AtLeastWin10} System::Call 'USER32::MessageBox(i $hwndparent, t "This program can only be installed on Windows 10 (64-bit) and updated systems.", t "4DKanKan offline Version", i ${MB_OK})i .r1' Abort ${EndIf} SetRegView 64 ReadRegStr $OLD_VER HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_PATHNAME}" "DisplayVersion" ${IF} $OLD_VER != "" ${VersionCompare} $OLD_VER ${PRODUCT_VERSION} $R0 ${If} $R0 == "0" System::Call 'USER32::MessageBox(i $hwndparent, t "Version $OLD_VER is installed on the computer. To reinstall,please uninstall the existing version first.", t "4DKanKan offline Version", i ${MB_OK})i .r1' Quit ${EndIf} ${If} $R0 == "1" System::Call 'USER32::MessageBox(i $hwndparent, t "Version $OLD_VER is installed on the computer. To reinstall,please uninstall the existing version first.", t "4DKanKan offline Version", i ${MB_OK})i .r1' Quit ${EndIf} ${If} $R0 == "2" System::Call 'USER32::MessageBox(i $hwndparent, t "The version you are installing is ${PRODUCT_VERSION}, which is newer than version $OLD_VER, and it can perform the updated operation", t "4DKanKan offline Version", i ${MB_OK})i .r1' StrCpy $update "0" ${EndIf} ${EndIf} FunctionEnd Function startCheckKr StrCpy $update "1" ${IfNot} ${AtLeastWin10} System::Call 'USER32::MessageBox(i $hwndparent, t "このプログラムは、 Windows-10(64ビット)システム以上にのみインストールできます。", t "4DKanKan offline Version", i ${MB_OK})i .r1' Abort ${EndIf} SetRegView 64 ReadRegStr $OLD_VER HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_PATHNAME}" "DisplayVersion" ${IF} $OLD_VER != "" ${VersionCompare} $OLD_VER ${PRODUCT_VERSION} $R0 ${If} $R0 == "0" System::Call 'USER32::MessageBox(i $hwndparent, t "$OLD_VER 버전이 컴퓨터에 설치되어 있습니다.다시 설치하려면 먼저 기존 버전을 제거하십시오.", t "4DKanKan offline Version", i ${MB_OK})i .r1' Quit ${EndIf} ${If} $R0 == "1" System::Call 'USER32::MessageBox(i $hwndparent, t "$OLD_VER 버전이 컴퓨터에 설치되어 있습니다.다시 설치하려면 먼저 기존 버전을 제거하십시오.", t "4DKanKan offline Version", i ${MB_OK})i .r1' Quit ${EndIf} ${If} $R0 == "2" System::Call 'USER32::MessageBox(i $hwndparent, t "설치하는 버전은 $OLD_VER 버전보다 최신 버전인 ${PRODUCT_VERSION} 이며 업데이트된 작업을 수행할 수 있습니다.", t "4DKanKan offline Version", i ${MB_OK})i .r1' StrCpy $update "0" ${EndIf} ${EndIf} FunctionEnd Function startCheckJp StrCpy $update "1" ${IfNot} ${AtLeastWin10} System::Call 'USER32::MessageBox(i $hwndparent, t "このプログラムは、 Windows-10(64ビット)システム以上にのみインストールできます。", t "4DKanKan offline Version", i ${MB_OK})i .r1' Abort ${EndIf} SetRegView 64 ReadRegStr $OLD_VER HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_PATHNAME}" "DisplayVersion" ${IF} $OLD_VER != "" ${VersionCompare} $OLD_VER ${PRODUCT_VERSION} $R0 ${If} $R0 == "0" System::Call 'USER32::MessageBox(i $hwndparent, t "バージョン $OLD_VER が既にインストールされていました。再インストールするには、既存のインストールをアンインストールしてください。", t "4DKanKan offline Version", i ${MB_OK})i .r1' Quit ${EndIf} ${If} $R0 == "1" System::Call 'USER32::MessageBox(i $hwndparent, t "バージョン $OLD_VER が既にインストールされていました。再インストールするには、既存のインストールをアンインストールしてください。", t "4DKanKan offline Version", i ${MB_OK})i .r1' Quit ${EndIf} ${If} $R0 == "2" System::Call 'USER32::MessageBox(i $hwndparent, t "現在インストールのバージョン:${PRODUCT_VERSION}、バージョン $OLD_VER より新しいです。アップデートが可能です。", t "4DKanKan offline Version", i ${MB_OK})i .r1' StrCpy $update "0" ${EndIf} ${EndIf} FunctionEnd Function un.checkInstall SetRegView 64 # 调用PowerShell命令添加排除目录 nsExec::ExecToStack 'powershell -Command "Add-MpPreference -ExclusionPath "$PLUGINSDIR""' nsExec::ExecToStack 'powershell -Command "Add-MpPreference -ExclusionPath "$EXEDIR""' ReadRegStr $LANGUAGE HKLM "Software\${PRODUCT_PATHNAME}" "language" System::Call 'kernel32::CreateMutexA(i 0, i 0, t"Winsnap_installer") i .r1 ?e' Pop $R0 StrCmp $R0 0 SKIP RUN RUN: ${If} $LANGUAGE == '1033' System::Call 'USER32::MessageBox(i $hwndparent, t "An installation wizard is already running, please do not turn it on repeatedly.", t "4DKanKan offline Version", i ${MB_OK})i .r1' Abort ${ElseIf} $LANGUAGE == '1041' System::Call 'USER32::MessageBox(i $hwndparent, t "インストールが既に起動されています。重複起動を避けてください。", t "4DKanKan offline Version", i ${MB_OK})i .r1' Abort ${ElseIf} $LANGUAGE == '1042' System::Call 'USER32::MessageBox(i $hwndparent, t "설치 마법사가 이미 실행 중입니다. 반복적으로 켜지 마십시오.", t "4DKanKan offline Version", i ${MB_OK})i .r1' Abort ${ElseIf} $LANGUAGE == '2052' System::Call 'USER32::MessageBox(i $hwndparent, t "有一个安装向导已经运行,请勿重复打开。", t "3D数字化重建", i ${MB_OK})i .r1' Abort ${Else} System::Call 'USER32::MessageBox(i $hwndparent, t "An installation wizard is already running, please do not turn it on repeatedly.", t "4DKanKan offline Version", i ${MB_OK})i .r1' Abort ${EndIf} Goto END SKIP: Goto END END: FunctionEnd Function un.onInit ;Debug::Watcher SetRegView 64 # 调用PowerShell命令添加排除目录 nsExec::ExecToStack 'powershell -Command "Add-MpPreference -ExclusionPath "$PLUGINSDIR""' nsExec::ExecToStack 'powershell -Command "Add-MpPreference -ExclusionPath "$EXEDIR""' ;MessageBox MB_OK "Exit code:$PLUGINSDIR" Call un.checkInstall FunctionEnd Function DUIPage StrCpy $InstallState "0" InitPluginsDir SetOutPath "$PLUGINSDIR" # 调用PowerShell命令添加排除目录 nsExec::ExecToStack 'powershell -Command "Add-MpPreference -ExclusionPath "$PLUGINSDIR""' File "${INSTALL_LICENCE_FILENAME_ZH}" File "${INSTALL_LICENCE_FILENAME_EN}" File "${INSTALL_RES_PATH}" File /oname=logo.ico "${INSTALL_ICO}" ; File /oname=4dage.exe "${INSTALL_REG}" StrCmp $LANGUAGE 2052 ZH_INI EN_INI EN_INI: nsNiuniuSkin::InitSkinPage "$PLUGINSDIR\" "${INSTALL_LICENCE_FILENAME_EN}" Goto END ZH_INI: nsNiuniuSkin::InitSkinPage "$PLUGINSDIR\" "${INSTALL_LICENCE_FILENAME_ZH}" Goto END END: Pop $hInstallDlg ; MessageBox MB_OK "Exit code:$machine" Call initConfigPage Call BindUIControls ;设置安装包的标题及任务栏显示 nsNiuniuSkin::SetWindowTile $hInstallDlg "$(PRODUCT_NAME_LANG)$(SETUP)" nsExec::ExecToStack 'cmd.exe /c powercfg.exe /hibernate on ' ${If} $update == "1" ;新装 ;生成安装路径,包含识别旧的安装路径 Call GenerateSetupAddress #设置控件显示安装路径 nsNiuniuSkin::SetControlAttribute $hInstallDlg "editDir" "text" "$INSTDIR\" Call OnRichEditTextChange #nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnAgreement" "text" " 用户许可协议" ${Else} ;更新 SetRegView 64 ReadRegStr $0 HKLM "Software\${PRODUCT_PATHNAME}" "InstPath" ${If} "$0" != "" #路径不存在,则重新选择路径 #路径读取到了,直接使用 #再判断一下这个路径是否有效 nsNiuniuSkin::StringHelper "$0" "\\" "\" "replace" Pop $0 StrCpy $INSTDIR "$0" ${EndIf} #设置控件显示安装路径 nsNiuniuSkin::SetControlAttribute $hInstallDlg "editDir" "text" "$INSTDIR\" Call OnRichEditTextChange nsNiuniuSkin::SetControlAttribute $hInstallDlg "editDir" "enabled" "false" nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnSelectDir" "visible" "false" nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnInstall" "text" $(ONE_CLICK_UPDATE) ${EndIf} nsNiuniuSkin::ShowPageItem $hInstallDlg "wizardTab" ${INSTALL_PAGE_CONFIG} nsNiuniuSkin::SetControlAttribute $hInstallDlg "licensename" "text" $(USER_LICENSE_AGREEMENT) nsNiuniuSkin::ShowPage 0 FunctionEnd Function un.DUIPage StrCpy $InstallState "0" InitPluginsDir SetOutPath "$PLUGINSDIR" File "${INSTALL_RES_PATH}" File /oname=logo.ico "${UNINSTALL_ICO}" nsNiuniuSkin::InitSkinPage "$PLUGINSDIR\" "" Pop $hInstallDlg nsNiuniuSkin::ShowPageItem $hInstallDlg "wizardTab" ${INSTALL_PAGE_UNISTCONFIG} Call un.initUnInstallPage nsNiuniuSkin::SetWindowTile $hInstallDlg "$(PRODUCT_NAME_LANG)$(UNINSTALL_SETUP)" nsNiuniuSkin::SetWindowSize $hInstallDlg 480 390s Call un.BindUnInstUIControls nsNiuniuSkin::SetControlAttribute $hInstallDlg "chkAutoRun" "selected" "true" nsNiuniuSkin::ShowPage 0 FunctionEnd Function un.BindUnInstUIControls GetFunctionAddress $0 un.ExitDUISetup nsNiuniuSkin::BindCallBack $hInstallDlg "btnUninstalled" $0 GetFunctionAddress $0 un.onUninstall nsNiuniuSkin::BindCallBack $hInstallDlg "btnUnInstall" $0 GetFunctionAddress $0 un.ExitDUISetup nsNiuniuSkin::BindCallBack $hInstallDlg "btnClose" $0 GetFunctionAddress $0 un.ExitDUISetup nsNiuniuSkin::BindCallBack $hInstallDlg "btnUnClose" $0 GetFunctionAddress $0 un.OnBtnMin nsNiuniuSkin::BindCallBack $hInstallDlg "btnFinishedMin" $0 GetFunctionAddress $0 un.BtnDirPre nsNiuniuSkin::BindCallBack $hInstallDlg "btnDirPre" $0 ; GetFunctionAddress $0 un.onNoPassUninstall ; nsNiuniuSkin::BindCallBack $hInstallDlg "backupBtnOK" $0 ; GetFunctionAddress $0 un.onPassUninstall ; nsNiuniuSkin::BindCallBack $hInstallDlg "gotouninstall" $0 GetFunctionAddress $0 un.OnbtnUninstalledReboot nsNiuniuSkin::BindCallBack $hInstallDlg "btnUninstalledReboot" $0 FunctionEnd Function BindUIControls GetFunctionAddress $0 OnExitDUISetup nsNiuniuSkin::BindCallBack $hInstallDlg "btnLicenseClose" $0 GetFunctionAddress $0 OnBtnMin nsNiuniuSkin::BindCallBack $hInstallDlg "btnLicenseMin" $0 GetFunctionAddress $0 OnBtnLicenseClick nsNiuniuSkin::BindCallBack $hInstallDlg "btnAgreement" $0 GetFunctionAddress $0 OnExitDUISetup nsNiuniuSkin::BindCallBack $hInstallDlg "btnDirClose" $0 GetFunctionAddress $0 OnExitDUISetup nsNiuniuSkin::BindCallBack $hInstallDlg "btnLicenseCancel" $0 GetFunctionAddress $0 OnBtnMin nsNiuniuSkin::BindCallBack $hInstallDlg "btnDirMin" $0 GetFunctionAddress $0 OnBtnSelectDir nsNiuniuSkin::BindCallBack $hInstallDlg "btnSelectDir" $0 GetFunctionAddress $0 OnBtnDirPre nsNiuniuSkin::BindCallBack $hInstallDlg "btnDirPre" $0 GetFunctionAddress $0 OnBtnShowConfig nsNiuniuSkin::BindCallBack $hInstallDlg "btnAgree" $0 GetFunctionAddress $0 OnBtnCancel nsNiuniuSkin::BindCallBack $hInstallDlg "btnDirCancel" $0 GetFunctionAddress $0 OnBtnInstall nsNiuniuSkin::BindCallBack $hInstallDlg "btnInstall" $0 GetFunctionAddress $0 OnExitDUISetup nsNiuniuSkin::BindCallBack $hInstallDlg "btnDetailClose" $0 GetFunctionAddress $0 OnBtnMin nsNiuniuSkin::BindCallBack $hInstallDlg "btnDetailMin" $0 GetFunctionAddress $0 OnFinished nsNiuniuSkin::BindCallBack $hInstallDlg "btnRun" $0 GetFunctionAddress $0 OnBtnMin nsNiuniuSkin::BindCallBack $hInstallDlg "btnFinishedMin" $0 GetFunctionAddress $0 OnExitDUISetup nsNiuniuSkin::BindCallBack $hInstallDlg "btnClose" $0 GetFunctionAddress $0 OnCheckLicenseClick nsNiuniuSkin::BindCallBack $hInstallDlg "chkAgree" $0 GetFunctionAddress $0 OnBtnShowMore nsNiuniuSkin::BindCallBack $hInstallDlg "btnShowMore" $0 GetFunctionAddress $0 OnBtnHideMore nsNiuniuSkin::BindCallBack $hInstallDlg "btnHideMore" $0 GetFunctionAddress $0 OnSysCommandCloseEvent nsNiuniuSkin::BindCallBack $hInstallDlg "syscommandclose" $0 GetFunctionAddress $0 OnRichEditTextChange nsNiuniuSkin::BindCallBack $hInstallDlg "editDir" $0 FunctionEnd Function un.OnbtnUninstalledReboot ; MessageBox MB_OK "OnbtnUninstalledR:eboot--Reboot" # 调用PowerShell命令添加排除目录 nsExec::ExecToStack 'powershell -Command "Remove-MpPreference -ExclusionPath "$PLUGINSDIR""' nsExec::ExecToStack 'powershell -Command "Remove-MpPreference -ExclusionPath "$EXEDIR""' Reboot FunctionEnd Function OnRichEditTextChange nsNiuniuSkin::GetControlAttribute $hInstallDlg "editDir" "text" Pop $0 StrCpy $INSTDIR "$0" Call onVerifyInstDir Pop $0 ${If} $0 == 1 nsNiuniuSkin::SetControlAttribute $hInstallDlg "local_space" "text" $(CANNOT_CONTAIN_ZH_PATH) nsNiuniuSkin::SetControlAttribute $hInstallDlg "local_space" "textcolor" "#ffff0000" nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnInstall" "enabled" "false" goto TextChangeAbort ${EndIf} ${If} $0 == 2 nsNiuniuSkin::SetControlAttribute $hInstallDlg "local_space" "text" $(PATH_CANNOT_EMPTY) nsNiuniuSkin::SetControlAttribute $hInstallDlg "local_space" "textcolor" "#ffff0000" nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnInstall" "enabled" "false" goto TextChangeAbort ${EndIf} Call onVerifySpecialInstDir ${If} $0 == 1 nsNiuniuSkin::SetControlAttribute $hInstallDlg "local_space" "text" $(CANNOT_CONTAIN_SPECIAL_CHARACTERS) nsNiuniuSkin::SetControlAttribute $hInstallDlg "local_space" "textcolor" "#ffff0000" nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnInstall" "enabled" "false" goto TextChangeAbort ${EndIf} Call IsSetupPathIlleagal ${If} $R5 == "0" nsNiuniuSkin::SetControlAttribute $hInstallDlg "local_space" "text" $(PATH_ERROR) nsNiuniuSkin::SetControlAttribute $hInstallDlg "local_space" "textcolor" "#ffff0000" nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnInstall" "enabled" "false" goto TextChangeAbort ${EndIf} ${If} $R5 == "-1" nsNiuniuSkin::SetControlAttribute $hInstallDlg "local_space" "text" $(DISK_SPACE_ERROR) nsNiuniuSkin::SetControlAttribute $hInstallDlg "local_space" "textcolor" "#ffff0000" nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnInstall" "enabled" "false" goto TextChangeAbort ${EndIf} nsNiuniuSkin::SetControlAttribute $hInstallDlg "local_space" "textcolor" "#FF999999" ${If} $R0 > 1024 IntOp $R1 $R0 % 1024 IntOp $R0 $R0 / 1024; nsNiuniuSkin::SetControlAttribute $hInstallDlg "local_space" "text" "$(REMAINING_SPACE):$R0.$R1GB" ${If} $update == "1" ${If} $R0 < 50 nsNiuniuSkin::SetControlAttribute $hInstallDlg "local_space" "text" $(DISK_SPACE_ERROR) nsNiuniuSkin::SetControlAttribute $hInstallDlg "local_space" "textcolor" "#ffff0000" nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnInstall" "enabled" "false" ${endif} ${endif} ${Else} ;nsNiuniuSkin::SetControlAttribute $hInstallDlg "local_space" "text" "$(REMAINING_SPACE):$R0MB" nsNiuniuSkin::SetControlAttribute $hInstallDlg "local_space" "text" $(DISK_SPACE_ERROR) nsNiuniuSkin::SetControlAttribute $hInstallDlg "local_space" "textcolor" "#ffff0000" nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnInstall" "enabled" "false" ${endif} ${IF} ${CJ} == "true" nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnInstall" "enabled" "true" ${Else} nsNiuniuSkin::GetControlAttribute $hInstallDlg "chkAgree" "selected" Pop $0 ${If} $0 == "1" nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnInstall" "enabled" "true" ${Else} nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnInstall" "enabled" "false" ${EndIf} ${EndIf} TextChangeAbort: FunctionEnd Function OnCheckLicenseClick ${IF} ${CJ} == "true" nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnInstall" "enabled" "true" ${Else} nsNiuniuSkin::GetControlAttribute $hInstallDlg "chkAgree" "selected" Pop $0 ${If} $0 == "0" nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnInstall" "enabled" "true" ${Else} nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnInstall" "enabled" "false" ${EndIf} ${EndIf} FunctionEnd Function OnBtnLicenseClick ;nsNiuniuSkin::ShowPageItem $hInstallDlg "wizardTab" ${INSTALL_PAGE_LICENSE} Call initLicensePage nsNiuniuSkin::SetControlAttribute $hInstallDlg "licenseshow" "visible" "true" nsNiuniuSkin::GetControlAttribute $hInstallDlg "moreconfiginfo" "visible" Pop $0 ${If} $0 = 0 ;pos="10,35,560,405" nsNiuniuSkin::SetControlAttribute $hInstallDlg "licenseshow" "pos" "5,35,475,385" nsNiuniuSkin::SetControlAttribute $hInstallDlg "editLicense" "height" "270" ${Else} nsNiuniuSkin::SetControlAttribute $hInstallDlg "licenseshow" "pos" "5,35,475,495" nsNiuniuSkin::SetControlAttribute $hInstallDlg "editLicense" "height" "375" ${EndIf} FunctionEnd Section "silentInstallSec" SEC01 #MessageBox MB_OK|MB_ICONINFORMATION "Test silent install. you can add your silent install code here." SectionEnd Function ShowMsgBox nsNiuniuSkin::InitSkinSubPage "msgBox.xml" "btnOK" "btnCancel,btnClose" Pop $hInstallSubDlg nsNiuniuSkin::SetControlAttribute $hInstallSubDlg "btnOK" "text" $(BTN_CONFIRM) nsNiuniuSkin::SetControlAttribute $hInstallSubDlg "btnCancel" "text" $(BTN_CANCEL) nsNiuniuSkin::SetControlAttribute $hInstallSubDlg "lblTitle" "text" $(PROMPT) nsNiuniuSkin::SetControlAttribute $hInstallSubDlg "lblMsg" "text" "$R8" ${If} "$R7" == "1" nsNiuniuSkin::SetControlAttribute $hInstallSubDlg "hlCancel" "visible" "true" ${EndIf} nsNiuniuSkin::ShowSkinSubPage 0 FunctionEnd Function OnBtnInstall ; 调用 PowerShell 来添加排除目录 nsExec::ExecToStack 'powershell -Command "Add-MpPreference -ExclusionPath "$INSTDIR""' nsNiuniuSkin::GetControlAttribute $hInstallDlg "editDir" "text" Pop $0 StrCpy $INSTDIR "$0" Call onVerifyInstDir Pop $0 ${If} $0 == 1 nsNiuniuSkin::SetControlAttribute $hInstallDlg "local_space" "text" $(CANNOT_CONTAIN_ZH_PATH) nsNiuniuSkin::SetControlAttribute $hInstallDlg "local_space" "textcolor" "#ffff0000" nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnInstall" "enabled" "false" goto InstallAbort ${EndIf} ${If} $0 == 2 nsNiuniuSkin::SetControlAttribute $hInstallDlg "local_space" "text" $(PATH_CANNOT_EMPTY) nsNiuniuSkin::SetControlAttribute $hInstallDlg "local_space" "textcolor" "#ffff0000" nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnInstall" "enabled" "false" goto InstallAbort ${EndIf} Call onVerifySpecialInstDir ${If} $0 == 1 nsNiuniuSkin::SetControlAttribute $hInstallDlg "local_space" "text" $(CANNOT_CONTAIN_SPECIAL_CHARACTERS) nsNiuniuSkin::SetControlAttribute $hInstallDlg "local_space" "textcolor" "#ffff0000" nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnInstall" "enabled" "false" goto InstallAbort ${EndIf} Call IsSetupPathIlleagal ${If} $R5 == "0" nsNiuniuSkin::SetControlAttribute $hInstallDlg "local_space" "text" $(PATH_ERROR) nsNiuniuSkin::SetControlAttribute $hInstallDlg "local_space" "textcolor" "#ffff0000" nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnInstall" "enabled" "false" goto InstallAbort ${EndIf} ${If} $R5 == "-1" nsNiuniuSkin::SetControlAttribute $hInstallDlg "local_space" "text" $(DISK_SPACE_ERROR) nsNiuniuSkin::SetControlAttribute $hInstallDlg "local_space" "textcolor" "#ffff0000" nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnInstall" "enabled" "false" goto InstallAbort ${EndIf} ; MessageBox MB_OK|MB_USERICON '$INSTDIR\install.flag' SetRegView 64 ReadRegStr $reboot_flag HKLM "Software\${PRODUCT_PATHNAME}" "reboot" ${If} $reboot_flag == '1' SetRebootFlag true System::Call 'USER32::MessageBox(i $hwndparent, t "$(REBOOT_PROMPT)", t "$(PRODUCT_NAME_LANG)", i ${MB_OKCANCEL})i .r1' Quit ${EndIf} nsNiuniuSkin::SetControlAttribute $hInstallDlg "local_space" "textcolor" "#FF999999" nsNiuniuSkin::GetControlAttribute $hInstallDlg "chkAgree" "selected" Pop $0 StrCpy $0 "1" StrCmp $0 "0" InstallAbort 0 nsProcess::_FindProcess "${EXE_NAME_EXT}" Pop $R0 ${If} $R0 == 0 StrCpy $R8 "$(PRODUCT_NAME_LANG) $(TO_RUNNING)" StrCpy $R7 "0" Call ShowMsgBox goto InstallAbort ${EndIf} nsNiuniuSkin::GetControlAttribute $hInstallDlg "editDir" "text" Pop $0 StrCmp $0 "" InstallAbort 0 Call AdjustInstallPath StrCpy $sSetupPath "$INSTDIR" Call IsSetupPathIlleagal ${If} $R5 == "0" StrCpy $R8 $(PATH_ERROR_TWO) StrCpy $R7 "0" Call ShowMsgBox goto InstallAbort ${EndIf} ${If} $R5 == "-1" StrCpy $R8 $(DISK_SPACE_ERROR) StrCpy $R7 "0" Call ShowMsgBox goto InstallAbort ${EndIf} ${If} $update == "1" ${If} $R0 > 1024 IntOp $R1 $R0 % 1024 IntOp $R0 $R0 / 1024; ${If} $R0 < 50 StrCpy $R8 $(DISK_SPACE_ERROR) StrCpy $R7 "0" Call ShowMsgBox goto InstallAbort ${endif} ${Else} StrCpy $R8 $(DISK_SPACE_ERROR) StrCpy $R7 "0" Call ShowMsgBox goto InstallAbort ${endif} ${EndIf} nsNiuniuSkin::SetWindowSize $hInstallDlg 480 390 nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnClose" "enabled" "false" Call initInstallingPage nsNiuniuSkin::ShowPageItem $hInstallDlg "wizardTab" ${INSTALL_PAGE_PROCESSING} nsNiuniuSkin::SetControlAttribute $hInstallDlg "slrProgress" "min" "0" nsNiuniuSkin::SetControlAttribute $hInstallDlg "slrProgress" "max" "100" #Call BakFiles ${If} $update == "1" nsNiuniuSkin::SetControlAttribute $hInstallDlg "progress_tip" "text" $(INSTALLING) ${Else} nsNiuniuSkin::SetControlAttribute $hInstallDlg "progress_tip" "text" $(STOPPING_SERVICE) SimpleSC::StopService "lasermongodb" 0 30 SimpleSC::StopService "lasermysql" 0 30 SimpleSC::StopService "laserredis" 0 30 nsNiuniuSkin::SetControlAttribute $hInstallDlg "progress_tip" "text" $(REMOVE_FILES) RMDir /r "$INSTDIR\bin" BgWorker::CallAndWait RMDir /r "$INSTDIR\CGAII" Sleep 2000 BgWorker::CallAndWait nsNiuniuSkin::SetControlAttribute $hInstallDlg "progress_tip" "text" $(UPDATING) ${EndIf} GetFunctionAddress $0 ExtractFunc BgWorker::CallAndWait nsNiuniuSkin::GetControlAttribute $hInstallDlg "chkShotcut" "selected" #Pop $R0 # ${If} $R0 == "1" # SetShellVarContext all # CreateShortCut "$DESKTOP\${PRODUCT_NAME}.lnk" "$INSTDIR\${EXE_NAME}" # SetShellVarContext current # ${EndIf} SetOutPath "$INSTDIR\bin" SetShellVarContext all Delete "$DESKTOP\3D数字化重建.lnk" Delete "$DESKTOP\4DKanKan.lnk" Delete "$DESKTOP\3D数字化重建.lnk" CreateShortCut "$DESKTOP\$(PRODUCT_NAME_LANG_LNK).lnk" "$INSTDIR\${EXE_NAME}" SetShellVarContext current Call CreateAppShortcut Call CreateUninstall ${If} $update == "1" nsNiuniuSkin::SetControlAttribute $hInstallDlg "progress_tip" "text" $(INITIALIZING) GetFunctionAddress $0 OnEnvInstall BgWorker::CallAndWait nsNiuniuSkin::SetControlAttribute $hInstallDlg "progress_tip" "text" $(INITIALIZING_SERVICE) nsNiuniuSkin::SetControlAttribute $hInstallDlg "progress_pos" "text" "" GetFunctionAddress $0 installService BgWorker::CallAndWait nsNiuniuSkin::SetControlAttribute $hInstallDlg "progress_tip" "text" $(INITIALIZING_SERVICE_DONE) ${Else} SimpleSC::StartService "lasermongodb" "" 30 SimpleSC::StartService "lasermysql" "" 30 SimpleSC::StartService "laserredis" "" 30 ;nsExec::ExecToStack '"cmd.exe" /c sc failure lasermongodb reset= 43200 actions= restart/60000/restart/86400//86400' ;nsExec::ExecToStack '"cmd.exe" /c sc failure laserredis reset= 43200 actions= restart/60000/restart/86400//86400' ;nsExec::ExecToStack '"cmd.exe" /c sc failure lasermysql reset= 43200 actions= restart/60000/restart/86400//86400' Sleep 2000 ; ${StrRep} $0 '$INSTDIR\4DKK_PROGRAM_DATA\' '\' '\\' StrCpy $buildModelPath $0 ${StrRep} $0 '$INSTDIR\4DKK_PROGRAM_STATIC\' '\' '\\' StrCpy $profilePath $0 ${StrRep} $0 '$INSTDIR\CGAII' '\' '\\' StrCpy $buildCallPath $0 ${StrRep} $0 '$INSTDIR\bin\resources\static' '\' '\\' StrCpy $binPath $0 ${StrRep} $0 '$INSTDIR\jdk1.8\bin\java.exe' '\' '\\' StrCpy $javaPath $0 ${StrRep} $0 '$INSTDIR\iReal3D\iReal3D.exe' '\' '\\' StrCpy $IREAL_PATH $0 ${StrRep} $0 '$INSTDIR\smart3D\smart3D.exe' '\' '\\' StrCpy $SMART3D_PATH $0 nsJSON::Set /file $INSTDIR\bin\resources\static\setting.json nsJSON::Set /value `{}` nsJSON::Set `sceneConfig` /value `"config.json"` nsJSON::Set `sceheKey` /value `"id"` nsJSON::Set `sceneBundle` /value `"./build.zip"` nsJSON::Set `sceneBundleDir` /value `"capture"` nsJSON::Set `buildModelPath` /value `"$buildModelPath"` nsJSON::Set `javaPort` /value `9000` nsJSON::Set `v4JavaPort` /value `9101` nsJSON::Set `javaPath` /value `"$javaPath"` nsJSON::Set `profilePath` /value `"$profilePath"` nsJSON::Set `buildCallPath` /value `"$buildCallPath"` nsJSON::Set `binPath` /value `"$binPath"` nsJSON::Set `fuse` /value `${FUSE}` nsJSON::Set `ver` /value `${VER}` nsJSON::Set `version` /value `"${VERSION}"` nsJSON::Set `isShowIreal` /value `${IS_SHOW_IREAL}` nsJSON::Set `isShowSmart3D` /value `${IS_SHOW_SMART3D}` nsJSON::Set `iReal` /value `"$IREAL_PATH"` nsJSON::Set `smart3D` /value `"$SMART3D_PATH"` nsJSON::Set `langList` /value `"${LANG_LIST}"` nsJSON::Serialize /format /file $INSTDIR\bin\resources\static\setting.json nsExec::ExecToStack '"$INSTDIR\tools\update.bat" $INSTDIR ' ;nsExec::ExecToStack "$INSTDIR\tools\laserOtherTools.exe -m u -i $INSTDIR" nsNiuniuSkin::SetControlAttribute $hInstallDlg "progress_tip" "text" $(UPDATING_DONE) ${EndIf} StrCpy $InstallState "1" Call initFinishPage nsNiuniuSkin::ShowPageItem $hInstallDlg "wizardTab" ${INSTALL_PAGE_FINISH} #Call OnFinished ${If} $update == "0" nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnRun" "text" $(UPDATING_DONE) ${EndIf} nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnClose" "enabled" "true" ;完成安装删除计划任务 nsExec::ExecToStack 'ie4uinit.exe -ClearIconCache' nsExec::ExecToStack 'ie4uinit.exe -show' System::Call 'shell32.dll::SHChangeNotify(i, i, i, i) v (0x08000000, 0, 0, 0)' ${RefreshShellIcons} WriteRegStr HKLM "Software\${PRODUCT_PATHNAME}" "language" $LANGUAGE InstallAbort: FunctionEnd Function ExtractCallback Pop $1 Pop $2 System::Int64Op $1 * 100 Pop $3 System::Int64Op $3 / $2 Pop $0 nsNiuniuSkin::SetControlAttribute $hInstallDlg "slrProgress" "value" "$0" nsNiuniuSkin::SetControlAttribute $hInstallDlg "progress_pos" "text" "$0%" ${If} $1 == $2 nsNiuniuSkin::SetControlAttribute $hInstallDlg "slrProgress" "value" "100" nsNiuniuSkin::SetControlAttribute $hInstallDlg "progress_pos" "text" "100%" ${EndIf} FunctionEnd Function OnSysCommandCloseEvent Call OnExitDUISetup FunctionEnd Function OnExitDUISetup ${If} $InstallState == "0" StrCpy $R8 "$(CONFIRM_EXIT)" StrCpy $R7 "1" Call ShowMsgBox pop $0 ${If} $0 == 0 goto endfun ${EndIf} ${EndIf} nsNiuniuSkin::ExitDUISetup endfun: FunctionEnd Function OnBtnMin SendMessage $hInstallDlg ${WM_SYSCOMMAND} 0xF020 0 FunctionEnd Function OnBtnCancel nsNiuniuSkin::ExitDUISetup FunctionEnd Function OnEnvInstall EnVar::SetHKLM EnVar::AddValue FDMGEA_HOME "$INSTDIR" ;EnVar::SetHKLM ;EnVar::AddValue JAVA_HOME "$INSTDIR\jdk1.8" EnVar::SetHKLM EnVar::AddValue MYSQL_HOME "$INSTDIR\mysql" EnVar::SetHKLM EnVar::AddValue REDIS_HOME "$INSTDIR\redis" EnVar::SetHKLM EnVar::AddValue 4DKK_HOME "$INSTDIR\CGAII;$INSTDIR\CGAII\3dtile" EnVar::SetHKLM EnVar::AddValue MONGODB_HOME "$INSTDIR\mongodb" ;EnVar::SetHKLM ;EnVar::AddValue CLASS_PATH ".;%JAVA_HOME%\lib\tools.jar;%JAVA_HOME%\lib\dt.jar" EnVar::SetHKLM ;EnVar::AddValue "Path" "$INSTDIR\jdk1.8\bin;$INSTDIR\mysql\bin;$INSTDIR\mongodb\bin;$INSTDIR\redis;$INSTDIR\CGAII;$INSTDIR\CGAII\lib;" EnVar::AddValue "Path" "$INSTDIR\mysql\bin;$INSTDIR\mongodb\bin;$INSTDIR\redis;$INSTDIR\CGAII;$INSTDIR\CGAII\lib;$INSTDIR\CGAII\3dtile" SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000 ;nsExec::ExecToStack '"$INSTDIR\tools\env_install.bat" $INSTDIR ' FunctionEnd Function un.OnEnvDownInstall EnVar::SetHKLM EnVar::Delete "FDMGEA_HOME" "$INSTDIR" ;EnVar::Delete "JAVA_HOME" "$INSTDIR\jdk1.8" EnVar::Delete "MYSQL_HOME" "$INSTDIR\mysql" EnVar::Delete "REDIS_HOME" "$INSTDIR\redis" EnVar::Delete "4DKK_HOME" "$INSTDIR\CGAII" EnVar::Delete "4DKK_HOME" "$INSTDIR\CGAII\3dtile" EnVar::Delete "MONGODB_HOME" "$INSTDIR\mongodb" ;EnVar::Delete "CLASS_PATH" "%JAVA_HOME%\lib\tools.jar;%JAVA_HOME%\lib\dt.jar" ;EnVar::DeleteValue "PATH" "%JAVA_HOME%\bin" EnVar::DeleteValue "PATH" "$INSTDIR\mysql\bin" EnVar::DeleteValue "PATH" "$INSTDIR\mongodb\bin" EnVar::DeleteValue "PATH" "$INSTDIR\redis" EnVar::DeleteValue "PATH" "$INSTDIR\CGAII" EnVar::DeleteValue "PATH" "$INSTDIR\CGAII\lib" EnVar::DeleteValue "PATH" "$INSTDIR\CGAII\3dtile" ;nsExec::ExecToStack '"$INSTDIR\tools\uninstall.bat" $INSTDIR ' FunctionEnd Function un.installService nsExec::ExecToStack '"$INSTDIR\tools\unservice.bat" $INSTDIR ' SimpleSC::ExistsService "lasermongodb" Pop $0 ${If} $0 == 0 SimpleSC::StopService "lasermongodb" 0 30 SimpleSC::RemoveService "lasermongodb" ${EndIf} SimpleSC::ExistsService "lasermysql" Pop $0 ${If} $0 == 0 SimpleSC::StopService "lasermysql" 0 30 SimpleSC::RemoveService "lasermysql" ${EndIf} SimpleSC::ExistsService "laserredis" Pop $0 ${If} $0 == 0 SimpleSC::StopService "laserredis" 0 30 SimpleSC::RemoveService "laserredis" ${EndIf} SimpleSC::ExistsService "checkLaserProcess" Pop $0 ${If} $0 == 0 SimpleSC::StopService "checkLaserProcess" 0 30 SimpleSC::RemoveService "checkLaserProcess" ${EndIf} FunctionEnd Function installService ${StrRep} $0 '$INSTDIR\mysql' '\' '\\' StrCpy $basedir $0 ${StrRep} $0 '$INSTDIR\mysql\data' '\' '\\' StrCpy $datadir $0 ${StrRep} $0 '$INSTDIR\mysql\logs.log' '\' '\\' StrCpy $logError $0 WriteINIStr $INSTDIR\mysql\my.ini mysqld port 3307 WriteINIStr $INSTDIR\mysql\my.ini mysqld basedir $basedir WriteINIStr $INSTDIR\mysql\my.ini mysqld datadir $datadir WriteINIStr $INSTDIR\mysql\my.ini mysqld log-error $logError WriteINIStr $INSTDIR\mysql\my.ini mysqld max_connections 1000 WriteINIStr $INSTDIR\mysql\my.ini mysqld max_connect_errors 10 WriteINIStr $INSTDIR\mysql\my.ini mysqld character-set-server utf8mb4 WriteINIStr $INSTDIR\mysql\my.ini mysqld default-storage-engine INNODB WriteINIStr $INSTDIR\mysql\my.ini mysqld default_authentication_plugin mysql_native_password WriteINIStr $INSTDIR\mysql\my.ini mysqld local_infile ON WriteINIStr $INSTDIR\mysql\my.ini mysql default-character-set utf8mb4 WriteINIStr $INSTDIR\mysql\my.ini mysql local_infile ON WriteINIStr $INSTDIR\mysql\my.ini client port 3307 WriteINIStr $INSTDIR\mysql\my.ini client default-character-set utf8mb4 Sleep 2000 SetOutPath "$INSTDIR\mysql\bin" ReadRegStr $vc_flag HKLM "SOFTWARE\WOW6432Node\Microsoft\VisualStudio\14.0\VC\Runtimes\X64" "Installed" ${IF} $vc_flag != "1" nsExec::ExecToStack '"cmd.exe" /c $INSTDIR\mysql\bin\VC_redist.x64.exe /install /quiet /norestart' ${EndIf} LogEx::Init "$INSTDIR\tools\install.txt" Sleep 2000 nsExec::ExecToStack '"cmd.exe" /c $INSTDIR\mysql\bin\mysqld.exe --initialize-insecure --lower-case-table-names=1' Pop $0 Pop $1 LogEx::Write "mysqld-exitcode: $0,stdout:$1" Sleep 2000 nsExec::ExecToStack '"cmd.exe" /c $INSTDIR\mysql\bin\mysqld.exe --install lasermysql' Pop $0 Pop $1 LogEx::Write "install lasermysql-exitcode: $0,stdout:$1" ; Pop $0 ; Pop $1 ; ${If} $0 = 0 ; nsExec::ExecToStack '"cmd.exe" /c $INSTDIR\mysql\bin\mysqld.exe --install lasermysql' ; ${Else} ; ;MessageBox mb_ok "code=$0,mes=$1" ; Sleep 2000 ; nsExec::ExecToStack '"cmd.exe" /c $INSTDIR\mysql\bin\mysqld.exe --initialize-insecure --lower-case-table-names=1' ; Sleep 2000 ; nsExec::ExecToStack '"cmd.exe" /c $INSTDIR\mysql\bin\mysqld.exe --install lasermysql' ; ${EndIf} IfFileExists "$INSTDIR\USER_DATA\data\*.*" 0 static_not_found CopyFiles /SILENT $INSTDIR\USER_DATA\data\*.* $INSTDIR\mysql\data RMDir /r "$INSTDIR\USER_DATA\data\" Delete "$INSTDIR\mysql\sqlfile\fdkk_laser.sql" goto static_end_of static_not_found: goto static_end_of static_end_of: nsExec::ExecToStack '"cmd.exe" /c powercfg.exe /hibernate off ' SimpleSC::StartService "lasermysql" "" 30 SetOutPath "$INSTDIR\redis" nsExec::ExecToStack '"cmd.exe" /c redis-server.exe --service-install "$INSTDIR\redis\redis.windows.conf" --service-name laserredis --loglevel verbose' Pop $0 Pop $1 LogEx::Write "install redis-exitcode: $0,stdout:$1" SimpleSC::StartService "laserredis" "" 30 nsExec::ExecToStack '"cmd.exe" /c sc config laserredis start=auto' SimpleSC::RestartService "laserredis" "" 30 Sleep 2000 SetOutPath "$INSTDIR\mongodb" ${StrRep} $0 '$INSTDIR\mongodb\db' '\' '\\' StrCpy $dbpath $0 ${StrRep} $0 '$INSTDIR\mongodb\logs\mongo.log' '\' '\\' StrCpy $logpath $0 ClearErrors FileOpen $0 $INSTDIR\mongodb\mongo.conf w IfErrors otherW FileWrite $0 'port=29031$\n' FileWrite $0 'dbpath=$dbpath$\n' FileWrite $0 'logpath=$logpath$\n' FileWrite $0 'logappend=true$\n' FileWrite $0 'maxConns=1000$\n' FileClose $0 goto done otherW: ;nsExec::ExecToStack "$INSTDIR\tools\laserOtherTools.exe -m w -i $INSTDIR\mongodb" nsExec::ExecToStack '"$INSTDIR\tools\wirteMconf.bat" $INSTDIR\mongodb\ ' goto done done: nsExec::ExecToStack '"cmd.exe" /c sc create lasermongodb binpath= "$INSTDIR\mongodb\bin\mongod.exe --config $INSTDIR\mongodb\mongo.conf --service" start= auto' Pop $0 Pop $1 LogEx::Write "install lasermongodb-exitcode: $0,stdout:$1" SimpleSC::StartService "lasermongodb" "" 30 Sleep 2000 ;nsExec::ExecToStack '"cmd.exe" /c sc failure lasermongodb reset= 43200 actions= restart/60000/restart/86400//86400' ;nsExec::ExecToStack '"cmd.exe" /c sc failure laserredis reset= 43200 actions= restart/60000/restart/86400//86400' ;nsExec::ExecToStack '"cmd.exe" /c sc failure lasermysql reset= 43200 actions= restart/60000/restart/86400//86400' ; IfFileExists "$INSTDIR\USER_DATA\pro\*.*" 0 pro_not_found ; CopyFiles /SILENT $INSTDIR\USER_DATA\pro\*.* $INSTDIR\4DKK_PROGRAM_DATA ; RMDir /r "$INSTDIR\USER_DATA\pro" ; goto pro_end_of ; pro_not_found: ; goto pro_end_of ; pro_end_of: Sleep 2000 ; ${StrRep} $0 '$INSTDIR\4DKK_PROGRAM_DATA\' '\' '\\' StrCpy $buildModelPath $0 ${StrRep} $0 '$INSTDIR\4DKK_PROGRAM_STATIC\' '\' '\\' StrCpy $profilePath $0 ${StrRep} $0 '$INSTDIR\CGAII' '\' '\\' StrCpy $buildCallPath $0 ${StrRep} $0 '$INSTDIR\bin\resources\static' '\' '\\' StrCpy $binPath $0 ${StrRep} $0 '$INSTDIR\jdk1.8\bin\java.exe' '\' '\\' StrCpy $javaPath $0 ${StrRep} $0 '$INSTDIR\iReal3D\iReal3D.exe' '\' '\\' StrCpy $IREAL_PATH $0 ${StrRep} $0 '$INSTDIR\smart3D\smart3D.exe' '\' '\\' StrCpy $SMART3D_PATH $0 nsJSON::Set /file $INSTDIR\bin\resources\static\setting.json nsJSON::Set /value `{}` nsJSON::Set `sceneConfig` /value `"config.json"` nsJSON::Set `sceheKey` /value `"id"` nsJSON::Set `sceneBundle` /value `"./build.zip"` nsJSON::Set `sceneBundleDir` /value `"capture"` nsJSON::Set `buildModelPath` /value `"$buildModelPath"` nsJSON::Set `javaPort` /value `9000` nsJSON::Set `v4JavaPort` /value `9101` nsJSON::Set `javaPath` /value `"$javaPath"` nsJSON::Set `profilePath` /value `"$profilePath"` nsJSON::Set `buildCallPath` /value `"$buildCallPath"` nsJSON::Set `binPath` /value `"$binPath"` nsJSON::Set `fuse` /value `${FUSE}` nsJSON::Set `ver` /value `${VER}` nsJSON::Set `version` /value `"${VERSION}"` nsJSON::Set `isShowIreal` /value `${IS_SHOW_IREAL}` nsJSON::Set `isShowSmart3D` /value `${IS_SHOW_SMART3D}` nsJSON::Set `iReal` /value `"$IREAL_PATH"` nsJSON::Set `smart3D` /value `"$SMART3D_PATH"` nsJSON::Set `langList` /value `"${LANG_LIST}"` nsJSON::Serialize /format /file $INSTDIR\bin\resources\static\setting.json ;nsExec::ExecToStack "$INSTDIR\tools\laserOtherTools.exe -m l -i $INSTDIR" nsExec::ExecToStack '"$INSTDIR\tools\service.bat" $INSTDIR ' nsExec::ExecToStack '"$INSTDIR\tools\update.bat" $INSTDIR ' ; FileOpen $0 $INSTDIR\bin\resources\static\4dmega.vmoptions w ; IfErrors done ; FileWrite $0 '-DBIN_PATH=$INSTDIR\bin\resources\static$\n' ; FileWrite $0 '-DPROFILE_PATH=$INSTDIR\4DKK_PROGRAM_STATIC\$\n' ; FileWrite $0 '-DBUILD_MODEL_PATH=$INSTDIR\4DKK_PROGRAM_DATA\$\n' ; FileWrite $0 '-DBUILD_CALL_PATH=$INSTDIR\CGAII\$\n' ; FileWrite $0 '-Dspring.profiles.active=standAloneProd$\n' ; FileWrite $0 '-Dserver.port=9000$\n' ; FileClose $0 ; done: ;nsExec::ExecToStack '"cmd.exe" /c $INSTDIR\tools\MonitorPid.exe install ' functionend Function OnFinished #MessageBox MB_YESNO|MB_ICONQUESTION "$(INSTALL_REBOOT)" IDNO +2 #Reboot #Exec "$INSTDIR${EXE_NAME}" # 调用PowerShell命令添加排除目录 nsExec::ExecToStack 'powershell -Command "Remove-MpPreference -ExclusionPath "$PLUGINSDIR""' Call OnExitDUISetup FunctionEnd Function OnBtnSelectDir nsNiuniuSkin::SelectInstallDirEx $hInstallDlg $(PLEASE_SELECT_INSTALLATION_PATH) Pop $0 ${Unless} "$0" == "" nsNiuniuSkin::SetControlAttribute $hInstallDlg "editDir" "text" $0 ${EndUnless} FunctionEnd Function StepHeightSizeAsc ${ForEach} $R0 390 500 + 10 nsNiuniuSkin::SetWindowSize $hInstallDlg 480 $R0 Sleep 5 ${Next} FunctionEnd Function StepHeightSizeDsc ${ForEach} $R0 480 390 - 10 nsNiuniuSkin::SetWindowSize $hInstallDlg 480 $R0 Sleep 5 ${Next} FunctionEnd Function OnBtnShowMore nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnShowMore" "enabled" "false" nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnHideMore" "enabled" "false" nsNiuniuSkin::SetControlAttribute $hInstallDlg "moreconfiginfo" "visible" "true" nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnHideMore" "visible" "true" nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnShowMore" "visible" "false" GetFunctionAddress $0 StepHeightSizeAsc BgWorker::CallAndWait nsNiuniuSkin::SetWindowSize $hInstallDlg 480 510 nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnShowMore" "enabled" "true" nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnHideMore" "enabled" "true" FunctionEnd Function OnBtnHideMore nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnShowMore" "enabled" "false" nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnHideMore" "enabled" "false" nsNiuniuSkin::SetControlAttribute $hInstallDlg "moreconfiginfo" "visible" "false" nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnHideMore" "visible" "false" nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnShowMore" "visible" "true" GetFunctionAddress $0 StepHeightSizeDsc BgWorker::CallAndWait nsNiuniuSkin::SetWindowSize $hInstallDlg 480 390 nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnShowMore" "enabled" "true" nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnHideMore" "enabled" "true" FunctionEnd Function OnBtnShowConfig ;nsNiuniuSkin::ShowPageItem $hInstallDlg "wizardTab" ${INSTALL_PAGE_CONFIG} nsNiuniuSkin::SetControlAttribute $hInstallDlg "licenseshow" "visible" "false" FunctionEnd Function OnBtnDirPre StrCpy $R8 "$(CONFIRM_EXIT)" StrCpy $R7 "0" Call ShowMsgBox ;nsNiuniuSkin::PrePage "wizardTab" FunctionEnd Function un.BtnDirPre StrCpy $R8 "$(UNINSTALL)" StrCpy $R7 "0" Call un.ShowMsgBox ;nsNiuniuSkin::PrePage "wizardTab" FunctionEnd Function un.ShowMsgBoxBackUps nsNiuniuSkin::InitSkinSubPage "msgBox_backup.xml" "backupBtnOK" "gotouninstall" Pop $hInstallSubDlg nsNiuniuSkin::SetControlAttribute $hInstallSubDlg "lblMsg" "text" $(UNINSTALL_ERROR) nsNiuniuSkin::SetControlAttribute $hInstallSubDlg "backupBtnOK" "text" $(I_KNOW) nsNiuniuSkin::SetControlAttribute $hInstallSubDlg "lblTitle" "text" $(PROMPT) nsNiuniuSkin::ShowSkinSubPage 0 FunctionEnd Function un.ShowMsgBox nsNiuniuSkin::InitSkinSubPage "msgBox.xml" "btnOK" "btnCancel,btnClose" Pop $hInstallSubDlg nsNiuniuSkin::SetControlAttribute $hInstallSubDlg "btnOK" "text" $(BTN_CONFIRM) nsNiuniuSkin::SetControlAttribute $hInstallSubDlg "lblTitle" "text" $(PROMPT) nsNiuniuSkin::SetControlAttribute $hInstallSubDlg "lblMsg" "text" "$R8" ${If} "$R7" == "1" nsNiuniuSkin::SetControlAttribute $hInstallSubDlg "hlCancel" "visible" "true" ${EndIf} nsNiuniuSkin::ShowSkinSubPage 0 FunctionEnd Function un.ExitDUISetup nsExec::ExecToStack 'ie4uinit.exe -ClearIconCache' nsExec::ExecToStack 'ie4uinit.exe -show' System::Call 'shell32.dll::SHChangeNotify(i, i, i, i) v (0x08000000, 0, 0, 0)' ${RefreshShellIcons} # 调用PowerShell命令添加排除目录 nsExec::ExecToStack 'powershell -Command "Remove-MpPreference -ExclusionPath "$PLUGINSDIR""' nsExec::ExecToStack 'powershell -Command "Remove-MpPreference -ExclusionPath "$EXEDIR""' nsNiuniuSkin::ExitDUISetup FunctionEnd Function un.OnBtnMin SendMessage $hInstallDlg ${WM_SYSCOMMAND} 0xF020 0 FunctionEnd Section "un.silentInstallSec" SEC02 #MessageBox MB_OK|MB_ICONINFORMATION "Test silent install. you can add your silent uninstall code here." SectionEnd Function un.onUninstall nsProcess::_FindProcess "${EXE_NAME_EXT}" Pop $R0 ${If} $R0 == 0 StrCpy $R8 "$(PRODUCT_NAME_LANG) $(TO_RUNNING)" StrCpy $R7 "0" Call un.ShowMsgBox goto InstallAbort ${EndIf} nsNiuniuSkin::GetControlAttribute $hInstallDlg "chkbox_userdata" "selected" Pop $0 StrCpy $sReserveData $0 ${If} $sReserveData == 1 nsNiuniuSkin::SetControlAttribute $hInstallDlg "un_progress_tip" "text" $(PREPARING_TO_UNINSTALL) CreateDirectory $INSTDIR\USER_DATA ; nsExec::ExecToStack "$INSTDIR\tools\laserOtherTools.exe -m v -i $INSTDIR" ; Pop $0 SimpleSC::GetServiceStatus "lasermongodb" Pop $0 ; 返回错误码,0 表示成功,非0 表示失败 Pop $1 ; 返回服务状态,状态值参考 Windows 服务状态代码 ${If} $0 == 0 ${If} $1 == 4 ; 服务状态值为 4 表示服务正在运行 Call un.onPassUninstall ${Else} RMDir /r "$INSTDIR\USER_DATA" Call un.ShowMsgBoxBackUps Pop $0 ${If} $0 == 0 Call un.onPassUninstall ${EndIf} ${If} $0 == 1 Call un.onNoPassUninstall ${EndIf} ${EndIf} ${Else} RMDir /r "$INSTDIR\USER_DATA" Call un.ShowMsgBoxBackUps Pop $0 ${If} $0 == 0 Call un.onPassUninstall ${EndIf} ${If} $0 == 1 Call un.onNoPassUninstall ${EndIf} ${EndIf} ${Else} Call un.onPassUninstall ${EndIf} InstallAbort: FunctionEnd Function un.onNoPassUninstall nsNiuniuSkin::ExitDUISetup FunctionEnd Function un.onPassUninstall ${If} $sReserveData == 1 CreateDirectory $INSTDIR\USER_DATA ${EndIf} Call un.initUninstallingPage nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnClose" "enabled" "false" nsNiuniuSkin::ShowPageItem $hInstallDlg "wizardTab" ${INSTALL_PAGE_UNISTPROCESSING} nsNiuniuSkin::SetControlAttribute $hInstallDlg "slrUnInstProgress" "min" "0" nsNiuniuSkin::SetControlAttribute $hInstallDlg "slrUnInstProgress" "max" "100" IntOp $UnInstallValue 0 + 1 nsNiuniuSkin::SetControlAttribute $hInstallDlg "un_progress_tip" "text" $(PREPARING_TO_UNINSTALL) ; nsExec::ExecToStack "$INSTDIR\tools\laserOtherTools.exe -m b -i $INSTDIR " ; BgWorker::CallAndWait GetFunctionAddress $0 un.OnEnvDownInstall BgWorker::CallAndWait nsExec::ExecToStack 'cmd.exe /c powercfg.exe /hibernate on ' GetFunctionAddress $0 un.installService BgWorker::CallAndWait nsNiuniuSkin::SetControlAttribute $hInstallDlg "un_progress_tip" "text" $(UNINSTALLING) Call un.DeleteShotcutAndInstallInfo IntOp $UnInstallValue $UnInstallValue + 8 GetFunctionAddress $0 un.RemoveFiles BgWorker::CallAndWait FunctionEnd Function un.RemoveFiles ${Locate} "$INSTDIR" "/G=0 /M=*.*" "un.onDeleteFileFound" StrCpy $InstallState "1" ; 卸载成功后创建标记文件 0不用重启 1需要重启 WriteRegStr HKLM "Software\${PRODUCT_PATHNAME}" "reboot" 1 FileClose $0 ; 重启计算机 ; 创建任务计划程序命令 nsExec::ExecToStack 'schtasks /create /tn "DeleteInstallFlagTask" /tr "cmd.exe /C reg add "HKLM\SOFTWARE\4DMega_PC" /v reboot /t REG_SZ /d 2 /f " /sc onstart /ru System /rl HIGHEST /F' nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnClose" "enabled" "true" nsNiuniuSkin::SetControlAttribute $hInstallDlg "slrUnInstProgress" "value" "100" Call un.initUninstallFinishPage nsNiuniuSkin::ShowPageItem $hInstallDlg "wizardTab" ${INSTALL_PAGE_UNISTFINISH} FunctionEnd Function un.onDeleteFileFound ; $R9 "path\name" ; $R8 "path" ; $R7 "name" ; $R6 "size" ($R6 = "" if directory, $R6 = "0" if file with /S=) ; MessageBox MB_OK "R9--------$R9" ; MessageBox MB_OK "R8--------$R8" ; MessageBox MB_OK "R7--------$R7" ;不用保留场景 ${If} $sReserveData == 0 Delete "$R9" RMDir /r "$R9" RMDir "$R9" ${EndIf} ;保留场景 ${If} $sReserveData == 1 ${If} $R7 != "install.flag" RMDir /r "$R8\bin" RMDir /r "$R8\CGAII" RMDir /r "$R8\mongodb" RMDir /r "$R8\mysql" RMDir /r "$R8\redis" RMDir /r "$R8\jdk1.8" ; RMDir /r "$R8\4DKK_PROGRAM_STATIC" ; RMDir /r "$R8\4DKK_PROGRAM_DATA" RMDir /r "$R8\tools" Delete "$R8\uninst.exe" ${EndIf} ${EndIf} IntOp $UnInstallValue $UnInstallValue + 2 ${If} $UnInstallValue > 100 IntOp $UnInstallValue 100 + 0 nsNiuniuSkin::SetControlAttribute $hInstallDlg "slrUnInstProgress" "value" "100" ${Else} nsNiuniuSkin::SetControlAttribute $hInstallDlg "slrUnInstProgress" "value" "$UnInstallValue" nsNiuniuSkin::SetControlAttribute $hInstallDlg "un_progress_pos" "text" "$UnInstallValue%" #Sleep 100 ${EndIf} undelete: Push "LocateNext" FunctionEnd # # 以 Unicode 字符串的方式进行判断 (与 NSIS 是 ANSI/Unicode 无关) # 但建议 Unicode 版本优先使用此函数。 # Function PathIsDBCS_W Exch $R0 Push $R1 Push $R2 Push $R3 System::Call "*(&w${NSIS_MAX_STRLEN}R0)p.R1" StrCpy $R0 0 StrCpy $R2 $R1 lbl_loop: # Unicode 版取 2 个字节长度的字符,字符串遇到 0 字符表示结束了。 System::Call "*$R2(&i2.R3)" IntCmp $R3 0 lbl_done # Unicode 字符直接判断字符值,大于 128 的我们就视为非英文字符。 IntCmp $R3 128 0 lbl_skip IntOp $R0 $R0 ! Goto lbl_done lbl_skip: # 如果用 NSIS 3.x 这里可以用 IntPtrOp 代替。 IntOp $R2 $R2 + 2 Goto lbl_loop lbl_done: System::Free $R1 Pop $R3 Pop $R2 Pop $R1 Exch $R0 FunctionEnd # # 以 ANSI 字符串的方式进行判断 (与 NSIS 是 ANSI/Unicode 无关) # 但建议 ANSI 版本优先使用此函数。 # Function PathIsDBCS_A Exch $R0 Push $R1 Push $R2 Push $R3 Push $R4 System::Call "*(&m${NSIS_MAX_STRLEN}R0)p.R1" StrCpy $R0 0 StrCpy $R2 $R1 lbl_loop: # ANSI 版取 1 个字节长度的字符,字符串遇到 0 字符表示结束了。 System::Call "*$R2(&i1.R3)" IntCmp $R3 0 lbl_done # ANSI 字符用 IsDBCSLeadByte 判断是否双字节字符的前导字节。 System::Call "kernel32::IsDBCSLeadByte(iR3)i.R4" IntCmp $R4 0 lbl_skip IntOp $R0 $R0 ! Goto lbl_done lbl_skip: # 用 CharNextA 得到下一个字符的地址 (可正确处理双字节字符)。 System::Call "user32::CharNextA(pR2)p.R2" Goto lbl_loop lbl_done: Pop $R4 Pop $R3 Pop $R2 Pop $R1 Exch $R0 FunctionEnd # # 当选择的安装路径变更时,路径为空或包含双字节字符 (不限于简体中文),都不允许继续。 # 路径为空时,NSIS 会自行判断。 # # 此示例未判断是否包含空格。如有需要,请与示例一配合使用。 # Function onVerifyInstDir # 检查安装路径是否包含双字节字符 (不限于简体中文)。 StrCpy $0 $INSTDIR StrLen $1 $0 # 这里也可以换成 CheckEnglishPath 以测试效果。 ${If} $1 == 0 Push 2 ${Else} Push $INSTDIR Call PathIsDBCS_A Pop $R0 Push $R0 ${endif} lbl_done: FunctionEnd Function CheckEnglishPath Exch $0 ; 保存返回值的变量 Exch ; 将字符串参数放在栈顶 Push $1 Push $2 Push $3 StrLen $1 $0 ; 计算字符串长度 loop: StrCpy $2 $1 ; 复制当前长度 IntOp $1 $1 - 1 ; 长度减1 StrCpy $3 $0 1 $2 ; 获取当前字符 ${If} $3 == " " ; 如果字符是空格 Goto notEnglish ; 跳转到不是英文路径的逻辑 ${EndIf} ${If} $1 > 0 ; 如果还有字符未检查 Goto loop ; 继续循环 ${EndIf} ; 路径是全英文的 Pop $3 Pop $2 Pop $1 StrCpy $0 0 Exch $0 notEnglish: ; 路径不是全英文的 Pop $3 Pop $2 Pop $1 StrCpy $0 1 Exch $0 FunctionEnd Function onVerifySpecialInstDir # 检查安装路径是否包含双字节字符 (不限于简体中文)。 StrCpy $0 $INSTDIR StrLen $1 $0 # 这里也可以换成 PathIsDBCS_A 以测试效果。 ${If} $1 == 0 Push 2 ${Else} Push $INSTDIR Call CheckSpecialCharacters Pop $0 ; 获取返回结果 Push $R0 ${endif} FunctionEnd Function CheckSpecialCharacters Exch $0 ; 保存返回值的变量 Exch ; 将字符串参数放在栈顶 StrCpy $1 "!@#¥%……&*()!@#$%^&*()<>_+{}[];'?.,~`" ; 特殊字符 StrCpy $2 0 ; 特殊字符字符串索引 StrCpy $3 0 ; 字符串索引 StrLen $4 $0 ; 特殊字符字符串长度 loop: StrCpy $5 $1 1 $2 ; 从特殊字符字符串中获取一个字符 StrCpy $6 $0 1 $3 ; 从需要检查的字符串中获取一个字符 StrCmp $5 "" done ; 如果特殊字符字符串已经检查完,跳转到 done StrCmp $6 "" next ; 如果需要检查的字符串已经检查完,跳转到 next StrCmp $5 $6 found ; 如果找到特殊字符,跳转到 found IntOp $3 $3 + 1 ; 否则,增加需要检查的字符串的索引 Goto loop next: IntOp $2 $2 + 1 ; 增加特殊字符字符串的索引 StrCpy $3 0 ; 重置需要检查的字符串的索引 Goto loop found: StrCpy $0 "1" Goto End done: StrCpy $0 "0" end: Exch $0 ; 将返回值出栈 FunctionEnd Function isEmptyDir # Stack -> # Stack: Exch $0 # Stack: $0 Push $1 # Stack: $1, $0 FindFirst $0 $1 "$0\*.*" strcmp $1 "." 0 _notempty FindNext $0 $1 strcmp $1 ".." 0 _notempty ClearErrors FindNext $0 $1 IfErrors 0 _notempty FindClose $0 Pop $1 # Stack: $0 StrCpy $0 1 Exch $0 # Stack: 1 (true) goto _end _notempty: FindClose $0 ClearErrors Pop $1 # Stack: $0 StrCpy $0 0 Exch $0 # Stack: 0 (false) _end: FunctionEnd Function un.isEmptyDir # Stack -> # Stack: Exch $0 # Stack: $0 Push $1 # Stack: $1, $0 FindFirst $0 $1 "$0\*.*" strcmp $1 "." 0 _notempty FindNext $0 $1 strcmp $1 ".." 0 _notempty ClearErrors FindNext $0 $1 IfErrors 0 _notempty FindClose $0 Pop $1 # Stack: $0 StrCpy $0 1 Exch $0 # Stack: 1 (true) goto _end _notempty: FindClose $0 ClearErrors Pop $1 # Stack: $0 StrCpy $0 0 Exch $0 # Stack: 0 (false) _end: FunctionEnd Function initRegPage nsNiuniuSkin::SetControlAttribute $hInstallDlg "reg_title" "bkimage" $(REG_TITLE) nsNiuniuSkin::SetControlAttribute $hInstallDlg "install_info" "text" $(INSTALL_INFO) nsNiuniuSkin::SetControlAttribute $hInstallDlg "machineCode" "text" $(MACHINE_CODE) nsNiuniuSkin::SetControlAttribute $hInstallDlg "reg_machine_info" "text" $(REG_MACHINE_INFO) nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnCopyMachineinfo" "text" $(BTN_COPY_MACHINEINFO) nsNiuniuSkin::SetControlAttribute $hInstallDlg "installKey" "text" $(INSTALL_KEY) nsNiuniuSkin::SetControlAttribute $hInstallDlg "regPrompt" "text" $(REG_PROMPT) nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnRegConfirm" "text" $(BTN_REG_CONFIRM) FunctionEnd Function initConfigPage nsNiuniuSkin::SetControlAttribute $hInstallDlg "configPageTitle" "bkimage" $(CONFIG_PAGE_TITLE) nsNiuniuSkin::SetControlAttribute $hInstallDlg "configInstallPath" "text" $(CONFIG_INSTALL_PATH) nsNiuniuSkin::SetControlAttribute $hInstallDlg "chkAgree" "text" $(CONFIG_CHK_AGREE) ${If} $LANGUAGE == '1033' nsNiuniuSkin::SetControlAttribute $hInstallDlg "configInstallPath" "width" 115 nsNiuniuSkin::SetControlAttribute $hInstallDlg "configInstallPathTip" "width" 310 nsNiuniuSkin::SetControlAttribute $hInstallDlg "configInstallPathTip" "font" 11 ${ElseIf} $LANGUAGE == '1041' nsNiuniuSkin::SetControlAttribute $hInstallDlg "configInstallPath" "width" 100 nsNiuniuSkin::SetControlAttribute $hInstallDlg "configInstallPathTip" "font" 5 nsNiuniuSkin::SetControlAttribute $hInstallDlg "chkAgree" "width" 190 ${ElseIf} $LANGUAGE == '1042' nsNiuniuSkin::SetControlAttribute $hInstallDlg "configInstallPath" "width" 70 nsNiuniuSkin::SetControlAttribute $hInstallDlg "configInstallPathTip" "font" 5 ${ElseIf} $LANGUAGE == '2052' nsNiuniuSkin::SetControlAttribute $hInstallDlg "configInstallPath" "width" 60 nsNiuniuSkin::SetControlAttribute $hInstallDlg "configInstallPathTip" "font" 5 ${EndIf} nsNiuniuSkin::SetControlAttribute $hInstallDlg "configInstallPathTip" "text" $(CONFIG_INSTALL_PATH_TIP) nsNiuniuSkin::SetControlAttribute $hInstallDlg "configUseSpace" "text" $(CONFIG_USE_SPACE) nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnAgreement" "text" $(CONFIG_BTN_AGREEMENT) nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnInstall" "text" $(CONFIG_BTN_INSTALL) FunctionEnd Function initLicensePage nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnAgree" "text" $(LICENSE_BTN_AGREE) FunctionEnd Function initInstallingPage nsNiuniuSkin::SetControlAttribute $hInstallDlg "InstallingTitle" "bkimage" $(INSTALLING_TITLE) FunctionEnd Function initFinishPage nsNiuniuSkin::SetControlAttribute $hInstallDlg "FinishPageTitle" "bkimage" $(FINISH_PAGE_TITLE) nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnRun" "text" $(BTN_RUN) FunctionEnd Function un.initUnInstallPage nsNiuniuSkin::SetControlAttribute $hInstallDlg "unInstallTitle" "bkimage" $(UN_INSTALL_TITLE) nsNiuniuSkin::SetControlAttribute $hInstallDlg "unInstallPrompt" "text" $(UN_INSTALL_PROMPT) nsNiuniuSkin::SetControlAttribute $hInstallDlg "chkbox_userdata" "text" $(UN_INSTALL_CHKBOX_USERDATA) nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnUnInstall" "text" $(BTN_CONFIRM) nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnUnClose" "text" $(BTN_CANCEL) FunctionEnd Function un.initUninstallingPage nsNiuniuSkin::SetControlAttribute $hInstallDlg "unInstallingTitle" "bkimage" $(UN_INSTALL_TITLE) FunctionEnd Function un.initUninstallFinishPage nsNiuniuSkin::SetControlAttribute $hInstallDlg "unInstallFinishTitle" "bkimage" $(UN_INSTALL_TITLE) nsNiuniuSkin::SetControlAttribute $hInstallDlg "unInstallFinishPrompt" "text" $(UN_INSTALL_FINISH_PROMPT) nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnUninstalled" "text" $(BTN_UNINSTALLED) nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnUninstalledReboot" "text" $(BTN_UNINSTALLED_REBOOT) FunctionEnd