-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPTS_SetupScriptFile.iss
162 lines (152 loc) · 7.08 KB
/
PTS_SetupScriptFile.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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
#define MyAppName "Pilot Training System"
#define MyAppVersion "0.1"
#define MyAppPublisher "Pilot Training System"
#define MyAppURL "http://www.pilottrainingsystem.com/"
#define MyAppExeName "ClimaDrive Editor.exe"
[Setup]
; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{FCBB6928-C5C1-4089-9291-AEFB3DF6D322}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={pf}\{#MyAppName}
DefaultGroupName={#MyAppName}
DisableProgramGroupPage=yes
OutputDir=C:\Users\PTS\Documents\Output\NewInstaller
OutputBaseFilename=PTS_setup
Compression=lzma
SolidCompression=yes
WizardImageFile=C:\Users\PTS\Documents\PTS_files\pics\InnoUISideBanner_PTS.bmp
WizardSmallImageFile=C:\Users\PTS\Documents\PTS_files\pics\InnoUITopBanner_PTS.bmp
[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked; OnlyBelowVersion: 0,6.1
[Files]
Source: "C:\Users\PTS\Documents\PTS_files\ClimaDrive Editor.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\PTS\Documents\PTS_files\ClimaDrive User's Manual.docx"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\PTS\Documents\PTS_files\fsd.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\PTS\Documents\PTS_files\MapViewer.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\PTS\Documents\PTS_files\MetarEditor.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\PTS\Documents\PTS_files\PTS EULA.pdf"; DestDir: "{app}"; Flags: ignoreversion
;after putting the pts_wxsc.dll in the program files folder, copy it to the flight simulator folders.PutDLLinFSAppPath can be found in the code section.
Source: "C:\Users\PTS\Documents\PTS_files\pts_wxsc.dll"; DestDir: "{app}"; Flags: ignoreversion; AfterInstall:PutDLLinFSAppPath
Source: "C:\Users\PTS\Documents\PTS_files\ptsf.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\PTS\Documents\PTS_files\README.TXT"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\PTS\Documents\PTS_files\data\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
[Icons]
Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
Name: "{group}\{cm:ProgramOnTheWeb,{#MyAppName}}"; Filename: "{#MyAppURL}"
Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}"
Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon
Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: quicklaunchicon
[Code]
var
fsxAppPath: String;
prepare3DPath: String;
prepare3DV2Path: String;
fsxExists: boolean;
p3dExists: boolean;
p3dv2Exists: boolean;
//function to put the pts_wxsc.dll into the flight simulator folders
procedure PutDLLinFSAppPath();
begin
if fsxExists then
begin
if not FileCopy(ExpandConstant('{app}\pts_wxsc.dll'),fsxAppPath,False) then begin
MsgBox('Could not copy pts_wxsc.dll to FSX folder',mbError,MB_OK);
end;
end;
if p3dExists then
begin
if not FileCopy(ExpandConstant('{app}\pts_wxsc.dll'),prepare3DPath,False) then begin
MsgBox('Could not copy pts_wxsc.dll to Prepar3D folder',mbError,MB_OK) ;
end;
end;
if p3dv2Exists then
begin
if not FileCopy(ExpandConstant('{app}\pts_wxsc.dll'),prepare3DV2Path,False)then begin
MsgBox('Could not copy pts_wxsc.dll to Prepar3D V2 folder',mbError,MB_OK) ;
end;
end;
end;
//Function to search for FSX AppPath in the registry and then check if fsx.exe is present in that directory
function SearchFSX:boolean;
var
apppath: String;
begin
result := RegQueryStringValue(HKEY_CURRENT_USER, 'SOFTWARE\Microsoft\Microsoft Games\Flight Simulator\10.0','AppPath', apppath);
fsxAppPath := apppath;
result := result and FileExists(apppath+'fsx.exe');
fsxExists := result;
end;
//Function to search for Prepar3D AppPath in the registry and then check if prepar3D.exe is present in that directory
function SearchPrepar3D:boolean;
var
apppath: String;
begin
result := RegQueryStringValue(HKEY_CURRENT_USER, 'SOFTWARE\LockheedMartin\Prepar3D','AppPath', apppath);
prepare3DPath := apppath;
result := result and FileExists(apppath+'prepar3D.exe');
p3dExists := result;
end;
//Function to search for Prepar3D V2 AppPath in the registry and then check if prepar3D.exe is present in that directory
function SearchPrepar3DV2:boolean;
var
apppath: String;
begin
result := RegQueryStringValue(HKEY_CURRENT_USER, 'SOFTWARE\Lockheed Martin\Prepar3D v2','AppPath', apppath);
prepare3DV2Path := apppath;
result := result and FileExists(apppath+'prepar3D.exe');
p3dv2Exists := result;
end;
//function to modify the dll.xml file in all the flight simulator temp data.
function ModifyDLLXML(XMLPath: String):boolean;
var
XMLDoc, RootNode, NewNode, NewNode1, NewNode2, NewNode3,NewNode4: Variant;
begin
XMLDoc := CreateOleObject('MSXML2.DOMDocument');
XMLDoc.async := False;
XMLDoc.resolveExternals := False;
XMLDoc.load(XMLPath);
if XMLDoc.parseError.errorCode <> 0 then
RaiseException('Error on line ' + IntToStr(XMLDoc.parseError.line) + ', position ' + IntToStr(XMLDoc.parseError.linepos) + ': ' + XMLDoc.parseError.reason);
NewNode := XMLDoc.createElement('Launch.Addon');
NewNode1 := XMLDoc.createElement('Name');
NewNode.appendChild(NewNode1);
NewNode.lastChild.text := 'Pilot Training System Weather Module';
NewNode2 := XMLDoc.createElement('Disabled');
NewNode.appendChild(NewNode2);
NewNode.lastChild.text := 'False';
NewNode3 := XMLDoc.createElement('ManualLoad');
NewNode.appendChild(NewNode3);
NewNode.lastChild.text := 'False';
NewNode4 := XMLDoc.createElement('Path');
NewNode.appendChild(NewNode3);
NewNode.lastChild.text := 'pts_wxsc.dll';
XMLDoc.setProperty('SelectionLanguage', 'XPath');
RootNode := XMLDoc.selectSingleNode('//SimBase.Document');
RootNode.appendChild (NewNode);
RootNode.lastChild.text := '<Name>Pilot Training System Weather Module</Name><Disabled>False</Disabled><ManualLoad>False</ManualLoad><Path>pts_wxsc.dll</Path>'
XMLDoc.Save(XMLPath);
end;
function InitializeSetup: boolean;
begin
result := SearchFSX or SearchPrepar3DV2 or SearchPrepar3D;
if result then begin
ModifyDLLXML(ExpandConstant('{userappdata}\Microsoft\FSX\dll.xml'));
MsgBox('Found the exe.'+prepare3DV2Path+ExpandConstant('{localappdata}')+' UserAppData '+ExpandConstant('{userappdata}'), mbInformation, MB_OK);
end;
//if result then
// ModifyDLLXML();
end;