-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathInnoSetup.iss
138 lines (126 loc) · 9.54 KB
/
InnoSetup.iss
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
[Setup]
AppId={{863670cf-a7a6-4314-9479-c99e1c6fce06}
AppName=ThunderFocus
AppVersion=2.7.1
AppVerName=ThunderFocus v2.7.1
AppPublisher=marcocipriani01
AppPublisherURL=https://marcocipriani01.github.io/
AppSupportURL=https://marcocipriani01.github.io/
AppUpdatesURL=https://marcocipriani01.github.io/
DefaultDirName={autopf}\ThunderFocus
DisableDirPage=yes
DefaultGroupName=ThunderFocus
DisableProgramGroupPage=yes
DisableReadyPage=yes
LicenseFile=.\INSTALLATION_NOTICE.txt
Compression=lzma
SolidCompression=yes
WizardStyle=modern
OutputBaseFilename=ThunderFocus_Win_64bit
OutputDir=Installers
WizardImageFile=".\WizardImage.bmp"
SetupIconFile=".\ASCOM.ThunderFocus\Resources\icon.ico"
UninstallDisplayIcon=".\ASCOM.ThunderFocus\Resources\icon.ico"
ChangesAssociations = yes
[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
Name: "italian"; MessagesFile: "compiler:Languages\Italian.isl"
[Dirs]
Name: "{app}"
[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
[Files]
Source: ".\JRE-bundle\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
Source: ".\ASCOM.ThunderFocus\ASCOM.ThunderFocus.Focuser\bin\Release\*"; DestDir: "{commoncf}\ASCOM\Focuser\ASCOM.ThunderFocus.Focuser\"; Flags: ignoreversion recursesubdirs createallsubdirs
Source: ".\ASCOM.ThunderFocus\ASCOM.ThunderFocus.CoverCalibrator\bin\Release\*"; DestDir: "{commoncf}\ASCOM\CoverCalibrator\ASCOM.ThunderFocus.CoverCalibrator\"; Flags: ignoreversion recursesubdirs createallsubdirs
Source: ".\ASCOM.ThunderFocus\ASCOM.ThunderFocus.Switch\bin\Release\*"; DestDir: "{commoncf}\ASCOM\Switch\ASCOM.ThunderFocus.Switch\"; Flags: ignoreversion recursesubdirs createallsubdirs
[Icons]
Name: "{group}\ThunderFocus"; Filename: "{app}\bin\javaw.exe"; IconFilename: "{app}\icon.ico"; Parameters: "-jar ""{app}\ThunderFocus.jar"""
Name: "{group}\ThunderFocus debug"; Filename: "{app}\bin\java.exe"; IconFilename: "{app}\debug.ico"; Parameters: "-jar ""{app}\ThunderFocus.jar"""
Name: "{group}\{cm:UninstallProgram,ThunderFocus}"; IconFilename: "{app}\uninstall.ico"; Filename: "{uninstallexe}"
Name: "{autodesktop}\ThunderFocus"; Filename: "{app}\bin\javaw.exe"; Tasks: desktopicon; IconFilename: "{app}\icon.ico"; Parameters: "-jar ""{app}\ThunderFocus.jar"""
[Run]
Filename: "{dotnet4032}\RegAsm.exe"; Parameters: "/codebase ""{commoncf}\ASCOM\Focuser\ASCOM.ThunderFocus.Focuser\ASCOM.ThunderFocus.Focuser.dll"""; Flags: runhidden 32bit
Filename: "{dotnet4064}\RegAsm.exe"; Parameters: "/codebase ""{commoncf}\ASCOM\Focuser\ASCOM.ThunderFocus.Focuser\ASCOM.ThunderFocus.Focuser.dll"""; Flags: runhidden 64bit; Check: IsWin64
Filename: "{dotnet4032}\RegAsm.exe"; Parameters: "/codebase ""{commoncf}\ASCOM\CoverCalibrator\ASCOM.ThunderFocus.CoverCalibrator\ASCOM.ThunderFocus.CoverCalibrator.dll"""; Flags: runhidden 32bit
Filename: "{dotnet4064}\RegAsm.exe"; Parameters: "/codebase ""{commoncf}\ASCOM\CoverCalibrator\ASCOM.ThunderFocus.CoverCalibrator\ASCOM.ThunderFocus.CoverCalibrator.dll"""; Flags: runhidden 64bit; Check: IsWin64
Filename: "{dotnet4032}\RegAsm.exe"; Parameters: "/codebase ""{commoncf}\ASCOM\Switch\ASCOM.ThunderFocus.Switch\ASCOM.ThunderFocus.Switch.dll"""; Flags: runhidden 32bit
Filename: "{dotnet4064}\RegAsm.exe"; Parameters: "/codebase ""{commoncf}\ASCOM\Switch\ASCOM.ThunderFocus.Switch\ASCOM.ThunderFocus.Switch.dll"""; Flags: runhidden 64bit; Check: IsWin64
Filename: "{dotnet4032}\RegAsm.exe"; Parameters: "/codebase ""{commoncf}\ASCOM\ObservingConditions\ASCOM.ThunderFocus.ObservingConditions\ASCOM.ThunderFocus.ObservingConditions.dll"""; Flags: runhidden 32bit
Filename: "{dotnet4064}\RegAsm.exe"; Parameters: "/codebase ""{commoncf}\ASCOM\ObservingConditions\ASCOM.ThunderFocus.ObservingConditions\ASCOM.ThunderFocus.ObservingConditions.dll"""; Flags: runhidden 64bit; Check: IsWin64
Filename: "{app}\bin\javaw.exe"; Parameters: "-jar ""{app}\ThunderFocus.jar"""; Description: "{cm:LaunchProgram,ThunderFocus}"; Flags: nowait postinstall skipifsilent
[UninstallRun]
Filename: "{dotnet4032}\regasm.exe"; Parameters: "-u ""{commoncf}\ASCOM\Focuser\ASCOM.ThunderFocus.Focuser.dll"""; Flags: runhidden 32bit; RunOnceId: "RemoveDDL1"
Filename: "{dotnet4064}\regasm.exe"; Parameters: "/codebase ""{commoncf}\ASCOM\Focuser\ASCOM.ThunderFocus.Focuser.dll"""; Flags: runhidden 64bit; Check: IsWin64; RunOnceId: "RemoveDDL2"
Filename: "{dotnet4064}\regasm.exe"; Parameters: "-u ""{commoncf}\ASCOM\Focuser\ASCOM.ThunderFocus.Focuser.dll"""; Flags: runhidden 64bit; Check: IsWin64; RunOnceId: "RemoveDDL3"
Filename: "{dotnet4032}\regasm.exe"; Parameters: "-u ""{commoncf}\ASCOM\CoverCalibrator\ASCOM.ThunderFocus.CoverCalibrator.dll"""; Flags: runhidden 32bit; RunOnceId: "RemoveDDL4"
Filename: "{dotnet4064}\regasm.exe"; Parameters: "/codebase ""{commoncf}\ASCOM\CoverCalibrator\ASCOM.ThunderFocus.CoverCalibrator.dll"""; Flags: runhidden 64bit; Check: IsWin64; RunOnceId: "RemoveDDL5"
Filename: "{dotnet4064}\regasm.exe"; Parameters: "-u ""{commoncf}\ASCOM\CoverCalibrator\ASCOM.ThunderFocus.CoverCalibrator.dll"""; Flags: runhidden 64bit; Check: IsWin64; RunOnceId: "RemoveDDL6"
Filename: "{dotnet4032}\regasm.exe"; Parameters: "-u ""{commoncf}\ASCOM\Switch\ASCOM.ThunderFocus.Switch.dll"""; Flags: runhidden 32bit; RunOnceId: "RemoveDDL7"
Filename: "{dotnet4064}\regasm.exe"; Parameters: "/codebase ""{commoncf}\ASCOM\Switch\ASCOM.ThunderFocus.Switch.dll"""; Flags: runhidden 64bit; Check: IsWin64; RunOnceId: "RemoveDDL8"
Filename: "{dotnet4064}\regasm.exe"; Parameters: "-u ""{commoncf}\ASCOM\Switch\ASCOM.ThunderFocus.Switch.dll"""; Flags: runhidden 64bit; Check: IsWin64; RunOnceId: "RemoveDDL9"
Filename: "{dotnet4032}\regasm.exe"; Parameters: "-u ""{commoncf}\ASCOM\ObservingConditions\ASCOM.ThunderFocus.ObservingConditions.dll"""; Flags: runhidden 32bit; RunOnceId: "RemoveDDL10"
Filename: "{dotnet4064}\regasm.exe"; Parameters: "/codebase ""{commoncf}\ASCOM\ObservingConditions\ASCOM.ThunderFocus.ObservingConditions.dll"""; Flags: runhidden 64bit; Check: IsWin64; RunOnceId: "RemoveDDL11"
Filename: "{dotnet4064}\regasm.exe"; Parameters: "-u ""{commoncf}\ASCOM\ObservingConditions\ASCOM.ThunderFocus.ObservingConditions.dll"""; Flags: runhidden 64bit; Check: IsWin64; RunOnceId: "RemoveDDL12"
[Registry]
Root: HKCR; Subkey: ".thunder"; ValueData: "ThunderFocus"; Flags: uninsdeletevalue; ValueType: string; ValueName: ""
Root: HKCR; Subkey: "ThunderFocus"; ValueData: "ThunderFocus config file"; Flags: uninsdeletekey; ValueType: string; ValueName: ""
Root: HKCR; Subkey: "ThunderFocus\DefaultIcon"; ValueData: "{app}\icon.ico"; ValueType: string; ValueName: ""
Root: HKCR; Subkey: "ThunderFocus\shell\open\command"; ValueData: """{app}\bin\javaw.exe"" ""-jar"" ""{app}\ThunderFocus.jar"" ""%1"""; ValueType: string; ValueName: ""
[Code]
const
REQUIRED_PLATFORM_VERSION = 6.5; // Set this to the minimum required ASCOM Platform version for this application
//
// Function to return the ASCOM Platform's version number as a double.
//
function PlatformVersion(): Double;
var
PlatVerString : String;
begin
Result := 0.0; // Initialise the return value in case we can't read the registry
try
if RegQueryStringValue(HKEY_LOCAL_MACHINE_32, 'Software\ASCOM','PlatformVersion', PlatVerString) then
begin // Successfully read the value from the registry
Result := StrToFloat(PlatVerString); // Create a double from the X.Y Platform version string
end;
except
ShowExceptionMessage;
Result:= -1.0; // Indicate in the return value that an exception was generated
end;
end;
//
// Before the installer UI appears, verify that the required ASCOM Platform version is installed.
//
function InitializeSetup(): Boolean;
var
PlatformVersionNumber : double;
begin
Result := FALSE; // Assume failure
PlatformVersionNumber := PlatformVersion(); // Get the installed Platform version as a double
If PlatformVersionNumber >= REQUIRED_PLATFORM_VERSION then // Check whether we have the minimum required Platform or newer
Result := TRUE
else
if PlatformVersionNumber = 0.0 then
MsgBox('No ASCOM Platform is installed. Please install Platform ' + Format('%3.1f', [REQUIRED_PLATFORM_VERSION]) + ' or later from https://www.ascom-standards.org', mbCriticalError, MB_OK)
else
MsgBox('ASCOM Platform ' + Format('%3.1f', [REQUIRED_PLATFORM_VERSION]) + ' or later is required, but Platform '+ Format('%3.1f', [PlatformVersionNumber]) + ' is installed. Please install the latest Platform before continuing; you will find it at https://www.ascom-standards.org', mbCriticalError, MB_OK);
end;
// Code to enable the installer to uninstall previous versions of itself when a new version is installed
procedure CurStepChanged(CurStep: TSetupStep);
var
ResultCode: Integer;
UninstallExe: String;
UninstallRegistry: String;
begin
if (CurStep = ssInstall) then // Install step has started
begin
// Create the correct registry location name, which is based on the AppId
UninstallRegistry := ExpandConstant('Software\Microsoft\Windows\CurrentVersion\Uninstall\{#SetupSetting("AppId")}' + '_is1');
// Check whether an extry exists
if RegQueryStringValue(HKLM, UninstallRegistry, 'UninstallString', UninstallExe) then
begin // Entry exists and previous version is installed so run its uninstaller quietly after informing the user
Exec(RemoveQuotes(UninstallExe), ' /SILENT', '', SW_SHOWNORMAL, ewWaitUntilTerminated, ResultCode);
sleep(1000); //Give enough time for the install screen to be repainted before continuing
end
end;
end;