ui_laser_setup.nsh 111 KB

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