ui_laser_setup.nsh 109 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761
  1. 
  2. !include "StrFunc.nsh"
  3. !include "WordFunc.nsh"
  4. ${StrRep}
  5. ${StrStr}
  6. !include "LogicLib.nsh"
  7. !include "nsDialogs.nsh"
  8. !include "common.nsh"
  9. !include "x64.nsh"
  10. !include "MUI2.nsh"
  11. !include "WinVer.nsh"
  12. !include "commonfunc.nsh"
  13. VIProductVersion "${PRODUCT_VERSION}"
  14. VIAddVersionKey "ProductVersion" "${PRODUCT_VERSION}"
  15. VIAddVersionKey "ProductName" "${PRODUCT_NAME}"
  16. VIAddVersionKey "CompanyName" "${PRODUCT_PUBLISHER}"
  17. VIAddVersionKey "FileVersion" "${PRODUCT_VERSION}"
  18. VIAddVersionKey "InternalName" "${EXE_NAME}"
  19. VIAddVersionKey "FileDescription" "${PRODUCT_NAME}"
  20. VIAddVersionKey "LegalCopyright" "${PRODUCT_LEGAL}"
  21. !define INSTALL_PAGE_REG 0
  22. !define INSTALL_PAGE_CONFIG 1
  23. ;!define INSTALL_PAGE_LICENSE 1
  24. !define INSTALL_PAGE_PROCESSING 2
  25. !define INSTALL_PAGE_FINISH 3
  26. !define INSTALL_PAGE_UNISTCONFIG 4
  27. !define INSTALL_PAGE_UNISTPROCESSING 5
  28. !define INSTALL_PAGE_UNISTFINISH 6
  29. Page custom DUIPage
  30. UninstPage custom un.DUIPage
  31. Var hInstallDlg
  32. Var hInstallSubDlg
  33. Var sSetupPath
  34. Var sReserveData
  35. Var InstallState
  36. Var UnInstallValue
  37. Var basedir
  38. Var datadir
  39. Var logError
  40. Var buildModelPath
  41. Var profilePath
  42. Var buildCallPath
  43. Var dbpath
  44. Var logpath
  45. Var binPath
  46. Var javaPath
  47. Var temp12
  48. Var OLD_VER
  49. Var vc_flag
  50. Var irealPath
  51. Var smart3DPath
  52. Var langLoop
  53. Var machine
  54. Var regCode
  55. Var update
  56. !include "ui_laser_lang.nsi"
  57. Function SelectLanguage
  58. ;根据windowsapi返回值选择语言,不支持语言默认显示英文
  59. System::Call 'Kernel32::GetUserDefaultUILanguage() i.r0'
  60. ${If} $0 == '2052'
  61. StrCpy $LANGUAGE $0
  62. ${Else}
  63. StrCpy $LANGUAGE 1033
  64. ${EndIf}
  65. FunctionEnd
  66. Function langSelectPush
  67. Push ""
  68. ; Start dynamic language pushing
  69. StrCpy $0 0
  70. ; Get the length of LANG_LIST
  71. StrLen $1 ${LANG_LIST}
  72. loop:
  73. ; If we reached the end of the list, exit the loop
  74. IntCmp $0 $1 done
  75. ; Get the next language code (2 characters)
  76. StrCpy $2 ${LANG_LIST} 2 $0
  77. ; Determine the language and push its code and name
  78. ${If} $2 == "zh"
  79. Push ${LANG_SIMPCHINESE}
  80. Push "简体中文"
  81. ${ElseIf} $2 == "en"
  82. Push ${LANG_ENGLISH}
  83. Push "English"
  84. ${ElseIf} $2 == "ja"
  85. Push ${LANG_JAPANESE}
  86. Push "日本語"
  87. ${ElseIf} $2 == "kr"
  88. Push ${LANG_KOREAN}
  89. Push "한국어"
  90. ${ElseIf} $2 == ""
  91. Goto done
  92. ${EndIf}
  93. ; Move to the next language code in the list
  94. IntOp $0 $0 + 3
  95. ; Loop again
  96. Goto loop
  97. done:
  98. FunctionEnd
  99. ;在安装程序运行前的回调函数前实现
  100. Function .onInit
  101. Debug::Watcher
  102. Call SelectLanguage
  103. Call checkInstall
  104. Call langSelectPush
  105. Push A ; A means auto count languages for the auto count to work the first empty push (Push "") must remain
  106. ${If} $0 == '2052'
  107. LangDLL::LangDialog "安装程序语言" "请选择安装程序的语言" ;显示语言选择对话框
  108. ${ElseIf} $0 == '1033'
  109. LangDLL::LangDialog "Installer Language" "Please select the language of the installer" ;显示语言选择对话框
  110. ${ElseIf} $0 == '1041'
  111. LangDLL::LangDialog "インストーラ言語" "インストーラの言語を選択してください" ;显示语言选择对话框
  112. ${ElseIf} $0 == '1042'
  113. LangDLL::LangDialog "설치 프로그램 언어" "설치 프로그램의 언어를 선택하십시오" ;显示语言选择对话框
  114. ${Else}
  115. LangDLL::LangDialog "Installer Language" "Please select the language of the installer" ;显示语言选择对话框
  116. ${EndIf}
  117. Pop $LANGUAGE ;获得用户对于语言的选择结果 ‘$LANGUAGE’是多语言变量,在安装程序结束后,语言代码会存储在这个变量中,手动修改‘$LANGUAGE’的值后,安装包会重新选择最匹配的语言,参考最上面NSIS手册中选择界面语言步骤
  118. StrCmp $LANGUAGE "cancel" 0 +2
  119. Abort
  120. ${If} $LANGUAGE == '1033'
  121. Call startCheckEn
  122. ${ElseIf} $LANGUAGE == '1041'
  123. Call startCheckJp
  124. ${ElseIf} $LANGUAGE == '1042'
  125. Call startCheckKr
  126. ${ElseIf} $LANGUAGE == '2052'
  127. Call startCheck
  128. ${Else}
  129. Call startCheckEn
  130. ${EndIf}
  131. FunctionEnd
  132. Function checkInstall
  133. System::Call 'kernel32::CreateMutexA(i 0, i 0, t"Winsnap_installer") i .r1 ?e'
  134. Pop $R0
  135. StrCmp $R0 0 SKIP RUN
  136. RUN:
  137. ${If} $LANGUAGE == '1033'
  138. MessageBox MB_OK|MB_USERICON "An installation wizard is already running, please do not turn it on repeatedly."
  139. Abort
  140. ${ElseIf} $LANGUAGE == '1041'
  141. MessageBox MB_OK|MB_USERICON "インストールが既に起動されています。重複起動を避けてください。"
  142. Abort
  143. ${ElseIf} $LANGUAGE == '1042'
  144. MessageBox MB_OK|MB_USERICON "설치 마법사가 이미 실행 중입니다. 반복적으로 켜지 마십시오."
  145. Abort
  146. ${ElseIf} $LANGUAGE == '2052'
  147. MessageBox MB_OK|MB_USERICON "有一个安装向导已经运行,请勿重复打开。"
  148. Abort
  149. ${Else}
  150. MessageBox MB_OK|MB_USERICON "An installation wizard is already running, please do not turn it on repeatedly."
  151. Abort
  152. ${EndIf}
  153. Goto END
  154. SKIP:
  155. Goto END
  156. END:
  157. FunctionEnd
  158. Function startCheck
  159. StrCpy $update "1"
  160. ${IfNot} ${AtLeastWin10}
  161. MessageBox MB_OK|MB_USERICON "本程序只能安装在windows-10(64位)系统及以上"
  162. Abort
  163. ${EndIf}
  164. SetRegView 64
  165. ReadRegStr $OLD_VER HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_PATHNAME}" "DisplayVersion"
  166. ${IF} $OLD_VER != ""
  167. ${VersionCompare} $OLD_VER ${PRODUCT_VERSION} $R0
  168. ${If} $R0 == "0"
  169. MessageBox MB_OK|MB_USERICON '版本 $OLD_VER 已安装在计算机中。如需重新安装,请卸载已有的安装'
  170. Quit
  171. ${EndIf}
  172. ${If} $R0 == "1"
  173. MessageBox MB_OK|MB_USERICON '版本 $OLD_VER 已安装在计算机中。如需重新安装,请卸载已有的安装'
  174. Quit
  175. ${EndIf}
  176. ${If} $R0 == "2"
  177. MessageBox MB_OK|MB_USERICON '您安装的版本是 ${PRODUCT_VERSION} ,高于版本 $OLD_VER,可以执行更新操作 '
  178. StrCpy $update "0"
  179. ${EndIf}
  180. ${EndIf}
  181. FunctionEnd
  182. Function startCheckEn
  183. StrCpy $update "1"
  184. ${IfNot} ${AtLeastWin10}
  185. MessageBox MB_OK|MB_USERICON "This program can only be installed on Windows 10 (64-bit) and updated systems."
  186. Abort
  187. ${EndIf}
  188. SetRegView 64
  189. ReadRegStr $OLD_VER HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_PATHNAME}" "DisplayVersion"
  190. ${IF} $OLD_VER != ""
  191. ${VersionCompare} $OLD_VER ${PRODUCT_VERSION} $R0
  192. ${If} $R0 == "0"
  193. MessageBox MB_OK|MB_USERICON 'Version $OLD_VER is installed on the computer. To reinstall,please uninstall the existing version first.'
  194. Quit
  195. ${EndIf}
  196. ${If} $R0 == "1"
  197. MessageBox MB_OK|MB_USERICON 'Version $OLD_VER is installed on the computer. To reinstall,please uninstall the existing version first.'
  198. Quit
  199. ${EndIf}
  200. ${If} $R0 == "2"
  201. 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'
  202. StrCpy $update "0"
  203. ${EndIf}
  204. ${EndIf}
  205. FunctionEnd
  206. Function startCheckKr
  207. StrCpy $update "1"
  208. ${IfNot} ${AtLeastWin10}
  209. MessageBox MB_OK|MB_USERICON "このプログラムは、 Windows-10(64ビット)システム以上にのみインストールできます。"
  210. Abort
  211. ${EndIf}
  212. SetRegView 64
  213. ReadRegStr $OLD_VER HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_PATHNAME}" "DisplayVersion"
  214. ${IF} $OLD_VER != ""
  215. ${VersionCompare} $OLD_VER ${PRODUCT_VERSION} $R0
  216. ${If} $R0 == "0"
  217. MessageBox MB_OK|MB_USERICON '$OLD_VER 버전이 컴퓨터에 설치되어 있습니다.다시 설치하려면 먼저 기존 버전을 제거하십시오.'
  218. Quit
  219. ${EndIf}
  220. ${If} $R0 == "1"
  221. MessageBox MB_OK|MB_USERICON '$OLD_VER 버전이 컴퓨터에 설치되어 있습니다.다시 설치하려면 먼저 기존 버전을 제거하십시오.'
  222. Quit
  223. ${EndIf}
  224. ${If} $R0 == "2"
  225. MessageBox MB_OK|MB_USERICON '설치하는 버전은 $OLD_VER 버전보다 최신 버전인 ${PRODUCT_VERSION} 이며 업데이트된 작업을 수행할 수 있습니다. '
  226. StrCpy $update "0"
  227. ${EndIf}
  228. ${EndIf}
  229. FunctionEnd
  230. Function startCheckJp
  231. StrCpy $update "1"
  232. ${IfNot} ${AtLeastWin10}
  233. MessageBox MB_OK|MB_USERICON "이 프로그램은 Windows 10 (64 비트) 및 업데이트된 시스템에만 설치할 수 있습니다."
  234. Abort
  235. ${EndIf}
  236. SetRegView 64
  237. ReadRegStr $OLD_VER HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_PATHNAME}" "DisplayVersion"
  238. ${IF} $OLD_VER != ""
  239. ${VersionCompare} $OLD_VER ${PRODUCT_VERSION} $R0
  240. ${If} $R0 == "0"
  241. MessageBox MB_OK|MB_USERICON 'バージョン $OLD_VER が既にインストールされていました。再インストールするには、既存のインストールをアンインストールしてください。'
  242. Quit
  243. ${EndIf}
  244. ${If} $R0 == "1"
  245. MessageBox MB_OK|MB_USERICON 'バージョン $OLD_VER が既にインストールされていました。再インストールするには、既存のインストールをアンインストールしてください。'
  246. Quit
  247. ${EndIf}
  248. ${If} $R0 == "2"
  249. MessageBox MB_OK|MB_USERICON '現在インストールのバージョン:${PRODUCT_VERSION}、バージョン $OLD_VER より新しいです。アップデートが可能です。 '
  250. StrCpy $update "0"
  251. ${EndIf}
  252. ${EndIf}
  253. FunctionEnd
  254. Function un.checkInstall
  255. SetRegView 64
  256. ReadRegStr $LANGUAGE HKLM "Software\${PRODUCT_PATHNAME}" "language"
  257. System::Call 'kernel32::CreateMutexA(i 0, i 0, t"Winsnap_installer") i .r1 ?e'
  258. Pop $R0
  259. StrCmp $R0 0 SKIP RUN
  260. RUN:
  261. ${If} $LANGUAGE == '1033'
  262. MessageBox MB_OK|MB_USERICON "An installation wizard is already running, please do not turn it on repeatedly."
  263. Abort
  264. ${ElseIf} $LANGUAGE == '1041'
  265. MessageBox MB_OK|MB_USERICON "インストールが既に起動されています。重複起動を避けてください。"
  266. Abort
  267. ${ElseIf} $LANGUAGE == '1042'
  268. MessageBox MB_OK|MB_USERICON "설치 마법사가 이미 실행 중입니다. 반복적으로 켜지 마십시오."
  269. Abort
  270. ${ElseIf} $LANGUAGE == '2052'
  271. MessageBox MB_OK|MB_USERICON "有一个安装向导已经运行,请勿重复打开。"
  272. Abort
  273. ${Else}
  274. MessageBox MB_OK|MB_USERICON "An installation wizard is already running, please do not turn it on repeatedly."
  275. Abort
  276. ${EndIf}
  277. Goto END
  278. SKIP:
  279. Goto END
  280. END:
  281. FunctionEnd
  282. Function un.onInit
  283. ;Debug::Watcher
  284. SetRegView 64
  285. Call un.checkInstall
  286. FunctionEnd
  287. Function DUIPage
  288. StrCpy $InstallState "0"
  289. InitPluginsDir
  290. SetOutPath "$PLUGINSDIR"
  291. File "${INSTALL_LICENCE_FILENAME_ZH}"
  292. File "${INSTALL_LICENCE_FILENAME_EN}"
  293. File "${INSTALL_RES_PATH}"
  294. File /oname=logo.ico "${INSTALL_ICO}"
  295. ; File /oname=4dage.exe "${INSTALL_REG}"
  296. StrCmp $LANGUAGE 2052 ZH_INI EN_INI
  297. EN_INI:
  298. nsNiuniuSkin::InitSkinPage "$PLUGINSDIR\" "${INSTALL_LICENCE_FILENAME_EN}"
  299. Goto END
  300. ZH_INI:
  301. nsNiuniuSkin::InitSkinPage "$PLUGINSDIR\" "${INSTALL_LICENCE_FILENAME_ZH}"
  302. Goto END
  303. END:
  304. Pop $hInstallDlg
  305. ; MessageBox MB_OK "Exit code:$machine"
  306. Call initConfigPage
  307. Call BindUIControls
  308. nsExec::ExecToStack 'cmd.exe /c powercfg.exe /hibernate on '
  309. ${If} $update == "1"
  310. ;新装
  311. ;生成安装路径,包含识别旧的安装路径
  312. Call GenerateSetupAddress
  313. #设置控件显示安装路径
  314. nsNiuniuSkin::SetControlAttribute $hInstallDlg "editDir" "text" "$INSTDIR\"
  315. Call OnRichEditTextChange
  316. #nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnAgreement" "text" " 用户许可协议"
  317. ${Else}
  318. ;更新
  319. SetRegView 64
  320. ReadRegStr $0 HKLM "Software\${PRODUCT_PATHNAME}" "InstPath"
  321. ${If} "$0" != "" #路径不存在,则重新选择路径
  322. #路径读取到了,直接使用
  323. #再判断一下这个路径是否有效
  324. nsNiuniuSkin::StringHelper "$0" "\\" "\" "replace"
  325. Pop $0
  326. StrCpy $INSTDIR "$0"
  327. ${EndIf}
  328. #设置控件显示安装路径
  329. nsNiuniuSkin::SetControlAttribute $hInstallDlg "editDir" "text" "$INSTDIR\"
  330. Call OnRichEditTextChange
  331. nsNiuniuSkin::SetControlAttribute $hInstallDlg "editDir" "enabled" "false"
  332. nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnSelectDir" "visible" "false"
  333. nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnInstall" "text" $(ONE_CLICK_UPDATE)
  334. ${EndIf}
  335. ;设置安装包的标题及任务栏显示
  336. nsNiuniuSkin::SetWindowTile $hInstallDlg "$(PRODUCT_NAME_LANG)$(SETUP)"
  337. nsNiuniuSkin::ShowPageItem $hInstallDlg "wizardTab" ${INSTALL_PAGE_CONFIG}
  338. nsNiuniuSkin::SetControlAttribute $hInstallDlg "licensename" "text" $(USER_LICENSE_AGREEMENT)
  339. nsNiuniuSkin::ShowPage 0
  340. FunctionEnd
  341. Function un.DUIPage
  342. StrCpy $InstallState "0"
  343. InitPluginsDir
  344. SetOutPath "$PLUGINSDIR"
  345. File "${INSTALL_RES_PATH}"
  346. File /oname=logo.ico "${UNINSTALL_ICO}"
  347. nsNiuniuSkin::InitSkinPage "$PLUGINSDIR\" ""
  348. Pop $hInstallDlg
  349. nsNiuniuSkin::ShowPageItem $hInstallDlg "wizardTab" ${INSTALL_PAGE_UNISTCONFIG}
  350. Call un.initUnInstallPage
  351. nsNiuniuSkin::SetWindowTile $hInstallDlg "${PRODUCT_NAME}$(UNINSTALL_SETUP)"
  352. nsNiuniuSkin::SetWindowSize $hInstallDlg 480 390s
  353. Call un.BindUnInstUIControls
  354. nsNiuniuSkin::SetControlAttribute $hInstallDlg "chkAutoRun" "selected" "true"
  355. nsNiuniuSkin::ShowPage 0
  356. FunctionEnd
  357. Function un.BindUnInstUIControls
  358. GetFunctionAddress $0 un.ExitDUISetup
  359. nsNiuniuSkin::BindCallBack $hInstallDlg "btnUninstalled" $0
  360. GetFunctionAddress $0 un.onUninstall
  361. nsNiuniuSkin::BindCallBack $hInstallDlg "btnUnInstall" $0
  362. GetFunctionAddress $0 un.ExitDUISetup
  363. nsNiuniuSkin::BindCallBack $hInstallDlg "btnClose" $0
  364. GetFunctionAddress $0 un.ExitDUISetup
  365. nsNiuniuSkin::BindCallBack $hInstallDlg "btnUnClose" $0
  366. GetFunctionAddress $0 un.OnBtnMin
  367. nsNiuniuSkin::BindCallBack $hInstallDlg "btnFinishedMin" $0
  368. GetFunctionAddress $0 un.BtnDirPre
  369. nsNiuniuSkin::BindCallBack $hInstallDlg "btnDirPre" $0
  370. ; GetFunctionAddress $0 un.onNoPassUninstall
  371. ; nsNiuniuSkin::BindCallBack $hInstallDlg "backupBtnOK" $0
  372. ; GetFunctionAddress $0 un.onPassUninstall
  373. ; nsNiuniuSkin::BindCallBack $hInstallDlg "gotouninstall" $0
  374. GetFunctionAddress $0 un.OnbtnUninstalledReboot
  375. nsNiuniuSkin::BindCallBack $hInstallDlg "btnUninstalledReboot" $0
  376. FunctionEnd
  377. Function BindUIControls
  378. GetFunctionAddress $0 OnExitDUISetup
  379. nsNiuniuSkin::BindCallBack $hInstallDlg "btnLicenseClose" $0
  380. GetFunctionAddress $0 OnBtnMin
  381. nsNiuniuSkin::BindCallBack $hInstallDlg "btnLicenseMin" $0
  382. GetFunctionAddress $0 OnBtnLicenseClick
  383. nsNiuniuSkin::BindCallBack $hInstallDlg "btnAgreement" $0
  384. GetFunctionAddress $0 OnExitDUISetup
  385. nsNiuniuSkin::BindCallBack $hInstallDlg "btnDirClose" $0
  386. GetFunctionAddress $0 OnExitDUISetup
  387. nsNiuniuSkin::BindCallBack $hInstallDlg "btnLicenseCancel" $0
  388. GetFunctionAddress $0 OnBtnMin
  389. nsNiuniuSkin::BindCallBack $hInstallDlg "btnDirMin" $0
  390. GetFunctionAddress $0 OnBtnSelectDir
  391. nsNiuniuSkin::BindCallBack $hInstallDlg "btnSelectDir" $0
  392. GetFunctionAddress $0 OnBtnDirPre
  393. nsNiuniuSkin::BindCallBack $hInstallDlg "btnDirPre" $0
  394. GetFunctionAddress $0 OnBtnShowConfig
  395. nsNiuniuSkin::BindCallBack $hInstallDlg "btnAgree" $0
  396. GetFunctionAddress $0 OnBtnCancel
  397. nsNiuniuSkin::BindCallBack $hInstallDlg "btnDirCancel" $0
  398. GetFunctionAddress $0 OnBtnInstall
  399. nsNiuniuSkin::BindCallBack $hInstallDlg "btnInstall" $0
  400. GetFunctionAddress $0 OnExitDUISetup
  401. nsNiuniuSkin::BindCallBack $hInstallDlg "btnDetailClose" $0
  402. GetFunctionAddress $0 OnBtnMin
  403. nsNiuniuSkin::BindCallBack $hInstallDlg "btnDetailMin" $0
  404. GetFunctionAddress $0 OnFinished
  405. nsNiuniuSkin::BindCallBack $hInstallDlg "btnRun" $0
  406. GetFunctionAddress $0 OnBtnMin
  407. nsNiuniuSkin::BindCallBack $hInstallDlg "btnFinishedMin" $0
  408. GetFunctionAddress $0 OnExitDUISetup
  409. nsNiuniuSkin::BindCallBack $hInstallDlg "btnClose" $0
  410. GetFunctionAddress $0 OnCheckLicenseClick
  411. nsNiuniuSkin::BindCallBack $hInstallDlg "chkAgree" $0
  412. GetFunctionAddress $0 OnBtnShowMore
  413. nsNiuniuSkin::BindCallBack $hInstallDlg "btnShowMore" $0
  414. GetFunctionAddress $0 OnBtnHideMore
  415. nsNiuniuSkin::BindCallBack $hInstallDlg "btnHideMore" $0
  416. GetFunctionAddress $0 OnSysCommandCloseEvent
  417. nsNiuniuSkin::BindCallBack $hInstallDlg "syscommandclose" $0
  418. GetFunctionAddress $0 OnRichEditTextChange
  419. nsNiuniuSkin::BindCallBack $hInstallDlg "editDir" $0
  420. FunctionEnd
  421. Function un.OnbtnUninstalledReboot
  422. ; MessageBox MB_OK "OnbtnUninstalledR:eboot--Reboot"
  423. Reboot
  424. FunctionEnd
  425. Function OnRichEditTextChange
  426. nsNiuniuSkin::GetControlAttribute $hInstallDlg "editDir" "text"
  427. Pop $0
  428. StrCpy $INSTDIR "$0"
  429. Call onVerifyInstDir
  430. Pop $0
  431. ${If} $0 == 1
  432. nsNiuniuSkin::SetControlAttribute $hInstallDlg "local_space" "text" $(CANNOT_CONTAIN_ZH_PATH)
  433. nsNiuniuSkin::SetControlAttribute $hInstallDlg "local_space" "textcolor" "#ffff0000"
  434. nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnInstall" "enabled" "false"
  435. goto TextChangeAbort
  436. ${EndIf}
  437. ${If} $0 == 2
  438. nsNiuniuSkin::SetControlAttribute $hInstallDlg "local_space" "text" $(PATH_CANNOT_EMPTY)
  439. nsNiuniuSkin::SetControlAttribute $hInstallDlg "local_space" "textcolor" "#ffff0000"
  440. nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnInstall" "enabled" "false"
  441. goto TextChangeAbort
  442. ${EndIf}
  443. Call onVerifySpecialInstDir
  444. ${If} $0 == 1
  445. nsNiuniuSkin::SetControlAttribute $hInstallDlg "local_space" "text" $(CANNOT_CONTAIN_SPECIAL_CHARACTERS)
  446. nsNiuniuSkin::SetControlAttribute $hInstallDlg "local_space" "textcolor" "#ffff0000"
  447. nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnInstall" "enabled" "false"
  448. goto TextChangeAbort
  449. ${EndIf}
  450. Call IsSetupPathIlleagal
  451. ${If} $R5 == "0"
  452. nsNiuniuSkin::SetControlAttribute $hInstallDlg "local_space" "text" $(PATH_ERROR)
  453. nsNiuniuSkin::SetControlAttribute $hInstallDlg "local_space" "textcolor" "#ffff0000"
  454. nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnInstall" "enabled" "false"
  455. goto TextChangeAbort
  456. ${EndIf}
  457. nsNiuniuSkin::SetControlAttribute $hInstallDlg "local_space" "textcolor" "#FF999999"
  458. ${If} $R0 > 1024
  459. IntOp $R1 $R0 % 1024
  460. IntOp $R0 $R0 / 1024;
  461. nsNiuniuSkin::SetControlAttribute $hInstallDlg "local_space" "text" "$(REMAINING_SPACE):$R0.$R1GB"
  462. ${Else}
  463. nsNiuniuSkin::SetControlAttribute $hInstallDlg "local_space" "text" "$(REMAINING_SPACE):$R0.$R1MB"
  464. ${endif}
  465. ${IF} ${CJ} == "true"
  466. nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnInstall" "enabled" "true"
  467. ${Else}
  468. nsNiuniuSkin::GetControlAttribute $hInstallDlg "chkAgree" "selected"
  469. Pop $0
  470. ${If} $0 == "1"
  471. nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnInstall" "enabled" "true"
  472. ${Else}
  473. nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnInstall" "enabled" "false"
  474. ${EndIf}
  475. ${EndIf}
  476. TextChangeAbort:
  477. FunctionEnd
  478. Function OnCheckLicenseClick
  479. ${IF} ${CJ} == "true"
  480. nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnInstall" "enabled" "true"
  481. ${Else}
  482. nsNiuniuSkin::GetControlAttribute $hInstallDlg "chkAgree" "selected"
  483. Pop $0
  484. ${If} $0 == "0"
  485. nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnInstall" "enabled" "true"
  486. ${Else}
  487. nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnInstall" "enabled" "false"
  488. ${EndIf}
  489. ${EndIf}
  490. FunctionEnd
  491. Function OnBtnLicenseClick
  492. ;nsNiuniuSkin::ShowPageItem $hInstallDlg "wizardTab" ${INSTALL_PAGE_LICENSE}
  493. Call initLicensePage
  494. nsNiuniuSkin::SetControlAttribute $hInstallDlg "licenseshow" "visible" "true"
  495. nsNiuniuSkin::GetControlAttribute $hInstallDlg "moreconfiginfo" "visible"
  496. Pop $0
  497. ${If} $0 = 0
  498. ;pos="10,35,560,405"
  499. nsNiuniuSkin::SetControlAttribute $hInstallDlg "licenseshow" "pos" "5,35,475,385"
  500. nsNiuniuSkin::SetControlAttribute $hInstallDlg "editLicense" "height" "270"
  501. ${Else}
  502. nsNiuniuSkin::SetControlAttribute $hInstallDlg "licenseshow" "pos" "5,35,475,495"
  503. nsNiuniuSkin::SetControlAttribute $hInstallDlg "editLicense" "height" "375"
  504. ${EndIf}
  505. FunctionEnd
  506. Section "silentInstallSec" SEC01
  507. #MessageBox MB_OK|MB_ICONINFORMATION "Test silent install. you can add your silent install code here."
  508. SectionEnd
  509. Function ShowMsgBox
  510. nsNiuniuSkin::InitSkinSubPage "msgBox.xml" "btnOK" "btnCancel,btnClose"
  511. Pop $hInstallSubDlg
  512. nsNiuniuSkin::SetControlAttribute $hInstallSubDlg "btnOK" "text" $(BTN_CONFIRM)
  513. nsNiuniuSkin::SetControlAttribute $hInstallSubDlg "btnCancel" "text" $(BTN_CANCEL)
  514. nsNiuniuSkin::SetControlAttribute $hInstallSubDlg "lblTitle" "text" $(PROMPT)
  515. nsNiuniuSkin::SetControlAttribute $hInstallSubDlg "lblMsg" "text" "$R8"
  516. ${If} "$R7" == "1"
  517. nsNiuniuSkin::SetControlAttribute $hInstallSubDlg "hlCancel" "visible" "true"
  518. ${EndIf}
  519. nsNiuniuSkin::ShowSkinSubPage 0
  520. FunctionEnd
  521. Function OnBtnInstall
  522. nsNiuniuSkin::GetControlAttribute $hInstallDlg "editDir" "text"
  523. Pop $0
  524. StrCpy $INSTDIR "$0"
  525. Call onVerifyInstDir
  526. Pop $0
  527. ${If} $0 == 1
  528. nsNiuniuSkin::SetControlAttribute $hInstallDlg "local_space" "text" $(CANNOT_CONTAIN_ZH_PATH)
  529. nsNiuniuSkin::SetControlAttribute $hInstallDlg "local_space" "textcolor" "#ffff0000"
  530. nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnInstall" "enabled" "false"
  531. goto InstallAbort
  532. ${EndIf}
  533. ${If} $0 == 2
  534. nsNiuniuSkin::SetControlAttribute $hInstallDlg "local_space" "text" $(PATH_CANNOT_EMPTY)
  535. nsNiuniuSkin::SetControlAttribute $hInstallDlg "local_space" "textcolor" "#ffff0000"
  536. nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnInstall" "enabled" "false"
  537. goto InstallAbort
  538. ${EndIf}
  539. Call onVerifySpecialInstDir
  540. ${If} $0 == 1
  541. nsNiuniuSkin::SetControlAttribute $hInstallDlg "local_space" "text" $(CANNOT_CONTAIN_SPECIAL_CHARACTERS)
  542. nsNiuniuSkin::SetControlAttribute $hInstallDlg "local_space" "textcolor" "#ffff0000"
  543. nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnInstall" "enabled" "false"
  544. goto InstallAbort
  545. ${EndIf}
  546. Call IsSetupPathIlleagal
  547. ${If} $R5 == "0"
  548. nsNiuniuSkin::SetControlAttribute $hInstallDlg "local_space" "text" $(PATH_ERROR)
  549. nsNiuniuSkin::SetControlAttribute $hInstallDlg "local_space" "textcolor" "#ffff0000"
  550. nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnInstall" "enabled" "false"
  551. goto InstallAbort
  552. ${EndIf}
  553. ; MessageBox MB_OK|MB_USERICON '$INSTDIR\install.flag'
  554. ${If} ${FileExists} "$INSTDIR\install.flag"
  555. SetRebootFlag true
  556. MessageBox MB_OK $(REBOOT_PROMPT)
  557. Quit
  558. ${EndIf}
  559. nsNiuniuSkin::SetControlAttribute $hInstallDlg "local_space" "textcolor" "#FF999999"
  560. nsNiuniuSkin::GetControlAttribute $hInstallDlg "chkAgree" "selected"
  561. Pop $0
  562. StrCpy $0 "1"
  563. StrCmp $0 "0" InstallAbort 0
  564. nsProcess::_FindProcess "${EXE_NAME_EXT}"
  565. Pop $R0
  566. ${If} $R0 == 0
  567. StrCpy $R8 "${PRODUCT_NAME} $(TO_RUNNING)"
  568. StrCpy $R7 "0"
  569. Call ShowMsgBox
  570. goto InstallAbort
  571. ${EndIf}
  572. nsNiuniuSkin::GetControlAttribute $hInstallDlg "editDir" "text"
  573. Pop $0
  574. StrCmp $0 "" InstallAbort 0
  575. Call AdjustInstallPath
  576. StrCpy $sSetupPath "$INSTDIR"
  577. Call IsSetupPathIlleagal
  578. ${If} $R5 == "0"
  579. StrCpy $R8 $(PATH_ERROR_TWO)
  580. StrCpy $R7 "0"
  581. Call ShowMsgBox
  582. goto InstallAbort
  583. ${EndIf}
  584. ${If} $R5 == "-1"
  585. StrCpy $R8 $(DISK_SPACE_ERROR)
  586. StrCpy $R7 "0"
  587. Call ShowMsgBox
  588. goto InstallAbort
  589. ${EndIf}
  590. nsNiuniuSkin::SetWindowSize $hInstallDlg 480 390
  591. nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnClose" "enabled" "false"
  592. Call initInstallingPage
  593. nsNiuniuSkin::ShowPageItem $hInstallDlg "wizardTab" ${INSTALL_PAGE_PROCESSING}
  594. nsNiuniuSkin::SetControlAttribute $hInstallDlg "slrProgress" "min" "0"
  595. nsNiuniuSkin::SetControlAttribute $hInstallDlg "slrProgress" "max" "100"
  596. #Call BakFiles
  597. ${If} $update == "1"
  598. nsNiuniuSkin::SetControlAttribute $hInstallDlg "progress_tip" "text" $(INSTALLING)
  599. ${Else}
  600. nsNiuniuSkin::SetControlAttribute $hInstallDlg "progress_tip" "text" $(STOPPING_SERVICE)
  601. SimpleSC::StopService "lasermongodb" 0 30
  602. SimpleSC::StopService "lasermysql" 0 30
  603. SimpleSC::StopService "laserredis" 0 30
  604. nsNiuniuSkin::SetControlAttribute $hInstallDlg "progress_tip" "text" $(REMOVE_FILES)
  605. RMDir /r "$INSTDIR\bin"
  606. BgWorker::CallAndWait
  607. RMDir /r "$INSTDIR\CGAII"
  608. Sleep 2000
  609. BgWorker::CallAndWait
  610. nsNiuniuSkin::SetControlAttribute $hInstallDlg "progress_tip" "text" $(UPDATING)
  611. ${EndIf}
  612. GetFunctionAddress $0 ExtractFunc
  613. BgWorker::CallAndWait
  614. nsNiuniuSkin::GetControlAttribute $hInstallDlg "chkShotcut" "selected"
  615. #Pop $R0
  616. # ${If} $R0 == "1"
  617. # SetShellVarContext all
  618. # CreateShortCut "$DESKTOP\${PRODUCT_NAME}.lnk" "$INSTDIR\${EXE_NAME}"
  619. # SetShellVarContext current
  620. # ${EndIf}
  621. SetOutPath "$INSTDIR\bin"
  622. SetShellVarContext all
  623. Delete "$DESKTOP\四维看看本地版.lnk"
  624. Delete "$DESKTOP\4DKanKan.lnk"
  625. CreateShortCut "$DESKTOP\$(PRODUCT_NAME_LANG).lnk" "$INSTDIR\${EXE_NAME}"
  626. SetShellVarContext current
  627. Call CreateAppShortcut
  628. Call CreateUninstall
  629. ${If} $update == "1"
  630. nsNiuniuSkin::SetControlAttribute $hInstallDlg "progress_tip" "text" $(INITIALIZING)
  631. GetFunctionAddress $0 OnEnvInstall
  632. BgWorker::CallAndWait
  633. nsNiuniuSkin::SetControlAttribute $hInstallDlg "progress_tip" "text" $(INITIALIZING_SERVICE)
  634. nsNiuniuSkin::SetControlAttribute $hInstallDlg "progress_pos" "text" ""
  635. GetFunctionAddress $0 installService
  636. BgWorker::CallAndWait
  637. nsNiuniuSkin::SetControlAttribute $hInstallDlg "progress_tip" "text" $(INITIALIZING_SERVICE_DONE)
  638. ${Else}
  639. SimpleSC::StartService "lasermongodb" "" 30
  640. SimpleSC::StartService "lasermysql" "" 30
  641. SimpleSC::StartService "laserredis" "" 30
  642. Sleep 2000
  643. ;
  644. ${StrRep} $0 '$INSTDIR\4DKK_PROGRAM_DATA\' '\' '\\'
  645. StrCpy $buildModelPath $0
  646. ${StrRep} $0 '$INSTDIR\4DKK_PROGRAM_STATIC\' '\' '\\'
  647. StrCpy $profilePath $0
  648. ${StrRep} $0 '$INSTDIR\CGAII' '\' '\\'
  649. StrCpy $buildCallPath $0
  650. ${StrRep} $0 '$INSTDIR\bin\resources\static' '\' '\\'
  651. StrCpy $binPath $0
  652. ${StrRep} $0 '$INSTDIR\jdk1.8\bin\java.exe' '\' '\\'
  653. StrCpy $javaPath $0
  654. ${StrRep} $0 '$INSTDIR\Ireal\Ireal.exe' '\' '\\'
  655. StrCpy $irealPath $0
  656. ${StrRep} $0 '$INSTDIR\smart\Smart3D.exe' '\' '\\'
  657. StrCpy $smart3DPath $0
  658. nsJSON::Set /file $INSTDIR\bin\resources\static\setting.json
  659. nsJSON::Set /value `{}`
  660. nsJSON::Set `sceneConfig` /value `"config.json"`
  661. nsJSON::Set `sceheKey` /value `"id"`
  662. nsJSON::Set `sceneBundle` /value `"./build.zip"`
  663. nsJSON::Set `sceneBundleDir` /value `"capture"`
  664. nsJSON::Set `buildModelPath` /value `"$buildModelPath"`
  665. nsJSON::Set `javaPort` /value `9000`
  666. nsJSON::Set `v4JavaPort` /value `9101`
  667. nsJSON::Set `javaPath` /value `"$javaPath"`
  668. nsJSON::Set `profilePath` /value `"$profilePath"`
  669. nsJSON::Set `buildCallPath` /value `"$buildCallPath"`
  670. nsJSON::Set `binPath` /value `"$binPath"`
  671. nsJSON::Set `fuse` /value `${FUSE}`
  672. nsJSON::Set `ver` /value `${VER}`
  673. nsJSON::Set `version` /value `"${VERSION}"`
  674. nsJSON::Set `isShowIreal` /value `${IS_SHOW_IREAL}`
  675. nsJSON::Set `isShowSmart3D` /value `${IS_SHOW_SMART3D}`
  676. nsJSON::Set `ireal` /value `"$irealPath"`
  677. nsJSON::Set `smart3D` /value `"$smart3DPath"`
  678. nsJSON::Set `langList` /value `"${LANG_LIST}"`
  679. nsJSON::Serialize /format /file $INSTDIR\bin\resources\static\setting.json
  680. nsExec::ExecToStack '"$INSTDIR\tools\update.bat" $INSTDIR '
  681. ;nsExec::ExecToStack "$INSTDIR\tools\laserOtherTools.exe -m u -i $INSTDIR"
  682. nsNiuniuSkin::SetControlAttribute $hInstallDlg "progress_tip" "text" $(UPDATING_DONE)
  683. ${EndIf}
  684. StrCpy $InstallState "1"
  685. nsNiuniuSkin::ShowPageItem $hInstallDlg "wizardTab" ${INSTALL_PAGE_FINISH}
  686. Call initFinishPage
  687. #Call OnFinished
  688. ${If} $update == "0"
  689. nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnRun" "text" $(UPDATING_DONE)
  690. ${EndIf}
  691. nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnClose" "enabled" "true"
  692. ;完成安装删除计划任务
  693. nsExec::ExecToStack 'schtasks /delete /tn "DeleteInstallFlagTask" /f'
  694. InstallAbort:
  695. FunctionEnd
  696. Function ExtractCallback
  697. Pop $1
  698. Pop $2
  699. System::Int64Op $1 * 100
  700. Pop $3
  701. System::Int64Op $3 / $2
  702. Pop $0
  703. nsNiuniuSkin::SetControlAttribute $hInstallDlg "slrProgress" "value" "$0"
  704. nsNiuniuSkin::SetControlAttribute $hInstallDlg "progress_pos" "text" "$0%"
  705. ${If} $1 == $2
  706. nsNiuniuSkin::SetControlAttribute $hInstallDlg "slrProgress" "value" "100"
  707. nsNiuniuSkin::SetControlAttribute $hInstallDlg "progress_pos" "text" "100%"
  708. ${EndIf}
  709. FunctionEnd
  710. Function OnSysCommandCloseEvent
  711. Call OnExitDUISetup
  712. FunctionEnd
  713. Function OnExitDUISetup
  714. ${If} $InstallState == "0"
  715. StrCpy $R8 "$(CONFIRM_EXIT)"
  716. StrCpy $R7 "1"
  717. Call ShowMsgBox
  718. pop $0
  719. ${If} $0 == 0
  720. goto endfun
  721. ${EndIf}
  722. ${EndIf}
  723. nsNiuniuSkin::ExitDUISetup
  724. endfun:
  725. FunctionEnd
  726. Function OnBtnMin
  727. SendMessage $hInstallDlg ${WM_SYSCOMMAND} 0xF020 0
  728. FunctionEnd
  729. Function OnBtnCancel
  730. nsNiuniuSkin::ExitDUISetup
  731. FunctionEnd
  732. Function OnEnvInstall
  733. EnVar::SetHKLM
  734. EnVar::AddValue FDMGEA_HOME "$INSTDIR"
  735. ;EnVar::SetHKLM
  736. ;EnVar::AddValue JAVA_HOME "$INSTDIR\jdk1.8"
  737. EnVar::SetHKLM
  738. EnVar::AddValue MYSQL_HOME "$INSTDIR\mysql"
  739. EnVar::SetHKLM
  740. EnVar::AddValue REDIS_HOME "$INSTDIR\redis"
  741. EnVar::SetHKLM
  742. EnVar::AddValue 4DKK_HOME "$INSTDIR\CGAII;$INSTDIR\CGAII\3dtile"
  743. EnVar::SetHKLM
  744. EnVar::AddValue MONGODB_HOME "$INSTDIR\mongodb"
  745. ;EnVar::SetHKLM
  746. ;EnVar::AddValue CLASS_PATH ".;%JAVA_HOME%\lib\tools.jar;%JAVA_HOME%\lib\dt.jar"
  747. EnVar::SetHKLM
  748. ;EnVar::AddValue "Path" "$INSTDIR\jdk1.8\bin;$INSTDIR\mysql\bin;$INSTDIR\mongodb\bin;$INSTDIR\redis;$INSTDIR\CGAII;$INSTDIR\CGAII\lib;"
  749. EnVar::AddValue "Path" "$INSTDIR\mysql\bin;$INSTDIR\mongodb\bin;$INSTDIR\redis;$INSTDIR\CGAII;$INSTDIR\CGAII\lib;$INSTDIR\CGAII\3dtile"
  750. SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
  751. ;nsExec::ExecToStack '"$INSTDIR\tools\env_install.bat" $INSTDIR '
  752. FunctionEnd
  753. Function un.OnEnvDownInstall
  754. EnVar::SetHKLM
  755. EnVar::Delete "FDMGEA_HOME" "$INSTDIR"
  756. ;EnVar::Delete "JAVA_HOME" "$INSTDIR\jdk1.8"
  757. EnVar::Delete "MYSQL_HOME" "$INSTDIR\mysql"
  758. EnVar::Delete "REDIS_HOME" "$INSTDIR\redis"
  759. EnVar::Delete "4DKK_HOME" "$INSTDIR\CGAII"
  760. EnVar::Delete "4DKK_HOME" "$INSTDIR\CGAII\3dtile"
  761. EnVar::Delete "MONGODB_HOME" "$INSTDIR\mongodb"
  762. ;EnVar::Delete "CLASS_PATH" "%JAVA_HOME%\lib\tools.jar;%JAVA_HOME%\lib\dt.jar"
  763. ;EnVar::DeleteValue "PATH" "%JAVA_HOME%\bin"
  764. EnVar::DeleteValue "PATH" "$INSTDIR\mysql\bin"
  765. EnVar::DeleteValue "PATH" "$INSTDIR\mongodb\bin"
  766. EnVar::DeleteValue "PATH" "$INSTDIR\redis"
  767. EnVar::DeleteValue "PATH" "$INSTDIR\CGAII"
  768. EnVar::DeleteValue "PATH" "$INSTDIR\CGAII\lib"
  769. EnVar::DeleteValue "PATH" "$INSTDIR\CGAII\3dtile"
  770. ;nsExec::ExecToStack '"$INSTDIR\tools\uninstall.bat" $INSTDIR '
  771. FunctionEnd
  772. Function un.installService
  773. nsExec::ExecToStack '"$INSTDIR\tools\unservice.bat" $INSTDIR '
  774. SimpleSC::ExistsService "lasermongodb"
  775. Pop $0
  776. ${If} $0 == 0
  777. SimpleSC::StopService "lasermongodb" 0 30
  778. SimpleSC::RemoveService "lasermongodb"
  779. ${EndIf}
  780. SimpleSC::ExistsService "lasermysql"
  781. Pop $0
  782. ${If} $0 == 0
  783. SimpleSC::StopService "lasermysql" 0 30
  784. SimpleSC::RemoveService "lasermysql"
  785. ${EndIf}
  786. SimpleSC::ExistsService "laserredis"
  787. Pop $0
  788. ${If} $0 == 0
  789. SimpleSC::StopService "laserredis" 0 30
  790. SimpleSC::RemoveService "laserredis"
  791. ${EndIf}
  792. SimpleSC::ExistsService "checkLaserProcess"
  793. Pop $0
  794. ${If} $0 == 0
  795. SimpleSC::StopService "checkLaserProcess" 0 30
  796. SimpleSC::RemoveService "checkLaserProcess"
  797. ${EndIf}
  798. FunctionEnd
  799. Function installService
  800. ${StrRep} $0 '$INSTDIR\mysql' '\' '\\'
  801. StrCpy $basedir $0
  802. ${StrRep} $0 '$INSTDIR\mysql\data' '\' '\\'
  803. StrCpy $datadir $0
  804. ${StrRep} $0 '$INSTDIR\mysql\logs.log' '\' '\\'
  805. StrCpy $logError $0
  806. WriteINIStr $INSTDIR\mysql\my.ini mysqld port 3307
  807. WriteINIStr $INSTDIR\mysql\my.ini mysqld basedir $basedir
  808. WriteINIStr $INSTDIR\mysql\my.ini mysqld datadir $datadir
  809. WriteINIStr $INSTDIR\mysql\my.ini mysqld log-error $logError
  810. WriteINIStr $INSTDIR\mysql\my.ini mysqld max_connections 1000
  811. WriteINIStr $INSTDIR\mysql\my.ini mysqld max_connect_errors 10
  812. WriteINIStr $INSTDIR\mysql\my.ini mysqld character-set-server utf8mb4
  813. WriteINIStr $INSTDIR\mysql\my.ini mysqld default-storage-engine INNODB
  814. WriteINIStr $INSTDIR\mysql\my.ini mysqld default_authentication_plugin mysql_native_password
  815. WriteINIStr $INSTDIR\mysql\my.ini mysqld local_infile ON
  816. WriteINIStr $INSTDIR\mysql\my.ini mysql default-character-set utf8mb4
  817. WriteINIStr $INSTDIR\mysql\my.ini mysql local_infile ON
  818. WriteINIStr $INSTDIR\mysql\my.ini client port 3307
  819. WriteINIStr $INSTDIR\mysql\my.ini client default-character-set utf8mb4
  820. Sleep 2000
  821. SetOutPath "$INSTDIR\mysql\bin"
  822. ReadRegStr $vc_flag HKLM "SOFTWARE\WOW6432Node\Microsoft\VisualStudio\14.0\VC\Runtimes\X64" "Installed"
  823. ${IF} $vc_flag != "1"
  824. nsExec::ExecToStack '"cmd.exe" /c $INSTDIR\mysql\bin\VC_redist.x64.exe /install /quiet /norestart'
  825. ${EndIf}
  826. Sleep 2000
  827. nsExec::ExecToStack '"cmd.exe" /c $INSTDIR\mysql\bin\mysqld.exe --initialize-insecure --lower-case-table-names=1'
  828. Sleep 2000
  829. nsExec::ExecToStack '"cmd.exe" /c $INSTDIR\mysql\bin\mysqld.exe --install lasermysql'
  830. ; Pop $0
  831. ; Pop $1
  832. ; ${If} $0 = 0
  833. ; nsExec::ExecToStack '"cmd.exe" /c $INSTDIR\mysql\bin\mysqld.exe --install lasermysql'
  834. ; ${Else}
  835. ; ;MessageBox mb_ok "code=$0,mes=$1"
  836. ; Sleep 2000
  837. ; nsExec::ExecToStack '"cmd.exe" /c $INSTDIR\mysql\bin\mysqld.exe --initialize-insecure --lower-case-table-names=1'
  838. ; Sleep 2000
  839. ; nsExec::ExecToStack '"cmd.exe" /c $INSTDIR\mysql\bin\mysqld.exe --install lasermysql'
  840. ; ${EndIf}
  841. IfFileExists "$INSTDIR\USER_DATA\data\*.*" 0 static_not_found
  842. CopyFiles /SILENT $INSTDIR\USER_DATA\data\*.* $INSTDIR\mysql\data
  843. RMDir /r "$INSTDIR\USER_DATA\data\"
  844. Delete "$INSTDIR\mysql\sqlfile\fdkk_laser.sql"
  845. goto static_end_of
  846. static_not_found:
  847. goto static_end_of
  848. static_end_of:
  849. nsExec::ExecToStack '"cmd.exe" /c powercfg.exe /hibernate off '
  850. SimpleSC::StartService "lasermysql" "" 30
  851. SetOutPath "$INSTDIR\redis"
  852. nsExec::ExecToStack '"cmd.exe" /c redis-server.exe --service-install "$INSTDIR\redis\redis.windows.conf" --service-name laserredis --loglevel verbose'
  853. SimpleSC::StartService "laserredis" "" 30
  854. nsExec::ExecToStack '"cmd.exe" /c sc config laserredis start=auto'
  855. SimpleSC::RestartService "laserredis" "" 30
  856. Sleep 2000
  857. SetOutPath "$INSTDIR\mongodb"
  858. ${StrRep} $0 '$INSTDIR\mongodb\db' '\' '\\'
  859. StrCpy $dbpath $0
  860. ${StrRep} $0 '$INSTDIR\mongodb\logs\mongo.log' '\' '\\'
  861. StrCpy $logpath $0
  862. ClearErrors
  863. FileOpen $0 $INSTDIR\mongodb\mongo.conf w
  864. IfErrors otherW
  865. FileWrite $0 'port=29031$\n'
  866. FileWrite $0 'dbpath=$dbpath$\n'
  867. FileWrite $0 'logpath=$logpath$\n'
  868. FileWrite $0 'logappend=true$\n'
  869. FileWrite $0 'maxConns=1000$\n'
  870. FileClose $0
  871. goto done
  872. otherW:
  873. ;nsExec::ExecToStack "$INSTDIR\tools\laserOtherTools.exe -m w -i $INSTDIR\mongodb"
  874. nsExec::ExecToStack '"$INSTDIR\tools\wirteMconf.bat" $INSTDIR\mongodb\ '
  875. goto done
  876. done:
  877. nsExec::ExecToStack '"cmd.exe" /c sc create lasermongodb binpath= "$INSTDIR\mongodb\bin\mongod.exe --config $INSTDIR\mongodb\mongo.conf --service" start= auto'
  878. SimpleSC::StartService "lasermongodb" "" 30
  879. Sleep 2000
  880. ; IfFileExists "$INSTDIR\USER_DATA\pro\*.*" 0 pro_not_found
  881. ; CopyFiles /SILENT $INSTDIR\USER_DATA\pro\*.* $INSTDIR\4DKK_PROGRAM_DATA
  882. ; RMDir /r "$INSTDIR\USER_DATA\pro"
  883. ; goto pro_end_of
  884. ; pro_not_found:
  885. ; goto pro_end_of
  886. ; pro_end_of:
  887. Sleep 2000
  888. ;
  889. ${StrRep} $0 '$INSTDIR\4DKK_PROGRAM_DATA\' '\' '\\'
  890. StrCpy $buildModelPath $0
  891. ${StrRep} $0 '$INSTDIR\4DKK_PROGRAM_STATIC\' '\' '\\'
  892. StrCpy $profilePath $0
  893. ${StrRep} $0 '$INSTDIR\CGAII' '\' '\\'
  894. StrCpy $buildCallPath $0
  895. ${StrRep} $0 '$INSTDIR\bin\resources\static' '\' '\\'
  896. StrCpy $binPath $0
  897. ${StrRep} $0 '$INSTDIR\jdk1.8\bin\java.exe' '\' '\\'
  898. StrCpy $javaPath $0
  899. nsJSON::Set /file $INSTDIR\bin\resources\static\setting.json
  900. nsJSON::Set /value `{}`
  901. nsJSON::Set `sceneConfig` /value `"config.json"`
  902. nsJSON::Set `sceheKey` /value `"id"`
  903. nsJSON::Set `sceneBundle` /value `"./build.zip"`
  904. nsJSON::Set `sceneBundleDir` /value `"capture"`
  905. nsJSON::Set `buildModelPath` /value `"$buildModelPath"`
  906. nsJSON::Set `javaPort` /value `9000`
  907. nsJSON::Set `v4JavaPort` /value `9101`
  908. nsJSON::Set `javaPath` /value `"$javaPath"`
  909. nsJSON::Set `profilePath` /value `"$profilePath"`
  910. nsJSON::Set `buildCallPath` /value `"$buildCallPath"`
  911. nsJSON::Set `binPath` /value `"$binPath"`
  912. nsJSON::Set `fuse` /value `${FUSE}`
  913. nsJSON::Set `ver` /value `${VER}`
  914. nsJSON::Set `version` /value `"${VERSION}"`
  915. nsJSON::Set `isShowIreal` /value `${IS_SHOW_IREAL}`
  916. nsJSON::Set `isShowSmart3D` /value `${IS_SHOW_SMART3D}`
  917. nsJSON::Set `ireal` /value `"$irealPath"`
  918. nsJSON::Set `smart3D` /value `"$smart3DPath"`
  919. nsJSON::Set `langList` /value `"${LANG_LIST}"`
  920. nsJSON::Serialize /format /file $INSTDIR\bin\resources\static\setting.json
  921. ;nsExec::ExecToStack "$INSTDIR\tools\laserOtherTools.exe -m l -i $INSTDIR"
  922. nsExec::ExecToStack '"$INSTDIR\tools\service.bat" $INSTDIR '
  923. nsExec::ExecToStack '"$INSTDIR\tools\update.bat" $INSTDIR '
  924. ; FileOpen $0 $INSTDIR\bin\resources\static\4dmega.vmoptions w
  925. ; IfErrors done
  926. ; FileWrite $0 '-DBIN_PATH=$INSTDIR\bin\resources\static$\n'
  927. ; FileWrite $0 '-DPROFILE_PATH=$INSTDIR\4DKK_PROGRAM_STATIC\$\n'
  928. ; FileWrite $0 '-DBUILD_MODEL_PATH=$INSTDIR\4DKK_PROGRAM_DATA\$\n'
  929. ; FileWrite $0 '-DBUILD_CALL_PATH=$INSTDIR\CGAII\$\n'
  930. ; FileWrite $0 '-Dspring.profiles.active=standAloneProd$\n'
  931. ; FileWrite $0 '-Dserver.port=9000$\n'
  932. ; FileClose $0
  933. ; done:
  934. nsExec::ExecToStack '"cmd.exe" /c $INSTDIR\tools\MonitorPid.exe install '
  935. functionend
  936. Function OnFinished
  937. #MessageBox MB_YESNO|MB_ICONQUESTION "$(INSTALL_REBOOT)" IDNO +2
  938. #Reboot
  939. #Exec "$INSTDIR${EXE_NAME}"
  940. nsExec::ExecToStack 'ie4uinit.exe -ClearIconCache'
  941. nsExec::ExecToStack 'ie4uinit.exe -show'
  942. System::Call 'shell32.dll::SHChangeNotify(l, l, i, i) v (0x08000000, 0, 0, 0)'
  943. WriteRegStr HKLM "Software\${PRODUCT_PATHNAME}" "language" $LANGUAGE
  944. Call OnExitDUISetup
  945. FunctionEnd
  946. Function OnBtnSelectDir
  947. nsNiuniuSkin::SelectInstallDirEx $hInstallDlg $(PLEASE_SELECT_INSTALLATION_PATH)
  948. Pop $0
  949. ${Unless} "$0" == ""
  950. nsNiuniuSkin::SetControlAttribute $hInstallDlg "editDir" "text" $0
  951. ${EndUnless}
  952. FunctionEnd
  953. Function StepHeightSizeAsc
  954. ${ForEach} $R0 390 500 + 10
  955. nsNiuniuSkin::SetWindowSize $hInstallDlg 480 $R0
  956. Sleep 5
  957. ${Next}
  958. FunctionEnd
  959. Function StepHeightSizeDsc
  960. ${ForEach} $R0 480 390 - 10
  961. nsNiuniuSkin::SetWindowSize $hInstallDlg 480 $R0
  962. Sleep 5
  963. ${Next}
  964. FunctionEnd
  965. Function OnBtnShowMore
  966. nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnShowMore" "enabled" "false"
  967. nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnHideMore" "enabled" "false"
  968. nsNiuniuSkin::SetControlAttribute $hInstallDlg "moreconfiginfo" "visible" "true"
  969. nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnHideMore" "visible" "true"
  970. nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnShowMore" "visible" "false"
  971. GetFunctionAddress $0 StepHeightSizeAsc
  972. BgWorker::CallAndWait
  973. nsNiuniuSkin::SetWindowSize $hInstallDlg 480 510
  974. nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnShowMore" "enabled" "true"
  975. nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnHideMore" "enabled" "true"
  976. FunctionEnd
  977. Function OnBtnHideMore
  978. nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnShowMore" "enabled" "false"
  979. nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnHideMore" "enabled" "false"
  980. nsNiuniuSkin::SetControlAttribute $hInstallDlg "moreconfiginfo" "visible" "false"
  981. nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnHideMore" "visible" "false"
  982. nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnShowMore" "visible" "true"
  983. GetFunctionAddress $0 StepHeightSizeDsc
  984. BgWorker::CallAndWait
  985. nsNiuniuSkin::SetWindowSize $hInstallDlg 480 390
  986. nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnShowMore" "enabled" "true"
  987. nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnHideMore" "enabled" "true"
  988. FunctionEnd
  989. Function OnBtnShowConfig
  990. ;nsNiuniuSkin::ShowPageItem $hInstallDlg "wizardTab" ${INSTALL_PAGE_CONFIG}
  991. nsNiuniuSkin::SetControlAttribute $hInstallDlg "licenseshow" "visible" "false"
  992. FunctionEnd
  993. Function OnBtnDirPre
  994. StrCpy $R8 "$(CONFIRM_EXIT)"
  995. StrCpy $R7 "0"
  996. Call ShowMsgBox
  997. ;nsNiuniuSkin::PrePage "wizardTab"
  998. FunctionEnd
  999. Function un.BtnDirPre
  1000. StrCpy $R8 "$(UNINSTALL)"
  1001. StrCpy $R7 "0"
  1002. Call un.ShowMsgBox
  1003. ;nsNiuniuSkin::PrePage "wizardTab"
  1004. FunctionEnd
  1005. Function un.ShowMsgBoxBackUps
  1006. nsNiuniuSkin::InitSkinSubPage "msgBox_backup.xml" "backupBtnOK" "gotouninstall"
  1007. Pop $hInstallSubDlg
  1008. nsNiuniuSkin::SetControlAttribute $hInstallSubDlg "lblMsg" "text" $(UNINSTALL_ERROR)
  1009. nsNiuniuSkin::SetControlAttribute $hInstallSubDlg "backupBtnOK" "text" $(I_KNOW)
  1010. nsNiuniuSkin::SetControlAttribute $hInstallSubDlg "lblTitle" "text" $(PROMPT)
  1011. nsNiuniuSkin::ShowSkinSubPage 0
  1012. FunctionEnd
  1013. Function un.ShowMsgBox
  1014. nsNiuniuSkin::InitSkinSubPage "msgBox.xml" "btnOK" "btnCancel,btnClose"
  1015. Pop $hInstallSubDlg
  1016. nsNiuniuSkin::SetControlAttribute $hInstallSubDlg "lblTitle" "text" $(PROMPT)
  1017. nsNiuniuSkin::SetControlAttribute $hInstallSubDlg "lblMsg" "text" "$R8"
  1018. ${If} "$R7" == "1"
  1019. nsNiuniuSkin::SetControlAttribute $hInstallSubDlg "hlCancel" "visible" "true"
  1020. ${EndIf}
  1021. nsNiuniuSkin::ShowSkinSubPage 0
  1022. FunctionEnd
  1023. Function un.ExitDUISetup
  1024. nsExec::ExecToStack 'ie4uinit.exe -ClearIconCache'
  1025. nsExec::ExecToStack 'ie4uinit.exe -show'
  1026. System::Call 'shell32.dll::SHChangeNotify(l, l, i, i) v (0x08000000, 0, 0, 0)'
  1027. nsNiuniuSkin::ExitDUISetup
  1028. FunctionEnd
  1029. Function un.OnBtnMin
  1030. SendMessage $hInstallDlg ${WM_SYSCOMMAND} 0xF020 0
  1031. FunctionEnd
  1032. Section "un.silentInstallSec" SEC02
  1033. #MessageBox MB_OK|MB_ICONINFORMATION "Test silent install. you can add your silent uninstall code here."
  1034. SectionEnd
  1035. Function un.onUninstall
  1036. nsProcess::_FindProcess "${EXE_NAME_EXT}"
  1037. Pop $R0
  1038. ${If} $R0 == 0
  1039. StrCpy $R8 "${PRODUCT_NAME} 正在运行,请退出后重试!"
  1040. StrCpy $R7 "0"
  1041. Call un.ShowMsgBox
  1042. goto InstallAbort
  1043. ${EndIf}
  1044. nsNiuniuSkin::GetControlAttribute $hInstallDlg "chkbox_userdata" "selected"
  1045. Pop $0
  1046. StrCpy $sReserveData $0
  1047. ${If} $sReserveData == 1
  1048. nsNiuniuSkin::SetControlAttribute $hInstallDlg "un_progress_tip" "text" $(PREPARING_TO_UNINSTALL)
  1049. CreateDirectory $INSTDIR\USER_DATA
  1050. ; nsExec::ExecToStack "$INSTDIR\tools\laserOtherTools.exe -m v -i $INSTDIR"
  1051. ; Pop $0
  1052. SimpleSC::GetServiceStatus "lasermongodb"
  1053. Pop $0 ; 返回错误码,0 表示成功,非0 表示失败
  1054. Pop $1 ; 返回服务状态,状态值参考 Windows 服务状态代码
  1055. ${If} $0 == 0
  1056. ${If} $1 == 4 ; 服务状态值为 4 表示服务正在运行
  1057. Call un.onPassUninstall
  1058. ${Else}
  1059. RMDir /r "$INSTDIR\USER_DATA"
  1060. Call un.ShowMsgBoxBackUps
  1061. Pop $0
  1062. ${If} $0 == 0
  1063. Call un.onPassUninstall
  1064. ${EndIf}
  1065. ${If} $0 == 1
  1066. Call un.onNoPassUninstall
  1067. ${EndIf}
  1068. ${EndIf}
  1069. ${Else}
  1070. RMDir /r "$INSTDIR\USER_DATA"
  1071. Call un.ShowMsgBoxBackUps
  1072. Pop $0
  1073. ${If} $0 == 0
  1074. Call un.onPassUninstall
  1075. ${EndIf}
  1076. ${If} $0 == 1
  1077. Call un.onNoPassUninstall
  1078. ${EndIf}
  1079. ${EndIf}
  1080. ${Else}
  1081. Call un.onPassUninstall
  1082. ${EndIf}
  1083. InstallAbort:
  1084. FunctionEnd
  1085. Function un.onNoPassUninstall
  1086. nsNiuniuSkin::ExitDUISetup
  1087. FunctionEnd
  1088. Function un.onPassUninstall
  1089. ${If} $sReserveData == 1
  1090. CreateDirectory $INSTDIR\USER_DATA
  1091. ${EndIf}
  1092. Call un.initUninstallingPage
  1093. nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnClose" "enabled" "false"
  1094. nsNiuniuSkin::ShowPageItem $hInstallDlg "wizardTab" ${INSTALL_PAGE_UNISTPROCESSING}
  1095. nsNiuniuSkin::SetControlAttribute $hInstallDlg "slrUnInstProgress" "min" "0"
  1096. nsNiuniuSkin::SetControlAttribute $hInstallDlg "slrUnInstProgress" "max" "100"
  1097. IntOp $UnInstallValue 0 + 1
  1098. nsNiuniuSkin::SetControlAttribute $hInstallDlg "un_progress_tip" "text" $(PREPARING_TO_UNINSTALL)
  1099. ; nsExec::ExecToStack "$INSTDIR\tools\laserOtherTools.exe -m b -i $INSTDIR "
  1100. ; BgWorker::CallAndWait
  1101. GetFunctionAddress $0 un.OnEnvDownInstall
  1102. BgWorker::CallAndWait
  1103. nsExec::ExecToStack 'cmd.exe /c powercfg.exe /hibernate on '
  1104. GetFunctionAddress $0 un.installService
  1105. BgWorker::CallAndWait
  1106. nsNiuniuSkin::SetControlAttribute $hInstallDlg "un_progress_tip" "text" $(UNINSTALLING)
  1107. Call un.DeleteShotcutAndInstallInfo
  1108. IntOp $UnInstallValue $UnInstallValue + 8
  1109. GetFunctionAddress $0 un.RemoveFiles
  1110. BgWorker::CallAndWait
  1111. FunctionEnd
  1112. Function un.RemoveFiles
  1113. ${Locate} "$INSTDIR" "/G=0 /M=*.*" "un.onDeleteFileFound"
  1114. StrCpy $InstallState "1"
  1115. ; 卸载成功后创建标记文件
  1116. FileOpen $0 "$INSTDIR\install.flag" w
  1117. FileClose $0
  1118. ; 重启计算机
  1119. ; 创建任务计划程序命令
  1120. nsExec::ExecToStack 'schtasks /create /tn "DeleteInstallFlagTask" /tr "cmd.exe /C del $INSTDIR\install.flag" /sc onstart /ru System /rl HIGHEST /F'
  1121. nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnClose" "enabled" "true"
  1122. nsNiuniuSkin::SetControlAttribute $hInstallDlg "slrUnInstProgress" "value" "100"
  1123. Call un.initUninstallFinishPage
  1124. nsNiuniuSkin::ShowPageItem $hInstallDlg "wizardTab" ${INSTALL_PAGE_UNISTFINISH}
  1125. FunctionEnd
  1126. Function un.onDeleteFileFound
  1127. ; $R9 "path\name"
  1128. ; $R8 "path"
  1129. ; $R7 "name"
  1130. ; $R6 "size" ($R6 = "" if directory, $R6 = "0" if file with /S=)
  1131. ; MessageBox MB_OK "R9--------$R9"
  1132. ; MessageBox MB_OK "R8--------$R8"
  1133. ; MessageBox MB_OK "R7--------$R7"
  1134. ;不用保留场景
  1135. ${If} $sReserveData == 0
  1136. ${If} $R7 != "install.flag"
  1137. Delete "$R9"
  1138. RMDir /r "$R9"
  1139. RMDir "$R9"
  1140. ${EndIf}
  1141. ${EndIf}
  1142. ;保留场景
  1143. ${If} $sReserveData == 1
  1144. ${If} $R7 != "install.flag"
  1145. RMDir /r "$R8\bin"
  1146. RMDir /r "$R8\CGAII"
  1147. RMDir /r "$R8\mongodb"
  1148. RMDir /r "$R8\mysql"
  1149. RMDir /r "$R8\redis"
  1150. RMDir /r "$R8\jdk1.8"
  1151. ; RMDir /r "$R8\4DKK_PROGRAM_STATIC"
  1152. ; RMDir /r "$R8\4DKK_PROGRAM_DATA"
  1153. RMDir /r "$R8\tools"
  1154. Delete "$R8\uninst.exe"
  1155. ${EndIf}
  1156. ${EndIf}
  1157. IntOp $UnInstallValue $UnInstallValue + 2
  1158. ${If} $UnInstallValue > 100
  1159. IntOp $UnInstallValue 100 + 0
  1160. nsNiuniuSkin::SetControlAttribute $hInstallDlg "slrUnInstProgress" "value" "100"
  1161. ${Else}
  1162. nsNiuniuSkin::SetControlAttribute $hInstallDlg "slrUnInstProgress" "value" "$UnInstallValue"
  1163. nsNiuniuSkin::SetControlAttribute $hInstallDlg "un_progress_pos" "text" "$UnInstallValue%"
  1164. #Sleep 100
  1165. ${EndIf}
  1166. undelete:
  1167. Push "LocateNext"
  1168. FunctionEnd
  1169. #
  1170. # 以 Unicode 字符串的方式进行判断 (与 NSIS 是 ANSI/Unicode 无关)
  1171. # 但建议 Unicode 版本优先使用此函数。
  1172. #
  1173. Function PathIsDBCS_W
  1174. Exch $R0
  1175. Push $R1
  1176. Push $R2
  1177. Push $R3
  1178. System::Call "*(&w${NSIS_MAX_STRLEN}R0)p.R1"
  1179. StrCpy $R0 0
  1180. StrCpy $R2 $R1
  1181. lbl_loop:
  1182. # Unicode 版取 2 个字节长度的字符,字符串遇到 0 字符表示结束了。
  1183. System::Call "*$R2(&i2.R3)"
  1184. IntCmp $R3 0 lbl_done
  1185. # Unicode 字符直接判断字符值,大于 128 的我们就视为非英文字符。
  1186. IntCmp $R3 128 0 lbl_skip
  1187. IntOp $R0 $R0 !
  1188. Goto lbl_done
  1189. lbl_skip:
  1190. # 如果用 NSIS 3.x 这里可以用 IntPtrOp 代替。
  1191. IntOp $R2 $R2 + 2
  1192. Goto lbl_loop
  1193. lbl_done:
  1194. System::Free $R1
  1195. Pop $R3
  1196. Pop $R2
  1197. Pop $R1
  1198. Exch $R0
  1199. FunctionEnd
  1200. #
  1201. # 以 ANSI 字符串的方式进行判断 (与 NSIS 是 ANSI/Unicode 无关)
  1202. # 但建议 ANSI 版本优先使用此函数。
  1203. #
  1204. Function PathIsDBCS_A
  1205. Exch $R0
  1206. Push $R1
  1207. Push $R2
  1208. Push $R3
  1209. Push $R4
  1210. System::Call "*(&m${NSIS_MAX_STRLEN}R0)p.R1"
  1211. StrCpy $R0 0
  1212. StrCpy $R2 $R1
  1213. lbl_loop:
  1214. # ANSI 版取 1 个字节长度的字符,字符串遇到 0 字符表示结束了。
  1215. System::Call "*$R2(&i1.R3)"
  1216. IntCmp $R3 0 lbl_done
  1217. # ANSI 字符用 IsDBCSLeadByte 判断是否双字节字符的前导字节。
  1218. System::Call "kernel32::IsDBCSLeadByte(iR3)i.R4"
  1219. IntCmp $R4 0 lbl_skip
  1220. IntOp $R0 $R0 !
  1221. Goto lbl_done
  1222. lbl_skip:
  1223. # 用 CharNextA 得到下一个字符的地址 (可正确处理双字节字符)。
  1224. System::Call "user32::CharNextA(pR2)p.R2"
  1225. Goto lbl_loop
  1226. lbl_done:
  1227. Pop $R4
  1228. Pop $R3
  1229. Pop $R2
  1230. Pop $R1
  1231. Exch $R0
  1232. FunctionEnd
  1233. #
  1234. # 当选择的安装路径变更时,路径为空或包含双字节字符 (不限于简体中文),都不允许继续。
  1235. # 路径为空时,NSIS 会自行判断。
  1236. #
  1237. # 此示例未判断是否包含空格。如有需要,请与示例一配合使用。
  1238. #
  1239. Function onVerifyInstDir
  1240. # 检查安装路径是否包含双字节字符 (不限于简体中文)。
  1241. StrCpy $0 $INSTDIR
  1242. StrLen $1 $0
  1243. # 这里也可以换成 CheckEnglishPath 以测试效果。
  1244. ${If} $1 == 0
  1245. Push 2
  1246. ${Else}
  1247. Push $INSTDIR
  1248. Call PathIsDBCS_A
  1249. Pop $R0
  1250. Push $R0
  1251. ${endif}
  1252. lbl_done:
  1253. FunctionEnd
  1254. Function CheckEnglishPath
  1255. Exch $0 ; 保存返回值的变量
  1256. Exch ; 将字符串参数放在栈顶
  1257. Push $1
  1258. Push $2
  1259. Push $3
  1260. StrLen $1 $0 ; 计算字符串长度
  1261. loop:
  1262. StrCpy $2 $1 ; 复制当前长度
  1263. IntOp $1 $1 - 1 ; 长度减1
  1264. StrCpy $3 $0 1 $2 ; 获取当前字符
  1265. ${If} $3 == " " ; 如果字符是空格
  1266. Goto notEnglish ; 跳转到不是英文路径的逻辑
  1267. ${EndIf}
  1268. ${If} $1 > 0 ; 如果还有字符未检查
  1269. Goto loop ; 继续循环
  1270. ${EndIf}
  1271. ; 路径是全英文的
  1272. Pop $3
  1273. Pop $2
  1274. Pop $1
  1275. StrCpy $0 0
  1276. Exch $0
  1277. notEnglish:
  1278. ; 路径不是全英文的
  1279. Pop $3
  1280. Pop $2
  1281. Pop $1
  1282. StrCpy $0 1
  1283. Exch $0
  1284. FunctionEnd
  1285. Function onVerifySpecialInstDir
  1286. # 检查安装路径是否包含双字节字符 (不限于简体中文)。
  1287. StrCpy $0 $INSTDIR
  1288. StrLen $1 $0
  1289. # 这里也可以换成 PathIsDBCS_A 以测试效果。
  1290. ${If} $1 == 0
  1291. Push 2
  1292. ${Else}
  1293. Push $INSTDIR
  1294. Call CheckSpecialCharacters
  1295. Pop $0 ; 获取返回结果
  1296. Push $R0
  1297. ${endif}
  1298. FunctionEnd
  1299. Function CheckSpecialCharacters
  1300. Exch $0 ; 保存返回值的变量
  1301. Exch ; 将字符串参数放在栈顶
  1302. StrCpy $1 "!@#¥%……&*()!@#$%^&*()<>_+{}[];'?.,~`" ; 特殊字符
  1303. StrCpy $2 0 ; 特殊字符字符串索引
  1304. StrCpy $3 0 ; 字符串索引
  1305. StrLen $4 $0 ; 特殊字符字符串长度
  1306. loop:
  1307. StrCpy $5 $1 1 $2 ; 从特殊字符字符串中获取一个字符
  1308. StrCpy $6 $0 1 $3 ; 从需要检查的字符串中获取一个字符
  1309. StrCmp $5 "" done ; 如果特殊字符字符串已经检查完,跳转到 done
  1310. StrCmp $6 "" next ; 如果需要检查的字符串已经检查完,跳转到 next
  1311. StrCmp $5 $6 found ; 如果找到特殊字符,跳转到 found
  1312. IntOp $3 $3 + 1 ; 否则,增加需要检查的字符串的索引
  1313. Goto loop
  1314. next:
  1315. IntOp $2 $2 + 1 ; 增加特殊字符字符串的索引
  1316. StrCpy $3 0 ; 重置需要检查的字符串的索引
  1317. Goto loop
  1318. found:
  1319. StrCpy $0 "1"
  1320. Goto End
  1321. done:
  1322. StrCpy $0 "0"
  1323. end:
  1324. Exch $0 ; 将返回值出栈
  1325. FunctionEnd
  1326. Function isEmptyDir
  1327. # Stack -> # Stack: <directory>
  1328. Exch $0 # Stack: $0
  1329. Push $1 # Stack: $1, $0
  1330. FindFirst $0 $1 "$0\*.*"
  1331. strcmp $1 "." 0 _notempty
  1332. FindNext $0 $1
  1333. strcmp $1 ".." 0 _notempty
  1334. ClearErrors
  1335. FindNext $0 $1
  1336. IfErrors 0 _notempty
  1337. FindClose $0
  1338. Pop $1 # Stack: $0
  1339. StrCpy $0 1
  1340. Exch $0 # Stack: 1 (true)
  1341. goto _end
  1342. _notempty:
  1343. FindClose $0
  1344. ClearErrors
  1345. Pop $1 # Stack: $0
  1346. StrCpy $0 0
  1347. Exch $0 # Stack: 0 (false)
  1348. _end:
  1349. FunctionEnd
  1350. Function un.isEmptyDir
  1351. # Stack -> # Stack: <directory>
  1352. Exch $0 # Stack: $0
  1353. Push $1 # Stack: $1, $0
  1354. FindFirst $0 $1 "$0\*.*"
  1355. strcmp $1 "." 0 _notempty
  1356. FindNext $0 $1
  1357. strcmp $1 ".." 0 _notempty
  1358. ClearErrors
  1359. FindNext $0 $1
  1360. IfErrors 0 _notempty
  1361. FindClose $0
  1362. Pop $1 # Stack: $0
  1363. StrCpy $0 1
  1364. Exch $0 # Stack: 1 (true)
  1365. goto _end
  1366. _notempty:
  1367. FindClose $0
  1368. ClearErrors
  1369. Pop $1 # Stack: $0
  1370. StrCpy $0 0
  1371. Exch $0 # Stack: 0 (false)
  1372. _end:
  1373. FunctionEnd
  1374. Function initRegPage
  1375. nsNiuniuSkin::SetControlAttribute $hInstallDlg "reg_title" "bkimage" $(REG_TITLE)
  1376. nsNiuniuSkin::SetControlAttribute $hInstallDlg "install_info" "text" $(INSTALL_INFO)
  1377. nsNiuniuSkin::SetControlAttribute $hInstallDlg "machineCode" "text" $(MACHINE_CODE)
  1378. nsNiuniuSkin::SetControlAttribute $hInstallDlg "reg_machine_info" "text" $(REG_MACHINE_INFO)
  1379. nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnCopyMachineinfo" "text" $(BTN_COPY_MACHINEINFO)
  1380. nsNiuniuSkin::SetControlAttribute $hInstallDlg "installKey" "text" $(INSTALL_KEY)
  1381. nsNiuniuSkin::SetControlAttribute $hInstallDlg "regPrompt" "text" $(REG_PROMPT)
  1382. nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnRegConfirm" "text" $(BTN_REG_CONFIRM)
  1383. FunctionEnd
  1384. Function initConfigPage
  1385. nsNiuniuSkin::SetControlAttribute $hInstallDlg "configPageTitle" "bkimage" $(CONFIG_PAGE_TITLE)
  1386. nsNiuniuSkin::SetControlAttribute $hInstallDlg "configInstallPath" "text" $(CONFIG_INSTALL_PATH)
  1387. nsNiuniuSkin::SetControlAttribute $hInstallDlg "chkAgree" "text" $(CONFIG_CHK_AGREE)
  1388. ${If} $LANGUAGE == '1033'
  1389. nsNiuniuSkin::SetControlAttribute $hInstallDlg "configInstallPath" "width" 115
  1390. nsNiuniuSkin::SetControlAttribute $hInstallDlg "configInstallPathTip" "width" 310
  1391. nsNiuniuSkin::SetControlAttribute $hInstallDlg "configInstallPathTip" "font" 11
  1392. ${ElseIf} $LANGUAGE == '1041'
  1393. nsNiuniuSkin::SetControlAttribute $hInstallDlg "configInstallPath" "width" 100
  1394. nsNiuniuSkin::SetControlAttribute $hInstallDlg "configInstallPathTip" "font" 5
  1395. nsNiuniuSkin::SetControlAttribute $hInstallDlg "chkAgree" "width" 190
  1396. ${ElseIf} $LANGUAGE == '1042'
  1397. nsNiuniuSkin::SetControlAttribute $hInstallDlg "configInstallPath" "width" 70
  1398. nsNiuniuSkin::SetControlAttribute $hInstallDlg "configInstallPathTip" "font" 5
  1399. ${ElseIf} $LANGUAGE == '2052'
  1400. nsNiuniuSkin::SetControlAttribute $hInstallDlg "configInstallPath" "width" 60
  1401. nsNiuniuSkin::SetControlAttribute $hInstallDlg "configInstallPathTip" "font" 5
  1402. ${EndIf}
  1403. nsNiuniuSkin::SetControlAttribute $hInstallDlg "configInstallPathTip" "text" $(CONFIG_INSTALL_PATH_TIP)
  1404. nsNiuniuSkin::SetControlAttribute $hInstallDlg "configUseSpace" "text" $(CONFIG_USE_SPACE)
  1405. nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnAgreement" "text" $(CONFIG_BTN_AGREEMENT)
  1406. nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnInstall" "text" $(CONFIG_BTN_INSTALL)
  1407. FunctionEnd
  1408. Function initLicensePage
  1409. nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnAgree" "text" $(LICENSE_BTN_AGREE)
  1410. FunctionEnd
  1411. Function initInstallingPage
  1412. nsNiuniuSkin::SetControlAttribute $hInstallDlg "InstallingTitle" "bkimage" $(INSTALLING_TITLE)
  1413. FunctionEnd
  1414. Function initFinishPage
  1415. nsNiuniuSkin::SetControlAttribute $hInstallDlg "FinishPageTitle" "bkimage" $(FINISH_PAGE_TITLE)
  1416. nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnRun" "text" $(BTN_RUN)
  1417. FunctionEnd
  1418. Function un.initUnInstallPage
  1419. nsNiuniuSkin::SetControlAttribute $hInstallDlg "unInstallTitle" "bkimage" $(UN_INSTALL_TITLE)
  1420. nsNiuniuSkin::SetControlAttribute $hInstallDlg "unInstallPrompt" "text" $(UN_INSTALL_PROMPT)
  1421. nsNiuniuSkin::SetControlAttribute $hInstallDlg "chkbox_userdata" "text" $(UN_INSTALL_CHKBOX_USERDATA)
  1422. nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnUnInstall" "text" $(BTN_CONFIRM)
  1423. nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnUnClose" "text" $(BTN_CANCEL)
  1424. FunctionEnd
  1425. Function un.initUninstallingPage
  1426. nsNiuniuSkin::SetControlAttribute $hInstallDlg "unInstallingTitle" "bkimage" $(UN_INSTALL_TITLE)
  1427. FunctionEnd
  1428. Function un.initUninstallFinishPage
  1429. nsNiuniuSkin::SetControlAttribute $hInstallDlg "unInstallFinishTitle" "bkimage" $(UN_INSTALL_TITLE)
  1430. nsNiuniuSkin::SetControlAttribute $hInstallDlg "unInstallFinishPrompt" "text" $(UN_INSTALL_FINISH_PROMPT)
  1431. nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnUninstalled" "text" $(BTN_UNINSTALLED)
  1432. nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnUninstalledReboot" "text" $(BTN_UNINSTALLED_REBOOT)
  1433. FunctionEnd