|
@@ -0,0 +1,165 @@
|
|
1
|
+; 脚本由 Inno Setup 脚本向导 生成!
|
|
2
|
+; 有关创建 Inno Setup 脚本文件的详细资料请查阅帮助文档!
|
|
3
|
+
|
|
4
|
+#define MyAppName "星火微课"
|
|
5
|
+#define MyAppDir "xhwk"
|
|
6
|
+#define MyAppVersion "2.7.1"
|
|
7
|
+#define MyAppPublisher "河南星火燎原软件科技有限公司"
|
|
8
|
+#define MyAppURL "http://www.xhkjedu.com/"
|
|
9
|
+#define MySourcePath "D:\Project\C#\xhwkclient\XHWK.WKTool\bin\x86\Debug\"
|
|
10
|
+#define MyAppExeName "星火微课.exe"
|
|
11
|
+#define MyIcoName "256.ico"
|
|
12
|
+#define MyTargetPath "D:\程序打包\星火微课-测试\"
|
|
13
|
+
|
|
14
|
+[Setup]
|
|
15
|
+; 注: AppId的值为单独标识该应用程序。
|
|
16
|
+; 不要为其他安装程序使用相同的AppId值。
|
|
17
|
+; (若要生成新的 GUID,可在菜单中点击 "工具|生成 GUID"。)
|
|
18
|
+AppId={{5869900A-3BE4-463E-B0A6-462AA7454AE2}
|
|
19
|
+AppName={#MyAppName}
|
|
20
|
+AppVersion={#MyAppVersion}
|
|
21
|
+;AppVerName={#MyAppName} {#MyAppVersion}
|
|
22
|
+AppPublisher={#MyAppPublisher}
|
|
23
|
+AppPublisherURL={#MyAppURL}
|
|
24
|
+AppSupportURL={#MyAppURL}
|
|
25
|
+AppUpdatesURL={#MyAppURL}
|
|
26
|
+DefaultDirName={autopf}\{#MyAppDir}
|
|
27
|
+DisableProgramGroupPage=yes
|
|
28
|
+; [Icons] 的“quicklaunchicon”条目使用 {userappdata},而其 [Tasks] 条目具有适合 IsAdminInstallMode 的检查。
|
|
29
|
+UsedUserAreasWarning=no
|
|
30
|
+; 以下行取消注释,以在非管理安装模式下运行(仅为当前用户安装)。
|
|
31
|
+;PrivilegesRequired=lowest
|
|
32
|
+OutputDir={#MyTargetPath}
|
|
33
|
+OutputBaseFilename="{#MyAppName} v{#MyAppVersion}"
|
|
34
|
+SetupIconFile="{#MySourcePath}{#MyIcoName}"
|
|
35
|
+Compression=lzma
|
|
36
|
+SolidCompression=yes
|
|
37
|
+WizardStyle=modern
|
|
38
|
+
|
|
39
|
+[Languages]
|
|
40
|
+Name: "chinesesimp"; MessagesFile: "compiler:Default.isl"
|
|
41
|
+
|
|
42
|
+[Tasks]
|
|
43
|
+Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: checkablealone
|
|
44
|
+Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: checkablealone; OnlyBelowVersion: 6.1; Check: not IsAdminInstallMode
|
|
45
|
+
|
|
46
|
+[Files]
|
|
47
|
+Source: "{#MySourcePath}{#MyAppExeName}"; DestDir: "{app}"; Flags: ignoreversion
|
|
48
|
+Source: "{#MySourcePath}*"; Excludes: "ffmpeg.exe,\Log\*,\Temp,\Data";DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
|
|
49
|
+
|
|
50
|
+[Icons]
|
|
51
|
+Name: "{autoprograms}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
|
|
52
|
+Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon
|
|
53
|
+Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: quicklaunchicon
|
|
54
|
+
|
|
55
|
+[Run]
|
|
56
|
+Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent
|
|
57
|
+
|
|
58
|
+[Code]
|
|
59
|
+// Indicates whether the specified version and service pack of the .NET Framework is installed.
|
|
60
|
+//
|
|
61
|
+// version -- Specify one of these strings for the required .NET Framework version:
|
|
62
|
+// 'v1.1' .NET Framework 1.1
|
|
63
|
+// 'v2.0' .NET Framework 2.0
|
|
64
|
+// 'v3.0' .NET Framework 3.0
|
|
65
|
+// 'v3.5' .NET Framework 3.5
|
|
66
|
+// 'v4\Client' .NET Framework 4.0 Client Profile
|
|
67
|
+// 'v4\Full' .NET Framework 4.0 Full Installation
|
|
68
|
+// 'v4.5' .NET Framework 4.5
|
|
69
|
+// 'v4.5.1' .NET Framework 4.5.1
|
|
70
|
+// 'v4.5.2' .NET Framework 4.5.2
|
|
71
|
+// 'v4.6' .NET Framework 4.6
|
|
72
|
+// 'v4.6.1' .NET Framework 4.6.1
|
|
73
|
+// 'v4.6.2' .NET Framework 4.6.2
|
|
74
|
+// 'v4.7' .NET Framework 4.7
|
|
75
|
+// 'v4.7.1' .NET Framework 4.7.1
|
|
76
|
+// 'v4.7.2' .NET Framework 4.7.2
|
|
77
|
+// 'v4.8' .NET Framework 4.8
|
|
78
|
+//
|
|
79
|
+// service -- Specify any non-negative integer for the required service pack level:
|
|
80
|
+// 0 No service packs required
|
|
81
|
+// 1, 2, etc. Service pack 1, 2, etc. required
|
|
82
|
+function IsDotNetDetected(version: string; service: cardinal): boolean;
|
|
83
|
+var
|
|
84
|
+ key, versionKey: string;
|
|
85
|
+ install, release, serviceCount, versionRelease: cardinal;
|
|
86
|
+ success: boolean;
|
|
87
|
+begin
|
|
88
|
+ versionKey := version;
|
|
89
|
+ versionRelease := 0;
|
|
90
|
+
|
|
91
|
+ // .NET 1.1 and 2.0 embed release number in version key
|
|
92
|
+ if version = 'v1.1' then begin
|
|
93
|
+ versionKey := 'v1.1.4322';
|
|
94
|
+ end
|
|
95
|
+ else if version = 'v2.0' then begin
|
|
96
|
+ versionKey := 'v2.0.50727';
|
|
97
|
+ end
|
|
98
|
+
|
|
99
|
+ // .NET 4.5 and newer install as update to .NET 4.0 Full
|
|
100
|
+ else if Pos('v4.', version) = 1 then begin
|
|
101
|
+ versionKey := 'v4\Full';
|
|
102
|
+ case version of
|
|
103
|
+ 'v4.5': versionRelease := 378389;
|
|
104
|
+ 'v4.5.1': versionRelease := 378675; // 378758 on Windows 8 and older
|
|
105
|
+ 'v4.5.2': versionRelease := 379893;
|
|
106
|
+ 'v4.6': versionRelease := 393295; // 393297 on Windows 8.1 and older
|
|
107
|
+ 'v4.6.1': versionRelease := 394254; // 394271 on Windows 8.1 and older
|
|
108
|
+ 'v4.6.2': versionRelease := 394802; // 394806 on Windows 8.1 and older
|
|
109
|
+ 'v4.7': versionRelease := 460798; // Windows 10
|
|
110
|
+ 'v4.7.1': versionRelease := 461308; // Windows 10
|
|
111
|
+ 'v4.7.2': versionRelease := 461808; // Windows 10
|
|
112
|
+ 'v4.8' : versionRelease := 528040; // Windows 10
|
|
113
|
+ end;
|
|
114
|
+ end;
|
|
115
|
+
|
|
116
|
+ // installation key group for all .NET versions
|
|
117
|
+ key := 'SOFTWARE\Microsoft\NET Framework Setup\NDP\' + versionKey;
|
|
118
|
+
|
|
119
|
+ // .NET 3.0 uses value InstallSuccess in subkey Setup
|
|
120
|
+ if Pos('v3.0', version) = 1 then begin
|
|
121
|
+ success := RegQueryDWordValue(HKLM, key + '\Setup', 'InstallSuccess', install);
|
|
122
|
+ end else begin
|
|
123
|
+ success := RegQueryDWordValue(HKLM, key, 'Install', install);
|
|
124
|
+ end;
|
|
125
|
+
|
|
126
|
+ // .NET 4.0 and newer use value Servicing instead of SP
|
|
127
|
+ if Pos('v4', version) = 1 then begin
|
|
128
|
+ success := success and RegQueryDWordValue(HKLM, key, 'Servicing', serviceCount);
|
|
129
|
+ end else begin
|
|
130
|
+ success := success and RegQueryDWordValue(HKLM, key, 'SP', serviceCount);
|
|
131
|
+ end;
|
|
132
|
+
|
|
133
|
+ // .NET 4.5 and newer use additional value Release
|
|
134
|
+ if versionRelease > 0 then begin
|
|
135
|
+ success := success and RegQueryDWordValue(HKLM, key, 'Release', release);
|
|
136
|
+ success := success and (release >= versionRelease);
|
|
137
|
+ end;
|
|
138
|
+
|
|
139
|
+ result := success and (install = 1) and (serviceCount >= service);
|
|
140
|
+end;
|
|
141
|
+
|
|
142
|
+function InitializeSetup: Boolean;
|
|
143
|
+var Path:string;
|
|
144
|
+ ResultCode: Integer;
|
|
145
|
+begin
|
|
146
|
+ if IsDotNetDetected('v4.5.2', 0) then
|
|
147
|
+ begin
|
|
148
|
+ Result := true;
|
|
149
|
+ end
|
|
150
|
+ else
|
|
151
|
+ begin
|
|
152
|
+ if MsgBox('系统检测到您没有安装.Net Framework4.5.2,是否立刻下载并安装?', mbConfirmation, MB_YESNO) = idYes then
|
|
153
|
+ begin
|
|
154
|
+ Path := ExpandConstant('{pf}/Internet Explorer/iexplore.exe');
|
|
155
|
+ Exec(Path, 'https://xhkjedu.oss-cn-huhehaote.aliyuncs.com/runtime/NDP452-KB2901907-x86-x64-AllOS-ENU.exe', '', SW_SHOWNORMAL, ewWaitUntilTerminated, ResultCode);
|
|
156
|
+ MsgBox('请安装好.Net Framework环境后,再运行本安装包程序!',mbInformation,MB_OK);
|
|
157
|
+ Result := false;
|
|
158
|
+ end
|
|
159
|
+ else
|
|
160
|
+ begin
|
|
161
|
+ MsgBox('没有安装.Net Framework环境,无法运行程序,本安装程序即将退出!',mbInformation,MB_OK);
|
|
162
|
+ Result := false;
|
|
163
|
+ end;
|
|
164
|
+ end;
|
|
165
|
+end;
|