1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867 |
-
- !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 "四维看看本地版", 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 "四维看看本地版", 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 "四维看看本地版", i ${MB_OK})i .r1'
- Quit
- ${EndIf}
- ${If} $R0 == "1"
- System::Call 'USER32::MessageBox(i $hwndparent, t "版本 $OLD_VER 已安装在计算机中。如需重新安装,请卸载已有的安装", t "四维看看本地版", i ${MB_OK})i .r1'
- Quit
- ${EndIf}
- ${If} $R0 == "2"
- System::Call 'USER32::MessageBox(i $hwndparent, t "您安装的版本是 ${PRODUCT_VERSION} ,高于版本 $OLD_VER,可以执行更新操作", t "四维看看本地版", 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 "四维看看本地版", 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::RemoveService "lasermysql"
- nsExec::ExecToStack '"cmd.exe" /c $INSTDIR\mysql\bin\mysqld.exe --install lasermysql --defaults-file="$INSTDIR\mysql\my.ini"'
- 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).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\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 --defaults-file="$INSTDIR\mysql\my.ini"'
- 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 --defaults-file="$INSTDIR\mysql\my.ini"'
- ; ${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\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: <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
|