12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712 |
-
- !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"
- 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 temp12
- Var OLD_VER
- Var vc_flag
- Var machine
- Var regCode
- Var update
- !include "ui_laser_lang.nsi"
- Function SelectLanguage
- ;根据windowsapi返回值选择语言,不支持语言默认显示英文
- System::Call 'Kernel32::GetUserDefaultUILanguage() i.r0'
- ${If} $0 == '2052'
- StrCpy $LANGUAGE $0
- ${Else}
- StrCpy $LANGUAGE 1033
- ${EndIf}
- FunctionEnd
- ;在安装程序运行前的回调函数前实现
- Function .onInit
- Debug::Watcher
- Call SelectLanguage
- Call checkInstall
- Push ""
- Push ${LANG_ENGLISH} ;添加英文代码 语言代码是系统变量,多语言引入后,自动加载,拼接方式是“LANG_语言”,可以查看NSIS手册,LANG_ENGLISH的编号为1033,LANG_SIMPCHINESE为2052;
- Push "English"
- Push ${LANG_SIMPCHINESE} ;添加简体中文选项
- Push "简体中文"
- Push ${LANG_JAPANESE}
- Push "日本語"
- Push ${LANG_KOREAN}
- Push "한국어"
- Push A ; A means auto count languages for the auto count to work the first empty push (Push "") must remain
- ${If} $0 == '2052'
- LangDLL::LangDialog "安装程序语言" "请选择安装程序的语言" ;显示语言选择对话框
- ${ElseIf} $0 == '1033'
- LangDLL::LangDialog "Installer Language" "Please select the language of the installer" ;显示语言选择对话框
- ${ElseIf} $0 == '1041'
- LangDLL::LangDialog "インストーラ言語" "インストーラの言語を選択してください" ;显示语言选择对话框
- ${ElseIf} $0 == '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'
- MessageBox MB_OK|MB_USERICON "An installation wizard is already running, please do not turn it on repeatedly."
- Abort
- ${ElseIf} $LANGUAGE == '1041'
- MessageBox MB_OK|MB_USERICON "インストールが既に起動されています。重複起動を避けてください。"
- Abort
- ${ElseIf} $LANGUAGE == '1042'
- MessageBox MB_OK|MB_USERICON "설치 마법사가 이미 실행 중입니다. 반복적으로 켜지 마십시오."
- Abort
- ${ElseIf} $LANGUAGE == '2052'
- MessageBox MB_OK|MB_USERICON "有一个安装向导已经运行,请勿重复打开。"
- Abort
- ${Else}
- MessageBox MB_OK|MB_USERICON "An installation wizard is already running, please do not turn it on repeatedly."
- Abort
- ${EndIf}
- Goto END
- SKIP:
- Goto END
- END:
- FunctionEnd
- Function startCheck
- StrCpy $update "1"
- ${IfNot} ${AtLeastWin10}
- MessageBox MB_OK|MB_USERICON "本程序只能安装在windows-10(64位)系统及以上"
- 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"
- MessageBox MB_OK|MB_USERICON '版本 $OLD_VER 已安装在计算机中。如需重新安装,请卸载已有的安装'
- Quit
- ${EndIf}
- ${If} $R0 == "1"
- MessageBox MB_OK|MB_USERICON '版本 $OLD_VER 已安装在计算机中。如需重新安装,请卸载已有的安装'
- Quit
- ${EndIf}
- ${If} $R0 == "2"
- MessageBox MB_OK|MB_USERICON '您安装的版本是 ${PRODUCT_VERSION} ,高于版本 $OLD_VER,可以执行更新操作 '
- StrCpy $update "0"
- ${EndIf}
- ${EndIf}
- FunctionEnd
- Function startCheckEn
- StrCpy $update "1"
- ${IfNot} ${AtLeastWin10}
- MessageBox MB_OK|MB_USERICON "This program can only be installed on Windows 10 (64-bit) and updated systems."
- 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"
- MessageBox MB_OK|MB_USERICON 'Version $OLD_VER is installed on the computer. To reinstall,please uninstall the existing version first.'
- Quit
- ${EndIf}
- ${If} $R0 == "1"
- MessageBox MB_OK|MB_USERICON 'Version $OLD_VER is installed on the computer. To reinstall,please uninstall the existing version first.'
- Quit
- ${EndIf}
- ${If} $R0 == "2"
- MessageBox MB_OK|MB_USERICON 'The version you are installing is ${PRODUCT_VERSION}, which is newer than version $OLD_VER, and it can perform the updated operation'
- StrCpy $update "0"
- ${EndIf}
- ${EndIf}
- FunctionEnd
- Function startCheckKr
- StrCpy $update "1"
- ${IfNot} ${AtLeastWin10}
- MessageBox MB_OK|MB_USERICON "このプログラムは、 Windows-10(64ビット)システム以上にのみインストールできます。"
- 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"
- MessageBox MB_OK|MB_USERICON '$OLD_VER 버전이 컴퓨터에 설치되어 있습니다.다시 설치하려면 먼저 기존 버전을 제거하십시오.'
- Quit
- ${EndIf}
- ${If} $R0 == "1"
- MessageBox MB_OK|MB_USERICON '$OLD_VER 버전이 컴퓨터에 설치되어 있습니다.다시 설치하려면 먼저 기존 버전을 제거하십시오.'
- Quit
- ${EndIf}
- ${If} $R0 == "2"
- MessageBox MB_OK|MB_USERICON '설치하는 버전은 $OLD_VER 버전보다 최신 버전인 ${PRODUCT_VERSION} 이며 업데이트된 작업을 수행할 수 있습니다. '
- StrCpy $update "0"
- ${EndIf}
- ${EndIf}
- FunctionEnd
- Function startCheckJp
- StrCpy $update "1"
- ${IfNot} ${AtLeastWin10}
- MessageBox MB_OK|MB_USERICON "이 프로그램은 Windows 10 (64 비트) 및 업데이트된 시스템에만 설치할 수 있습니다."
- 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"
- MessageBox MB_OK|MB_USERICON 'バージョン $OLD_VER が既にインストールされていました。再インストールするには、既存のインストールをアンインストールしてください。'
- Quit
- ${EndIf}
- ${If} $R0 == "1"
- MessageBox MB_OK|MB_USERICON 'バージョン $OLD_VER が既にインストールされていました。再インストールするには、既存のインストールをアンインストールしてください。'
- Quit
- ${EndIf}
- ${If} $R0 == "2"
- MessageBox MB_OK|MB_USERICON '現在インストールのバージョン:${PRODUCT_VERSION}、バージョン $OLD_VER より新しいです。アップデートが可能です。 '
- StrCpy $update "0"
- ${EndIf}
- ${EndIf}
- FunctionEnd
- Function un.checkInstall
- SetRegView 64
- 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'
- MessageBox MB_OK|MB_USERICON "An installation wizard is already running, please do not turn it on repeatedly."
- Abort
- ${ElseIf} $LANGUAGE == '1041'
- MessageBox MB_OK|MB_USERICON "インストールが既に起動されています。重複起動を避けてください。"
- Abort
- ${ElseIf} $LANGUAGE == '1042'
- MessageBox MB_OK|MB_USERICON "설치 마법사가 이미 실행 중입니다. 반복적으로 켜지 마십시오."
- Abort
- ${ElseIf} $LANGUAGE == '2052'
- MessageBox MB_OK|MB_USERICON "有一个安装向导已经运行,请勿重复打开。"
- Abort
- ${Else}
- MessageBox MB_OK|MB_USERICON "An installation wizard is already running, please do not turn it on repeatedly."
- Abort
- ${EndIf}
- Goto END
- SKIP:
- Goto END
- END:
- FunctionEnd
- Function un.onInit
- ;Debug::Watcher
- SetRegView 64
- Call un.checkInstall
- FunctionEnd
- Function DUIPage
- StrCpy $InstallState "0"
- InitPluginsDir
- SetOutPath "$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
- 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::SetWindowTile $hInstallDlg "$(PRODUCT_NAME_LANG)$(SETUP)"
- 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}$(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"
- 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}
- 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"
- ${Else}
- nsNiuniuSkin::SetControlAttribute $hInstallDlg "local_space" "text" "$(REMAINING_SPACE):$R0.$R1MB"
- ${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
- 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}
- ; MessageBox MB_OK|MB_USERICON '$INSTDIR\install.flag'
- ${If} ${FileExists} "$INSTDIR\install.flag"
- SetRebootFlag true
- MessageBox MB_OK $(REBOOT_PROMPT)
- 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} $(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}
- 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\四维看看本地版.lnk"
- Delete "$DESKTOP\4DKanKan.lnk"
- CreateShortCut "$DESKTOP\$(PRODUCT_NAME_LANG).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
- 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
- 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::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"
- nsNiuniuSkin::ShowPageItem $hInstallDlg "wizardTab" ${INSTALL_PAGE_FINISH}
- Call initFinishPage
- #Call OnFinished
- ${If} $update == "0"
- nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnRun" "text" $(UPDATING_DONE)
- ${EndIf}
- nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnClose" "enabled" "true"
- ;完成安装删除计划任务
- nsExec::ExecToStack 'schtasks /delete /tn "DeleteInstallFlagTask" /f'
- 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}
- 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'
- ; 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'
- 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'
- SimpleSC::StartService "lasermongodb" "" 30
- Sleep 2000
- ; 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
- 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::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}"
- nsExec::ExecToStack 'ie4uinit.exe -ClearIconCache'
- nsExec::ExecToStack 'ie4uinit.exe -show'
- System::Call 'shell32.dll::SHChangeNotify(l, l, i, i) v (0x08000000, 0, 0, 0)'
- WriteRegStr HKLM "Software\${PRODUCT_PATHNAME}" "language" $LANGUAGE
- 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 "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(l, l, i, i) v (0x08000000, 0, 0, 0)'
- 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} 正在运行,请退出后重试!"
- 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"
- ; 卸载成功后创建标记文件
- FileOpen $0 "$INSTDIR\install.flag" w
- FileClose $0
- ; 重启计算机
- ; 创建任务计划程序命令
- nsExec::ExecToStack 'schtasks /create /tn "DeleteInstallFlagTask" /tr "cmd.exe /C del $INSTDIR\install.flag" /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
- ${If} $R7 != "install.flag"
- Delete "$R9"
- RMDir /r "$R9"
- RMDir "$R9"
- ${EndIf}
- ${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: <directory>
- 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: <directory>
- 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
|