ui_laser_setup.nsh 116 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830
  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=4dage.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\4dage.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\4dage.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\4dage.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" ""
  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. nsExec::ExecToStack '"cmd.exe" /c sc failure lasermongodb reset= 43200 actions= restart/60000/restart/86400//86400'
  712. nsExec::ExecToStack '"cmd.exe" /c sc failure laserredis reset= 43200 actions= restart/60000/restart/86400//86400'
  713. nsExec::ExecToStack '"cmd.exe" /c sc failure lasermysql reset= 43200 actions= restart/60000/restart/86400//86400'
  714. Sleep 2000
  715. ;
  716. ${StrRep} $0 '$INSTDIR\4DKK_PROGRAM_DATA\' '\' '\\'
  717. StrCpy $buildModelPath $0
  718. ${StrRep} $0 '$INSTDIR\4DKK_PROGRAM_STATIC\' '\' '\\'
  719. StrCpy $profilePath $0
  720. ${StrRep} $0 '$INSTDIR\CGAII' '\' '\\'
  721. StrCpy $buildCallPath $0
  722. ${StrRep} $0 '$INSTDIR\bin\resources\static' '\' '\\'
  723. StrCpy $binPath $0
  724. ${StrRep} $0 '$INSTDIR\jdk1.8\bin\java.exe' '\' '\\'
  725. StrCpy $javaPath $0
  726. nsJSON::Set /file $INSTDIR\bin\resources\static\setting.json
  727. nsJSON::Set /value `{}`
  728. nsJSON::Set `sceneConfig` /value `"config.json"`
  729. nsJSON::Set `sceheKey` /value `"id"`
  730. nsJSON::Set `sceneBundle` /value `"./build.zip"`
  731. nsJSON::Set `sceneBundleDir` /value `"capture"`
  732. nsJSON::Set `buildModelPath` /value `"$buildModelPath"`
  733. nsJSON::Set `javaPort` /value `9000`
  734. nsJSON::Set `v4JavaPort` /value `9101`
  735. nsJSON::Set `javaPath` /value `"$javaPath"`
  736. nsJSON::Set `profilePath` /value `"$profilePath"`
  737. nsJSON::Set `buildCallPath` /value `"$buildCallPath"`
  738. nsJSON::Set `binPath` /value `"$binPath"`
  739. nsJSON::Set `fuse` /value `${FUSE}`
  740. nsJSON::Set `ver` /value `${VER}`
  741. nsJSON::Set `version` /value `"${VERSION}"`
  742. nsJSON::Serialize /format /file $INSTDIR\bin\resources\static\setting.json
  743. nsExec::ExecToStack '"$INSTDIR\tools\update.bat" $INSTDIR '
  744. ;nsExec::ExecToStack "$INSTDIR\tools\laserOtherTools.exe -m u -i $INSTDIR"
  745. nsNiuniuSkin::SetControlAttribute $hInstallDlg "progress_tip" "text" $(UPDATING_DONE)
  746. ${EndIf}
  747. StrCpy $InstallState "1"
  748. nsNiuniuSkin::ShowPageItem $hInstallDlg "wizardTab" ${INSTALL_PAGE_FINISH}
  749. Call initFinishPage
  750. #Call OnFinished
  751. ${If} $update == "0"
  752. nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnRun" "text" $(UPDATING_DONE)
  753. ${EndIf}
  754. nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnClose" "enabled" "true"
  755. ;完成安装删除计划任务
  756. nsExec::ExecToStack 'schtasks /delete /tn "DeleteInstallFlagTask" /f'
  757. InstallAbort:
  758. FunctionEnd
  759. Function ExtractCallback
  760. Pop $1
  761. Pop $2
  762. System::Int64Op $1 * 100
  763. Pop $3
  764. System::Int64Op $3 / $2
  765. Pop $0
  766. nsNiuniuSkin::SetControlAttribute $hInstallDlg "slrProgress" "value" "$0"
  767. nsNiuniuSkin::SetControlAttribute $hInstallDlg "progress_pos" "text" "$0%"
  768. ${If} $1 == $2
  769. nsNiuniuSkin::SetControlAttribute $hInstallDlg "slrProgress" "value" "100"
  770. nsNiuniuSkin::SetControlAttribute $hInstallDlg "progress_pos" "text" "100%"
  771. ${EndIf}
  772. FunctionEnd
  773. Function OnSysCommandCloseEvent
  774. Call OnExitDUISetup
  775. FunctionEnd
  776. Function OnExitDUISetup
  777. ${If} $InstallState == "0"
  778. StrCpy $R8 "$(CONFIRM_EXIT)"
  779. StrCpy $R7 "1"
  780. Call ShowMsgBox
  781. pop $0
  782. ${If} $0 == 0
  783. goto endfun
  784. ${EndIf}
  785. ${EndIf}
  786. nsNiuniuSkin::ExitDUISetup
  787. endfun:
  788. FunctionEnd
  789. Function OnBtnMin
  790. SendMessage $hInstallDlg ${WM_SYSCOMMAND} 0xF020 0
  791. FunctionEnd
  792. Function OnBtnCancel
  793. nsNiuniuSkin::ExitDUISetup
  794. FunctionEnd
  795. Function OnEnvInstall
  796. EnVar::SetHKLM
  797. EnVar::AddValue FDMGEA_HOME "$INSTDIR"
  798. ;EnVar::SetHKLM
  799. ;EnVar::AddValue JAVA_HOME "$INSTDIR\jdk1.8"
  800. EnVar::SetHKLM
  801. EnVar::AddValue MYSQL_HOME "$INSTDIR\mysql"
  802. EnVar::SetHKLM
  803. EnVar::AddValue REDIS_HOME "$INSTDIR\redis"
  804. EnVar::SetHKLM
  805. EnVar::AddValue 4DKK_HOME "$INSTDIR\CGAII;$INSTDIR\CGAII\3dtile"
  806. EnVar::SetHKLM
  807. EnVar::AddValue MONGODB_HOME "$INSTDIR\mongodb"
  808. ;EnVar::SetHKLM
  809. ;EnVar::AddValue CLASS_PATH ".;%JAVA_HOME%\lib\tools.jar;%JAVA_HOME%\lib\dt.jar"
  810. EnVar::SetHKLM
  811. ;EnVar::AddValue "Path" "$INSTDIR\jdk1.8\bin;$INSTDIR\mysql\bin;$INSTDIR\mongodb\bin;$INSTDIR\redis;$INSTDIR\CGAII;$INSTDIR\CGAII\lib;"
  812. EnVar::AddValue "Path" "$INSTDIR\mysql\bin;$INSTDIR\mongodb\bin;$INSTDIR\redis;$INSTDIR\CGAII;$INSTDIR\CGAII\lib;$INSTDIR\CGAII\3dtile"
  813. SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
  814. ;nsExec::ExecToStack '"$INSTDIR\tools\env_install.bat" $INSTDIR '
  815. FunctionEnd
  816. Function un.OnEnvDownInstall
  817. EnVar::SetHKLM
  818. EnVar::Delete "FDMGEA_HOME" "$INSTDIR"
  819. ;EnVar::Delete "JAVA_HOME" "$INSTDIR\jdk1.8"
  820. EnVar::Delete "MYSQL_HOME" "$INSTDIR\mysql"
  821. EnVar::Delete "REDIS_HOME" "$INSTDIR\redis"
  822. EnVar::Delete "4DKK_HOME" "$INSTDIR\CGAII"
  823. EnVar::Delete "4DKK_HOME" "$INSTDIR\CGAII\3dtile"
  824. EnVar::Delete "MONGODB_HOME" "$INSTDIR\mongodb"
  825. ;EnVar::Delete "CLASS_PATH" "%JAVA_HOME%\lib\tools.jar;%JAVA_HOME%\lib\dt.jar"
  826. ;EnVar::DeleteValue "PATH" "%JAVA_HOME%\bin"
  827. EnVar::DeleteValue "PATH" "$INSTDIR\mysql\bin"
  828. EnVar::DeleteValue "PATH" "$INSTDIR\mongodb\bin"
  829. EnVar::DeleteValue "PATH" "$INSTDIR\redis"
  830. EnVar::DeleteValue "PATH" "$INSTDIR\CGAII"
  831. EnVar::DeleteValue "PATH" "$INSTDIR\CGAII\lib"
  832. EnVar::DeleteValue "PATH" "$INSTDIR\CGAII\3dtile"
  833. ;nsExec::ExecToStack '"$INSTDIR\tools\uninstall.bat" $INSTDIR '
  834. FunctionEnd
  835. Function un.installService
  836. nsExec::ExecToStack '"$INSTDIR\tools\unservice.bat" $INSTDIR '
  837. SimpleSC::ExistsService "lasermongodb"
  838. Pop $0
  839. ${If} $0 == 0
  840. SimpleSC::StopService "lasermongodb" 0 30
  841. SimpleSC::RemoveService "lasermongodb"
  842. ${EndIf}
  843. SimpleSC::ExistsService "lasermysql"
  844. Pop $0
  845. ${If} $0 == 0
  846. SimpleSC::StopService "lasermysql" 0 30
  847. SimpleSC::RemoveService "lasermysql"
  848. ${EndIf}
  849. SimpleSC::ExistsService "laserredis"
  850. Pop $0
  851. ${If} $0 == 0
  852. SimpleSC::StopService "laserredis" 0 30
  853. SimpleSC::RemoveService "laserredis"
  854. ${EndIf}
  855. SimpleSC::ExistsService "checkLaserProcess"
  856. Pop $0
  857. ${If} $0 == 0
  858. SimpleSC::StopService "checkLaserProcess" 0 30
  859. SimpleSC::RemoveService "checkLaserProcess"
  860. ${EndIf}
  861. FunctionEnd
  862. Function installService
  863. ${StrRep} $0 '$INSTDIR\mysql' '\' '\\'
  864. StrCpy $basedir $0
  865. ${StrRep} $0 '$INSTDIR\mysql\data' '\' '\\'
  866. StrCpy $datadir $0
  867. ${StrRep} $0 '$INSTDIR\mysql\logs.log' '\' '\\'
  868. StrCpy $logError $0
  869. WriteINIStr $INSTDIR\mysql\my.ini mysqld port 3307
  870. WriteINIStr $INSTDIR\mysql\my.ini mysqld basedir $basedir
  871. WriteINIStr $INSTDIR\mysql\my.ini mysqld datadir $datadir
  872. WriteINIStr $INSTDIR\mysql\my.ini mysqld log-error $logError
  873. WriteINIStr $INSTDIR\mysql\my.ini mysqld max_connections 1000
  874. WriteINIStr $INSTDIR\mysql\my.ini mysqld max_connect_errors 10
  875. WriteINIStr $INSTDIR\mysql\my.ini mysqld character-set-server utf8mb4
  876. WriteINIStr $INSTDIR\mysql\my.ini mysqld default-storage-engine INNODB
  877. WriteINIStr $INSTDIR\mysql\my.ini mysqld default_authentication_plugin mysql_native_password
  878. WriteINIStr $INSTDIR\mysql\my.ini mysqld local_infile ON
  879. WriteINIStr $INSTDIR\mysql\my.ini mysql default-character-set utf8mb4
  880. WriteINIStr $INSTDIR\mysql\my.ini mysql local_infile ON
  881. WriteINIStr $INSTDIR\mysql\my.ini client port 3307
  882. WriteINIStr $INSTDIR\mysql\my.ini client default-character-set utf8mb4
  883. Sleep 2000
  884. SetOutPath "$INSTDIR\mysql\bin"
  885. ReadRegStr $vc_flag HKLM "SOFTWARE\WOW6432Node\Microsoft\VisualStudio\14.0\VC\Runtimes\X64" "Installed"
  886. ${IF} $vc_flag != "1"
  887. nsExec::ExecToStack '"cmd.exe" /c $INSTDIR\mysql\bin\VC_redist.x64.exe /install /quiet /norestart'
  888. ${EndIf}
  889. Sleep 2000
  890. nsExec::ExecToStack '"cmd.exe" /c $INSTDIR\mysql\bin\mysqld.exe --initialize-insecure --lower-case-table-names=1'
  891. Sleep 2000
  892. nsExec::ExecToStack '"cmd.exe" /c $INSTDIR\mysql\bin\mysqld.exe --install lasermysql'
  893. ; Pop $0
  894. ; Pop $1
  895. ; ${If} $0 = 0
  896. ; nsExec::ExecToStack '"cmd.exe" /c $INSTDIR\mysql\bin\mysqld.exe --install lasermysql'
  897. ; ${Else}
  898. ; ;MessageBox mb_ok "code=$0,mes=$1"
  899. ; Sleep 2000
  900. ; nsExec::ExecToStack '"cmd.exe" /c $INSTDIR\mysql\bin\mysqld.exe --initialize-insecure --lower-case-table-names=1'
  901. ; Sleep 2000
  902. ; nsExec::ExecToStack '"cmd.exe" /c $INSTDIR\mysql\bin\mysqld.exe --install lasermysql'
  903. ; ${EndIf}
  904. IfFileExists "$INSTDIR\USER_DATA\data\*.*" 0 static_not_found
  905. CopyFiles /SILENT $INSTDIR\USER_DATA\data\*.* $INSTDIR\mysql\data
  906. RMDir /r "$INSTDIR\USER_DATA\data\"
  907. Delete "$INSTDIR\mysql\sqlfile\fdkk_laser.sql"
  908. goto static_end_of
  909. static_not_found:
  910. goto static_end_of
  911. static_end_of:
  912. nsExec::ExecToStack '"cmd.exe" /c powercfg.exe /hibernate off '
  913. SimpleSC::StartService "lasermysql" "" 30
  914. SetOutPath "$INSTDIR\redis"
  915. nsExec::ExecToStack '"cmd.exe" /c redis-server.exe --service-install "$INSTDIR\redis\redis.windows.conf" --service-name laserredis --loglevel verbose'
  916. SimpleSC::StartService "laserredis" "" 30
  917. nsExec::ExecToStack '"cmd.exe" /c sc config laserredis start=auto'
  918. SimpleSC::RestartService "laserredis" "" 30
  919. Sleep 2000
  920. SetOutPath "$INSTDIR\mongodb"
  921. ${StrRep} $0 '$INSTDIR\mongodb\db' '\' '\\'
  922. StrCpy $dbpath $0
  923. ${StrRep} $0 '$INSTDIR\mongodb\logs\mongo.log' '\' '\\'
  924. StrCpy $logpath $0
  925. ClearErrors
  926. FileOpen $0 $INSTDIR\mongodb\mongo.conf w
  927. IfErrors otherW
  928. FileWrite $0 'port=29031$\n'
  929. FileWrite $0 'dbpath=$dbpath$\n'
  930. FileWrite $0 'logpath=$logpath$\n'
  931. FileWrite $0 'logappend=true$\n'
  932. FileWrite $0 'maxConns=1000$\n'
  933. FileClose $0
  934. goto done
  935. otherW:
  936. ;nsExec::ExecToStack "$INSTDIR\tools\laserOtherTools.exe -m w -i $INSTDIR\mongodb"
  937. nsExec::ExecToStack '"$INSTDIR\tools\wirteMconf.bat" $INSTDIR\mongodb\ '
  938. goto done
  939. done:
  940. nsExec::ExecToStack '"cmd.exe" /c sc create lasermongodb binpath= "$INSTDIR\mongodb\bin\mongod.exe --config $INSTDIR\mongodb\mongo.conf --service" start= auto'
  941. SimpleSC::StartService "lasermongodb" "" 30
  942. Sleep 2000
  943. nsExec::ExecToStack '"cmd.exe" /c sc failure lasermongodb reset= 43200 actions= restart/60000/restart/86400//86400'
  944. nsExec::ExecToStack '"cmd.exe" /c sc failure laserredis reset= 43200 actions= restart/60000/restart/86400//86400'
  945. nsExec::ExecToStack '"cmd.exe" /c sc failure lasermysql reset= 43200 actions= restart/60000/restart/86400//86400'
  946. ; IfFileExists "$INSTDIR\USER_DATA\pro\*.*" 0 pro_not_found
  947. ; CopyFiles /SILENT $INSTDIR\USER_DATA\pro\*.* $INSTDIR\4DKK_PROGRAM_DATA
  948. ; RMDir /r "$INSTDIR\USER_DATA\pro"
  949. ; goto pro_end_of
  950. ; pro_not_found:
  951. ; goto pro_end_of
  952. ; pro_end_of:
  953. Sleep 2000
  954. ;
  955. ${StrRep} $0 '$INSTDIR\4DKK_PROGRAM_DATA\' '\' '\\'
  956. StrCpy $buildModelPath $0
  957. ${StrRep} $0 '$INSTDIR\4DKK_PROGRAM_STATIC\' '\' '\\'
  958. StrCpy $profilePath $0
  959. ${StrRep} $0 '$INSTDIR\CGAII' '\' '\\'
  960. StrCpy $buildCallPath $0
  961. ${StrRep} $0 '$INSTDIR\bin\resources\static' '\' '\\'
  962. StrCpy $binPath $0
  963. ${StrRep} $0 '$INSTDIR\jdk1.8\bin\java.exe' '\' '\\'
  964. StrCpy $javaPath $0
  965. nsJSON::Set /file $INSTDIR\bin\resources\static\setting.json
  966. nsJSON::Set /value `{}`
  967. nsJSON::Set `sceneConfig` /value `"config.json"`
  968. nsJSON::Set `sceheKey` /value `"id"`
  969. nsJSON::Set `sceneBundle` /value `"./build.zip"`
  970. nsJSON::Set `sceneBundleDir` /value `"capture"`
  971. nsJSON::Set `buildModelPath` /value `"$buildModelPath"`
  972. nsJSON::Set `javaPort` /value `9000`
  973. nsJSON::Set `v4JavaPort` /value `9101`
  974. nsJSON::Set `javaPath` /value `"$javaPath"`
  975. nsJSON::Set `profilePath` /value `"$profilePath"`
  976. nsJSON::Set `buildCallPath` /value `"$buildCallPath"`
  977. nsJSON::Set `binPath` /value `"$binPath"`
  978. nsJSON::Set `fuse` /value `${FUSE}`
  979. nsJSON::Set `ver` /value `${VER}`
  980. nsJSON::Set `version` /value `"${VERSION}"`
  981. nsJSON::Serialize /format /file $INSTDIR\bin\resources\static\setting.json
  982. ;nsExec::ExecToStack "$INSTDIR\tools\laserOtherTools.exe -m l -i $INSTDIR"
  983. nsExec::ExecToStack '"$INSTDIR\tools\service.bat" $INSTDIR '
  984. nsExec::ExecToStack '"$INSTDIR\tools\update.bat" $INSTDIR '
  985. ; FileOpen $0 $INSTDIR\bin\resources\static\4dmega.vmoptions w
  986. ; IfErrors done
  987. ; FileWrite $0 '-DBIN_PATH=$INSTDIR\bin\resources\static$\n'
  988. ; FileWrite $0 '-DPROFILE_PATH=$INSTDIR\4DKK_PROGRAM_STATIC\$\n'
  989. ; FileWrite $0 '-DBUILD_MODEL_PATH=$INSTDIR\4DKK_PROGRAM_DATA\$\n'
  990. ; FileWrite $0 '-DBUILD_CALL_PATH=$INSTDIR\CGAII\$\n'
  991. ; FileWrite $0 '-Dspring.profiles.active=standAloneProd$\n'
  992. ; FileWrite $0 '-Dserver.port=9000$\n'
  993. ; FileClose $0
  994. ; done:
  995. ;nsExec::ExecToStack '"cmd.exe" /c $INSTDIR\tools\MonitorPid.exe install '
  996. functionend
  997. Function OnFinished
  998. #MessageBox MB_YESNO|MB_ICONQUESTION "$(INSTALL_REBOOT)" IDNO +2
  999. #Reboot
  1000. #Exec "$INSTDIR${EXE_NAME}"
  1001. nsExec::ExecToStack 'ie4uinit.exe -ClearIconCache'
  1002. nsExec::ExecToStack 'ie4uinit.exe -show'
  1003. System::Call 'shell32.dll::SHChangeNotify(l, l, i, i) v (0x08000000, 0, 0, 0)'
  1004. WriteRegStr HKLM "Software\${PRODUCT_PATHNAME}" "language" $LANGUAGE
  1005. Call OnExitDUISetup
  1006. FunctionEnd
  1007. Function OnBtnSelectDir
  1008. nsNiuniuSkin::SelectInstallDirEx $hInstallDlg $(PLEASE_SELECT_INSTALLATION_PATH)
  1009. Pop $0
  1010. ${Unless} "$0" == ""
  1011. nsNiuniuSkin::SetControlAttribute $hInstallDlg "editDir" "text" $0
  1012. ${EndUnless}
  1013. FunctionEnd
  1014. Function StepHeightSizeAsc
  1015. ${ForEach} $R0 390 500 + 10
  1016. nsNiuniuSkin::SetWindowSize $hInstallDlg 480 $R0
  1017. Sleep 5
  1018. ${Next}
  1019. FunctionEnd
  1020. Function StepHeightSizeDsc
  1021. ${ForEach} $R0 480 390 - 10
  1022. nsNiuniuSkin::SetWindowSize $hInstallDlg 480 $R0
  1023. Sleep 5
  1024. ${Next}
  1025. FunctionEnd
  1026. Function OnBtnShowMore
  1027. nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnShowMore" "enabled" "false"
  1028. nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnHideMore" "enabled" "false"
  1029. nsNiuniuSkin::SetControlAttribute $hInstallDlg "moreconfiginfo" "visible" "true"
  1030. nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnHideMore" "visible" "true"
  1031. nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnShowMore" "visible" "false"
  1032. GetFunctionAddress $0 StepHeightSizeAsc
  1033. BgWorker::CallAndWait
  1034. nsNiuniuSkin::SetWindowSize $hInstallDlg 480 510
  1035. nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnShowMore" "enabled" "true"
  1036. nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnHideMore" "enabled" "true"
  1037. FunctionEnd
  1038. Function OnBtnHideMore
  1039. nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnShowMore" "enabled" "false"
  1040. nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnHideMore" "enabled" "false"
  1041. nsNiuniuSkin::SetControlAttribute $hInstallDlg "moreconfiginfo" "visible" "false"
  1042. nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnHideMore" "visible" "false"
  1043. nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnShowMore" "visible" "true"
  1044. GetFunctionAddress $0 StepHeightSizeDsc
  1045. BgWorker::CallAndWait
  1046. nsNiuniuSkin::SetWindowSize $hInstallDlg 480 390
  1047. nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnShowMore" "enabled" "true"
  1048. nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnHideMore" "enabled" "true"
  1049. FunctionEnd
  1050. Function OnBtnShowConfig
  1051. ;nsNiuniuSkin::ShowPageItem $hInstallDlg "wizardTab" ${INSTALL_PAGE_CONFIG}
  1052. nsNiuniuSkin::SetControlAttribute $hInstallDlg "licenseshow" "visible" "false"
  1053. FunctionEnd
  1054. Function OnBtnDirPre
  1055. StrCpy $R8 "$(CONFIRM_EXIT)"
  1056. StrCpy $R7 "0"
  1057. Call ShowMsgBox
  1058. ;nsNiuniuSkin::PrePage "wizardTab"
  1059. FunctionEnd
  1060. Function un.BtnDirPre
  1061. StrCpy $R8 "$(UNINSTALL)"
  1062. StrCpy $R7 "0"
  1063. Call un.ShowMsgBox
  1064. ;nsNiuniuSkin::PrePage "wizardTab"
  1065. FunctionEnd
  1066. Function un.ShowMsgBoxBackUps
  1067. nsNiuniuSkin::InitSkinSubPage "msgBox_backup.xml" "backupBtnOK" "gotouninstall"
  1068. Pop $hInstallSubDlg
  1069. nsNiuniuSkin::SetControlAttribute $hInstallSubDlg "lblMsg" "text" $(UNINSTALL_ERROR)
  1070. nsNiuniuSkin::SetControlAttribute $hInstallSubDlg "backupBtnOK" "text" $(I_KNOW)
  1071. nsNiuniuSkin::SetControlAttribute $hInstallSubDlg "lblTitle" "text" $(PROMPT)
  1072. nsNiuniuSkin::ShowSkinSubPage 0
  1073. FunctionEnd
  1074. Function un.ShowMsgBox
  1075. nsNiuniuSkin::InitSkinSubPage "msgBox.xml" "btnOK" "btnCancel,btnClose"
  1076. Pop $hInstallSubDlg
  1077. nsNiuniuSkin::SetControlAttribute $hInstallSubDlg "lblTitle" "text" $(PROMPT)
  1078. nsNiuniuSkin::SetControlAttribute $hInstallSubDlg "lblMsg" "text" "$R8"
  1079. ${If} "$R7" == "1"
  1080. nsNiuniuSkin::SetControlAttribute $hInstallSubDlg "hlCancel" "visible" "true"
  1081. ${EndIf}
  1082. nsNiuniuSkin::ShowSkinSubPage 0
  1083. FunctionEnd
  1084. Function un.ExitDUISetup
  1085. nsExec::ExecToStack 'ie4uinit.exe -ClearIconCache'
  1086. nsExec::ExecToStack 'ie4uinit.exe -show'
  1087. System::Call 'shell32.dll::SHChangeNotify(l, l, i, i) v (0x08000000, 0, 0, 0)'
  1088. nsNiuniuSkin::ExitDUISetup
  1089. FunctionEnd
  1090. Function un.OnBtnMin
  1091. SendMessage $hInstallDlg ${WM_SYSCOMMAND} 0xF020 0
  1092. FunctionEnd
  1093. Section "un.silentInstallSec" SEC02
  1094. #MessageBox MB_OK|MB_ICONINFORMATION "Test silent install. you can add your silent uninstall code here."
  1095. SectionEnd
  1096. Function un.onUninstall
  1097. nsProcess::_FindProcess "${EXE_NAME_EXT}"
  1098. Pop $R0
  1099. ${If} $R0 == 0
  1100. StrCpy $R8 "${PRODUCT_NAME} 正在运行,请退出后重试!"
  1101. StrCpy $R7 "0"
  1102. Call un.ShowMsgBox
  1103. goto InstallAbort
  1104. ${EndIf}
  1105. nsNiuniuSkin::GetControlAttribute $hInstallDlg "chkbox_userdata" "selected"
  1106. Pop $0
  1107. StrCpy $sReserveData $0
  1108. ${If} $sReserveData == 1
  1109. nsNiuniuSkin::SetControlAttribute $hInstallDlg "un_progress_tip" "text" $(PREPARING_TO_UNINSTALL)
  1110. CreateDirectory $INSTDIR\USER_DATA
  1111. ; nsExec::ExecToStack "$INSTDIR\tools\laserOtherTools.exe -m v -i $INSTDIR"
  1112. ; Pop $0
  1113. SimpleSC::GetServiceStatus "lasermongodb"
  1114. Pop $0 ; 返回错误码,0 表示成功,非0 表示失败
  1115. Pop $1 ; 返回服务状态,状态值参考 Windows 服务状态代码
  1116. ${If} $0 == 0
  1117. ${If} $1 == 4 ; 服务状态值为 4 表示服务正在运行
  1118. Call un.onPassUninstall
  1119. ${Else}
  1120. RMDir /r "$INSTDIR\USER_DATA"
  1121. Call un.ShowMsgBoxBackUps
  1122. Pop $0
  1123. ${If} $0 == 0
  1124. Call un.onPassUninstall
  1125. ${EndIf}
  1126. ${If} $0 == 1
  1127. Call un.onNoPassUninstall
  1128. ${EndIf}
  1129. ${EndIf}
  1130. ${Else}
  1131. RMDir /r "$INSTDIR\USER_DATA"
  1132. Call un.ShowMsgBoxBackUps
  1133. Pop $0
  1134. ${If} $0 == 0
  1135. Call un.onPassUninstall
  1136. ${EndIf}
  1137. ${If} $0 == 1
  1138. Call un.onNoPassUninstall
  1139. ${EndIf}
  1140. ${EndIf}
  1141. ${Else}
  1142. Call un.onPassUninstall
  1143. ${EndIf}
  1144. InstallAbort:
  1145. FunctionEnd
  1146. Function un.onNoPassUninstall
  1147. nsNiuniuSkin::ExitDUISetup
  1148. FunctionEnd
  1149. Function un.onPassUninstall
  1150. ${If} $sReserveData == 1
  1151. CreateDirectory $INSTDIR\USER_DATA
  1152. ${EndIf}
  1153. Call un.initUninstallingPage
  1154. nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnClose" "enabled" "false"
  1155. nsNiuniuSkin::ShowPageItem $hInstallDlg "wizardTab" ${INSTALL_PAGE_UNISTPROCESSING}
  1156. nsNiuniuSkin::SetControlAttribute $hInstallDlg "slrUnInstProgress" "min" "0"
  1157. nsNiuniuSkin::SetControlAttribute $hInstallDlg "slrUnInstProgress" "max" "100"
  1158. IntOp $UnInstallValue 0 + 1
  1159. nsNiuniuSkin::SetControlAttribute $hInstallDlg "un_progress_tip" "text" $(PREPARING_TO_UNINSTALL)
  1160. ; nsExec::ExecToStack "$INSTDIR\tools\laserOtherTools.exe -m b -i $INSTDIR "
  1161. ; BgWorker::CallAndWait
  1162. GetFunctionAddress $0 un.OnEnvDownInstall
  1163. BgWorker::CallAndWait
  1164. nsExec::ExecToStack 'cmd.exe /c powercfg.exe /hibernate on '
  1165. GetFunctionAddress $0 un.installService
  1166. BgWorker::CallAndWait
  1167. nsNiuniuSkin::SetControlAttribute $hInstallDlg "un_progress_tip" "text" $(UNINSTALLING)
  1168. Call un.DeleteShotcutAndInstallInfo
  1169. IntOp $UnInstallValue $UnInstallValue + 8
  1170. GetFunctionAddress $0 un.RemoveFiles
  1171. BgWorker::CallAndWait
  1172. FunctionEnd
  1173. Function un.RemoveFiles
  1174. ${Locate} "$INSTDIR" "/G=0 /M=*.*" "un.onDeleteFileFound"
  1175. StrCpy $InstallState "1"
  1176. ; 卸载成功后创建标记文件
  1177. FileOpen $0 "$INSTDIR\install.flag" w
  1178. FileClose $0
  1179. ; 重启计算机
  1180. ; 创建任务计划程序命令
  1181. nsExec::ExecToStack 'schtasks /create /tn "DeleteInstallFlagTask" /tr "cmd.exe /C del $INSTDIR\install.flag" /sc onstart /ru System /rl HIGHEST /F'
  1182. nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnClose" "enabled" "true"
  1183. nsNiuniuSkin::SetControlAttribute $hInstallDlg "slrUnInstProgress" "value" "100"
  1184. Call un.initUninstallFinishPage
  1185. nsNiuniuSkin::ShowPageItem $hInstallDlg "wizardTab" ${INSTALL_PAGE_UNISTFINISH}
  1186. FunctionEnd
  1187. Function un.onDeleteFileFound
  1188. ; $R9 "path\name"
  1189. ; $R8 "path"
  1190. ; $R7 "name"
  1191. ; $R6 "size" ($R6 = "" if directory, $R6 = "0" if file with /S=)
  1192. ; MessageBox MB_OK "R9--------$R9"
  1193. ; MessageBox MB_OK "R8--------$R8"
  1194. ; MessageBox MB_OK "R7--------$R7"
  1195. ;不用保留场景
  1196. ${If} $sReserveData == 0
  1197. ${If} $R7 != "install.flag"
  1198. Delete "$R9"
  1199. RMDir /r "$R9"
  1200. RMDir "$R9"
  1201. ${EndIf}
  1202. ${EndIf}
  1203. ;保留场景
  1204. ${If} $sReserveData == 1
  1205. ${If} $R7 != "install.flag"
  1206. RMDir /r "$R8\bin"
  1207. RMDir /r "$R8\CGAII"
  1208. RMDir /r "$R8\mongodb"
  1209. RMDir /r "$R8\mysql"
  1210. RMDir /r "$R8\redis"
  1211. RMDir /r "$R8\jdk1.8"
  1212. ; RMDir /r "$R8\4DKK_PROGRAM_STATIC"
  1213. ; RMDir /r "$R8\4DKK_PROGRAM_DATA"
  1214. RMDir /r "$R8\tools"
  1215. Delete "$R8\uninst.exe"
  1216. ${EndIf}
  1217. ${EndIf}
  1218. IntOp $UnInstallValue $UnInstallValue + 2
  1219. ${If} $UnInstallValue > 100
  1220. IntOp $UnInstallValue 100 + 0
  1221. nsNiuniuSkin::SetControlAttribute $hInstallDlg "slrUnInstProgress" "value" "100"
  1222. ${Else}
  1223. nsNiuniuSkin::SetControlAttribute $hInstallDlg "slrUnInstProgress" "value" "$UnInstallValue"
  1224. nsNiuniuSkin::SetControlAttribute $hInstallDlg "un_progress_pos" "text" "$UnInstallValue%"
  1225. #Sleep 100
  1226. ${EndIf}
  1227. undelete:
  1228. Push "LocateNext"
  1229. FunctionEnd
  1230. #
  1231. # 以 Unicode 字符串的方式进行判断 (与 NSIS 是 ANSI/Unicode 无关)
  1232. # 但建议 Unicode 版本优先使用此函数。
  1233. #
  1234. Function PathIsDBCS_W
  1235. Exch $R0
  1236. Push $R1
  1237. Push $R2
  1238. Push $R3
  1239. System::Call "*(&w${NSIS_MAX_STRLEN}R0)p.R1"
  1240. StrCpy $R0 0
  1241. StrCpy $R2 $R1
  1242. lbl_loop:
  1243. # Unicode 版取 2 个字节长度的字符,字符串遇到 0 字符表示结束了。
  1244. System::Call "*$R2(&i2.R3)"
  1245. IntCmp $R3 0 lbl_done
  1246. # Unicode 字符直接判断字符值,大于 128 的我们就视为非英文字符。
  1247. IntCmp $R3 128 0 lbl_skip
  1248. IntOp $R0 $R0 !
  1249. Goto lbl_done
  1250. lbl_skip:
  1251. # 如果用 NSIS 3.x 这里可以用 IntPtrOp 代替。
  1252. IntOp $R2 $R2 + 2
  1253. Goto lbl_loop
  1254. lbl_done:
  1255. System::Free $R1
  1256. Pop $R3
  1257. Pop $R2
  1258. Pop $R1
  1259. Exch $R0
  1260. FunctionEnd
  1261. #
  1262. # 以 ANSI 字符串的方式进行判断 (与 NSIS 是 ANSI/Unicode 无关)
  1263. # 但建议 ANSI 版本优先使用此函数。
  1264. #
  1265. Function PathIsDBCS_A
  1266. Exch $R0
  1267. Push $R1
  1268. Push $R2
  1269. Push $R3
  1270. Push $R4
  1271. System::Call "*(&m${NSIS_MAX_STRLEN}R0)p.R1"
  1272. StrCpy $R0 0
  1273. StrCpy $R2 $R1
  1274. lbl_loop:
  1275. # ANSI 版取 1 个字节长度的字符,字符串遇到 0 字符表示结束了。
  1276. System::Call "*$R2(&i1.R3)"
  1277. IntCmp $R3 0 lbl_done
  1278. # ANSI 字符用 IsDBCSLeadByte 判断是否双字节字符的前导字节。
  1279. System::Call "kernel32::IsDBCSLeadByte(iR3)i.R4"
  1280. IntCmp $R4 0 lbl_skip
  1281. IntOp $R0 $R0 !
  1282. Goto lbl_done
  1283. lbl_skip:
  1284. # 用 CharNextA 得到下一个字符的地址 (可正确处理双字节字符)。
  1285. System::Call "user32::CharNextA(pR2)p.R2"
  1286. Goto lbl_loop
  1287. lbl_done:
  1288. Pop $R4
  1289. Pop $R3
  1290. Pop $R2
  1291. Pop $R1
  1292. Exch $R0
  1293. FunctionEnd
  1294. #
  1295. # 当选择的安装路径变更时,路径为空或包含双字节字符 (不限于简体中文),都不允许继续。
  1296. # 路径为空时,NSIS 会自行判断。
  1297. #
  1298. # 此示例未判断是否包含空格。如有需要,请与示例一配合使用。
  1299. #
  1300. Function onVerifyInstDir
  1301. # 检查安装路径是否包含双字节字符 (不限于简体中文)。
  1302. StrCpy $0 $INSTDIR
  1303. StrLen $1 $0
  1304. # 这里也可以换成 CheckEnglishPath 以测试效果。
  1305. ${If} $1 == 0
  1306. Push 2
  1307. ${Else}
  1308. Push $INSTDIR
  1309. Call PathIsDBCS_A
  1310. Pop $R0
  1311. Push $R0
  1312. ${endif}
  1313. lbl_done:
  1314. FunctionEnd
  1315. Function CheckEnglishPath
  1316. Exch $0 ; 保存返回值的变量
  1317. Exch ; 将字符串参数放在栈顶
  1318. Push $1
  1319. Push $2
  1320. Push $3
  1321. StrLen $1 $0 ; 计算字符串长度
  1322. loop:
  1323. StrCpy $2 $1 ; 复制当前长度
  1324. IntOp $1 $1 - 1 ; 长度减1
  1325. StrCpy $3 $0 1 $2 ; 获取当前字符
  1326. ${If} $3 == " " ; 如果字符是空格
  1327. Goto notEnglish ; 跳转到不是英文路径的逻辑
  1328. ${EndIf}
  1329. ${If} $1 > 0 ; 如果还有字符未检查
  1330. Goto loop ; 继续循环
  1331. ${EndIf}
  1332. ; 路径是全英文的
  1333. Pop $3
  1334. Pop $2
  1335. Pop $1
  1336. StrCpy $0 0
  1337. Exch $0
  1338. notEnglish:
  1339. ; 路径不是全英文的
  1340. Pop $3
  1341. Pop $2
  1342. Pop $1
  1343. StrCpy $0 1
  1344. Exch $0
  1345. FunctionEnd
  1346. Function onVerifySpecialInstDir
  1347. # 检查安装路径是否包含双字节字符 (不限于简体中文)。
  1348. StrCpy $0 $INSTDIR
  1349. StrLen $1 $0
  1350. # 这里也可以换成 PathIsDBCS_A 以测试效果。
  1351. ${If} $1 == 0
  1352. Push 2
  1353. ${Else}
  1354. Push $INSTDIR
  1355. Call CheckSpecialCharacters
  1356. Pop $0 ; 获取返回结果
  1357. Push $R0
  1358. ${endif}
  1359. FunctionEnd
  1360. Function CheckSpecialCharacters
  1361. Exch $0 ; 保存返回值的变量
  1362. Exch ; 将字符串参数放在栈顶
  1363. StrCpy $1 "!@#¥%……&*()!@#$%^&*()<>_+{}[];'?.,~`" ; 特殊字符
  1364. StrCpy $2 0 ; 特殊字符字符串索引
  1365. StrCpy $3 0 ; 字符串索引
  1366. StrLen $4 $0 ; 特殊字符字符串长度
  1367. loop:
  1368. StrCpy $5 $1 1 $2 ; 从特殊字符字符串中获取一个字符
  1369. StrCpy $6 $0 1 $3 ; 从需要检查的字符串中获取一个字符
  1370. StrCmp $5 "" done ; 如果特殊字符字符串已经检查完,跳转到 done
  1371. StrCmp $6 "" next ; 如果需要检查的字符串已经检查完,跳转到 next
  1372. StrCmp $5 $6 found ; 如果找到特殊字符,跳转到 found
  1373. IntOp $3 $3 + 1 ; 否则,增加需要检查的字符串的索引
  1374. Goto loop
  1375. next:
  1376. IntOp $2 $2 + 1 ; 增加特殊字符字符串的索引
  1377. StrCpy $3 0 ; 重置需要检查的字符串的索引
  1378. Goto loop
  1379. found:
  1380. StrCpy $0 "1"
  1381. Goto End
  1382. done:
  1383. StrCpy $0 "0"
  1384. end:
  1385. Exch $0 ; 将返回值出栈
  1386. FunctionEnd
  1387. Function isEmptyDir
  1388. # Stack -> # Stack: <directory>
  1389. Exch $0 # Stack: $0
  1390. Push $1 # Stack: $1, $0
  1391. FindFirst $0 $1 "$0\*.*"
  1392. strcmp $1 "." 0 _notempty
  1393. FindNext $0 $1
  1394. strcmp $1 ".." 0 _notempty
  1395. ClearErrors
  1396. FindNext $0 $1
  1397. IfErrors 0 _notempty
  1398. FindClose $0
  1399. Pop $1 # Stack: $0
  1400. StrCpy $0 1
  1401. Exch $0 # Stack: 1 (true)
  1402. goto _end
  1403. _notempty:
  1404. FindClose $0
  1405. ClearErrors
  1406. Pop $1 # Stack: $0
  1407. StrCpy $0 0
  1408. Exch $0 # Stack: 0 (false)
  1409. _end:
  1410. FunctionEnd
  1411. Function un.isEmptyDir
  1412. # Stack -> # Stack: <directory>
  1413. Exch $0 # Stack: $0
  1414. Push $1 # Stack: $1, $0
  1415. FindFirst $0 $1 "$0\*.*"
  1416. strcmp $1 "." 0 _notempty
  1417. FindNext $0 $1
  1418. strcmp $1 ".." 0 _notempty
  1419. ClearErrors
  1420. FindNext $0 $1
  1421. IfErrors 0 _notempty
  1422. FindClose $0
  1423. Pop $1 # Stack: $0
  1424. StrCpy $0 1
  1425. Exch $0 # Stack: 1 (true)
  1426. goto _end
  1427. _notempty:
  1428. FindClose $0
  1429. ClearErrors
  1430. Pop $1 # Stack: $0
  1431. StrCpy $0 0
  1432. Exch $0 # Stack: 0 (false)
  1433. _end:
  1434. FunctionEnd
  1435. Function initRegPage
  1436. nsNiuniuSkin::SetControlAttribute $hInstallDlg "reg_title" "bkimage" $(REG_TITLE)
  1437. nsNiuniuSkin::SetControlAttribute $hInstallDlg "install_info" "text" $(INSTALL_INFO)
  1438. nsNiuniuSkin::SetControlAttribute $hInstallDlg "machineCode" "text" $(MACHINE_CODE)
  1439. nsNiuniuSkin::SetControlAttribute $hInstallDlg "reg_machine_info" "text" $(REG_MACHINE_INFO)
  1440. nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnCopyMachineinfo" "text" $(BTN_COPY_MACHINEINFO)
  1441. nsNiuniuSkin::SetControlAttribute $hInstallDlg "installKey" "text" $(INSTALL_KEY)
  1442. nsNiuniuSkin::SetControlAttribute $hInstallDlg "regPrompt" "text" $(REG_PROMPT)
  1443. nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnRegConfirm" "text" $(BTN_REG_CONFIRM)
  1444. FunctionEnd
  1445. Function initConfigPage
  1446. nsNiuniuSkin::SetControlAttribute $hInstallDlg "configPageTitle" "bkimage" $(CONFIG_PAGE_TITLE)
  1447. nsNiuniuSkin::SetControlAttribute $hInstallDlg "configInstallPath" "text" $(CONFIG_INSTALL_PATH)
  1448. nsNiuniuSkin::SetControlAttribute $hInstallDlg "chkAgree" "text" $(CONFIG_CHK_AGREE)
  1449. ${If} $LANGUAGE == '1033'
  1450. nsNiuniuSkin::SetControlAttribute $hInstallDlg "configInstallPath" "width" 115
  1451. nsNiuniuSkin::SetControlAttribute $hInstallDlg "configInstallPathTip" "width" 310
  1452. nsNiuniuSkin::SetControlAttribute $hInstallDlg "configInstallPathTip" "font" 11
  1453. ${ElseIf} $LANGUAGE == '1041'
  1454. nsNiuniuSkin::SetControlAttribute $hInstallDlg "configInstallPath" "width" 100
  1455. nsNiuniuSkin::SetControlAttribute $hInstallDlg "configInstallPathTip" "font" 5
  1456. nsNiuniuSkin::SetControlAttribute $hInstallDlg "chkAgree" "width" 190
  1457. ${ElseIf} $LANGUAGE == '1042'
  1458. nsNiuniuSkin::SetControlAttribute $hInstallDlg "configInstallPath" "width" 70
  1459. nsNiuniuSkin::SetControlAttribute $hInstallDlg "configInstallPathTip" "font" 5
  1460. ${ElseIf} $LANGUAGE == '2052'
  1461. nsNiuniuSkin::SetControlAttribute $hInstallDlg "configInstallPath" "width" 60
  1462. nsNiuniuSkin::SetControlAttribute $hInstallDlg "configInstallPathTip" "font" 5
  1463. ${EndIf}
  1464. nsNiuniuSkin::SetControlAttribute $hInstallDlg "configInstallPathTip" "text" $(CONFIG_INSTALL_PATH_TIP)
  1465. nsNiuniuSkin::SetControlAttribute $hInstallDlg "configUseSpace" "text" $(CONFIG_USE_SPACE)
  1466. nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnAgreement" "text" $(CONFIG_BTN_AGREEMENT)
  1467. nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnInstall" "text" $(CONFIG_BTN_INSTALL)
  1468. FunctionEnd
  1469. Function initLicensePage
  1470. nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnAgree" "text" $(LICENSE_BTN_AGREE)
  1471. FunctionEnd
  1472. Function initInstallingPage
  1473. nsNiuniuSkin::SetControlAttribute $hInstallDlg "InstallingTitle" "bkimage" $(INSTALLING_TITLE)
  1474. FunctionEnd
  1475. Function initFinishPage
  1476. nsNiuniuSkin::SetControlAttribute $hInstallDlg "FinishPageTitle" "bkimage" $(FINISH_PAGE_TITLE)
  1477. nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnRun" "text" $(BTN_RUN)
  1478. FunctionEnd
  1479. Function un.initUnInstallPage
  1480. nsNiuniuSkin::SetControlAttribute $hInstallDlg "unInstallTitle" "bkimage" $(UN_INSTALL_TITLE)
  1481. nsNiuniuSkin::SetControlAttribute $hInstallDlg "unInstallPrompt" "text" $(UN_INSTALL_PROMPT)
  1482. nsNiuniuSkin::SetControlAttribute $hInstallDlg "chkbox_userdata" "text" $(UN_INSTALL_CHKBOX_USERDATA)
  1483. nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnUnInstall" "text" $(BTN_CONFIRM)
  1484. nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnUnClose" "text" $(BTN_CANCEL)
  1485. FunctionEnd
  1486. Function un.initUninstallingPage
  1487. nsNiuniuSkin::SetControlAttribute $hInstallDlg "unInstallingTitle" "bkimage" $(UN_INSTALL_TITLE)
  1488. FunctionEnd
  1489. Function un.initUninstallFinishPage
  1490. nsNiuniuSkin::SetControlAttribute $hInstallDlg "unInstallFinishTitle" "bkimage" $(UN_INSTALL_TITLE)
  1491. nsNiuniuSkin::SetControlAttribute $hInstallDlg "unInstallFinishPrompt" "text" $(UN_INSTALL_FINISH_PROMPT)
  1492. nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnUninstalled" "text" $(BTN_UNINSTALLED)
  1493. nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnUninstalledReboot" "text" $(BTN_UNINSTALLED_REBOOT)
  1494. FunctionEnd