星火微课系统客户端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

星火微课-正式.iss 5.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. ; 脚本由 Inno Setup 脚本向导 生成!
  2. ; 有关创建 Inno Setup 脚本文件的详细资料请查阅帮助文档!
  3. #define MyAppName "星火微课"
  4. #define MyAppDir "xhwk"
  5. #define MyAppVersion "3.9.8"
  6. #define MyAppPublisher "河南星火燎原软件科技有限公司"
  7. #define MyAppURL "http://www.xhkjedu.com/"
  8. #define MySourcePath "D:\Project\CSharp\xh-wkclient\XHWK.WKTool\bin\x86\Debug\"
  9. #define MyAppExeName "星火微课.exe"
  10. #define MyIcoName "256.ico"
  11. #define MyTargetPath "D:\程序打包\星火微课-正式\"
  12. [Setup]
  13. ; 注: AppId的值为单独标识该应用程序。
  14. ; 不要为其他安装程序使用相同的AppId值。
  15. ; (若要生成新的 GUID,可在菜单中点击 "工具|生成 GUID"。)
  16. AppId={{5869900A-3BE4-463E-B0A6-462AA7454AE2}
  17. AppName={#MyAppName}
  18. AppVersion={#MyAppVersion}
  19. AppPublisher={#MyAppPublisher}
  20. AppPublisherURL={#MyAppURL}
  21. AppSupportURL={#MyAppURL}
  22. AppUpdatesURL={#MyAppURL}
  23. DefaultDirName={autopf}\{#MyAppDir}
  24. DisableProgramGroupPage=yes
  25. ; [Icons] 的“quicklaunchicon”条目使用 {userappdata},而其 [Tasks] 条目具有适合 IsAdminInstallMode 的检查。
  26. UsedUserAreasWarning=no
  27. ; 以下行取消注释,以在非管理安装模式下运行(仅为当前用户安装)。
  28. ;PrivilegesRequired=lowest
  29. OutputDir={#MyTargetPath}
  30. OutputBaseFilename="{#MyAppName} v{#MyAppVersion}"
  31. SetupIconFile="{#MySourcePath}{#MyIcoName}"
  32. Compression=lzma
  33. SolidCompression=yes
  34. WizardStyle=modern
  35. [Languages]
  36. Name: "chinesesimp"; MessagesFile: "compiler:Default.isl"
  37. [Tasks]
  38. Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: checkablealone
  39. Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: checkablealone; OnlyBelowVersion: 6.1; Check: not IsAdminInstallMode
  40. [Files]
  41. Source: "D:\Tools\runtime\vc_redist.x86.exe"; DestDir: "{app}\runtime"; Check: NeedInstallVC
  42. Source: "D:\Tools\runtime\NDP452-KB2901954-Web.exe"; DestDir: "{app}\runtime";
  43. Source: "{#MySourcePath}{#MyAppExeName}"; DestDir: "{app}"; Flags: ignoreversion
  44. Source: "{#MySourcePath}*"; Excludes: "\Log\*,\Temp,\Data";DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
  45. [Icons]
  46. Name: "{autoprograms}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
  47. Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon
  48. Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: quicklaunchicon
  49. [Run]
  50. Filename: "{app}\runtime\vc_redist.x86.exe"; Parameters: /q; WorkingDir: {app}; Flags: skipifdoesntexist; StatusMsg: "Install Microsoft Visual C++ Runtime ..."; Check: NeedInstallVC
  51. Filename: "{app}\runtime\NDP452-KB2901954-Web.exe"; WorkingDir: {app}; Flags: skipifdoesntexist; StatusMsg: "Install .Net Framework ..."; Check: NeedInstallDotNet
  52. Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent
  53. [Code]
  54. function NeedInstallVC(): Boolean;
  55. begin
  56. // 这里,不同版本运行环境对应的GUID不同
  57. if RegValueExists(HKLM, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{01FAEC41-B3BC-44F4-B185-5E8475AEB855}', 'Version')
  58. or RegValueExists(HKLM, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{77EB1EA9-8E1B-459D-8CDC-1984D0FF15B6}', 'Version')
  59. or RegValueExists(HKLM, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{5720EC03-F26F-40B7-980C-50B5D420B5DE}', 'Version')
  60. then
  61. begin
  62. Result := false;
  63. end
  64. else
  65. begin
  66. Result := true;
  67. end;
  68. Result := true;
  69. end;
  70. function IsInstallDotNet(version: string; service: cardinal): boolean;
  71. var
  72. key, versionKey: string;
  73. install, release, serviceCount, versionRelease: cardinal;
  74. success: boolean;
  75. begin
  76. versionKey := version;
  77. versionRelease := 0;
  78. // .NET 1.1 and 2.0 embed release number in version key
  79. if version = 'v1.1' then begin
  80. versionKey := 'v1.1.4322';
  81. end
  82. else if version = 'v2.0' then begin
  83. versionKey := 'v2.0.50727';
  84. end
  85. // .NET 4.5 and newer install as update to .NET 4.0 Full
  86. else if Pos('v4.', version) = 1 then begin
  87. versionKey := 'v4\Full';
  88. case version of
  89. 'v4.5': versionRelease := 378389;
  90. 'v4.5.1': versionRelease := 378675; // 378758 on Windows 8 and older
  91. 'v4.5.2': versionRelease := 379893;
  92. 'v4.6': versionRelease := 393295; // 393297 on Windows 8.1 and older
  93. 'v4.6.1': versionRelease := 394254; // 394271 on Windows 8.1 and older
  94. 'v4.6.2': versionRelease := 394802; // 394806 on Windows 8.1 and older
  95. 'v4.7': versionRelease := 460798; // Windows 10
  96. 'v4.7.1': versionRelease := 461308; // Windows 10
  97. 'v4.7.2': versionRelease := 461808; // Windows 10
  98. 'v4.8' : versionRelease := 528040; // Windows 10
  99. end;
  100. end;
  101. // installation key group for all .NET versions
  102. key := 'SOFTWARE\Microsoft\NET Framework Setup\NDP\' + versionKey;
  103. // .NET 3.0 uses value InstallSuccess in subkey Setup
  104. if Pos('v3.0', version) = 1 then begin
  105. success := RegQueryDWordValue(HKLM, key + '\Setup', 'InstallSuccess', install);
  106. end else begin
  107. success := RegQueryDWordValue(HKLM, key, 'Install', install);
  108. end;
  109. // .NET 4.0 and newer use value Servicing instead of SP
  110. if Pos('v4', version) = 1 then begin
  111. success := success and RegQueryDWordValue(HKLM, key, 'Servicing', serviceCount);
  112. end else begin
  113. success := success and RegQueryDWordValue(HKLM, key, 'SP', serviceCount);
  114. end;
  115. // .NET 4.5 and newer use additional value Release
  116. if versionRelease > 0 then begin
  117. success := success and RegQueryDWordValue(HKLM, key, 'Release', release);
  118. success := success and (release >= versionRelease);
  119. end;
  120. result := success and (install = 1) and (serviceCount >= service);
  121. end;
  122. // 检查.Net是否安装
  123. function NeedInstallDotNet : Boolean;
  124. begin
  125. if IsInstallDotNet('v4.5.2', 0) then
  126. begin
  127. Result := false;
  128. end
  129. else
  130. begin
  131. Result := true;
  132. end
  133. end;