Statistics
| Revision:

root / trunk / install / launcher / izpack-launcher-1.3 / src / launcher.h @ 11445

History | View | Annotate | Download (4.34 KB)

1
/* Copyright (c) 2004 Julien Ponge - All rights reserved.
2
 *
3
 * Permission is hereby granted, free of charge, to any person obtaining a copy
4
 * of this software and associated documentation files (the "Software"), to
5
 * deal in the Software without restriction, including without limitation the
6
 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
7
 * sell copies of the Software, and to permit persons to whom the Software is
8
 * furnished to do so, subject to the following conditions:
9
 *
10
 * The above copyright notice and this permission notice shall be included in
11
 * all copies or substantial portions of the Software.
12
 *
13
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
18
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
19
 * IN THE SOFTWARE.
20
 */
21

    
22
#ifndef LAUNCHER_H
23
#define LAUNCHER_H
24

    
25
#include <wx/wx.h>
26
#include <wx/config.h>
27
#include <wx/confbase.h>
28
#include <wx/fileconf.h>
29
#include <wx/wfstream.h>
30

    
31
#ifdef __WINDOWS__
32
  #include <wx/msw/registry.h>
33
#else
34
  #include <stdlib.h>
35
  #include <map>
36
  #include <list>
37
#endif
38

    
39

    
40

    
41
#include "failuredialog.h"
42
#include "statusdialog.h"
43

    
44
class LauncherApp : public wxApp
45
{
46
private:
47

    
48
  wxString APPLICATION_NAME;
49
  wxString paramsApplicationName;
50

    
51
  wxFileName exeFileName; 
52
  wxFileName exePath;
53
  
54
  wxString javaHome;
55
  wxString javaExecPath;
56
// std::map<wxString, wxString> params;
57
  wxString paramsJar;
58
  wxString paramsCommand;  
59
  bool paramsLaunchJarAsync;
60
  bool paramsAskForCheckingProcess;
61
  wxString paramsJre;
62
  wxString paramsJreDownload;
63
  bool paramsCheckJai;
64
  wxString paramsJai;
65
  wxString paramsJaiDownload;
66
  bool paramsCheckJaiIo;
67
  wxString paramsJaiIo;
68
  wxString paramsJaiIoDownload;
69
  bool paramsEnabledDownload;
70
  bool paramsDoChecks;
71
  bool paramsChecksJREExecutionTerminationCode;
72
  wxString paramsJreHome;
73
  StatusDialog* statusDialog;
74
  bool isStatusDialogVisible;
75
  wxTimer* myTimer;
76

    
77
  wxArrayString variables;
78
  wxArrayString variablesValues;
79

    
80
  wxArrayString environVariables;
81
  wxArrayString environVariablesValues;
82

    
83
  wxString paramsLaunchMode;
84
  
85
  wxString paramsJreVersion;
86
  wxString paramsJreVersionPrefered;
87

    
88
  wxString localVersionToUse;
89

    
90

    
91
  wxLocale locale;
92

    
93
  bool completed;
94

    
95
  wxString cfgName;
96

    
97
  void loadParams();
98

    
99
  void error(const wxString &msg);
100

    
101
  bool searchJRE();
102

    
103
  void runJRE();
104

    
105
  void manualLaunch();
106

    
107
  void jreInstall();
108

    
109
  void netDownload();
110

    
111
  void echo(const wxString &msg);
112
  
113
  void confirm(const wxString &msg);
114

    
115
  bool confirmYesNoCancel(const wxString &msg,const int yesDefault);
116
  
117
  void notifyToUser(const wxString &msg);
118
  
119
  bool compareVersions(const wxString localVersion, const wxString requireVersion);
120

    
121
  void jaiInstall();
122

    
123
  bool checkVersion(const wxString msg);
124
  
125
  void jaiIoInstall();
126

    
127
  bool checksJaiIo();
128
  
129
  bool checksJai();
130
  
131
  void fixSystemJREConfig();
132
  
133
  bool downloadFileHttp(const wxString urlOfFile, const wxString filePath, const wxString msg);
134

    
135
  bool copyFile(const wxString urlOfFile, const wxString filePath, const wxString msg);
136
  
137
  bool checkInstallerFile(const wxString filePath, const wxString urlDownload, const wxString fileDescription);
138
  
139
  void showStatusMsg(const wxString msg);
140
  
141
  void run();
142
  
143
  void calculateJavaExePath(const wxString aJavaHome);
144

    
145
  wxString parseCommand();
146

    
147
  wxString parseString(const wxString theString);
148

    
149
  wxString parseEnviron(const wxString theString);
150

    
151
  bool copyRequiredFiles();
152

    
153

    
154
  wxString readPathFromINI(wxString section, wxString key, const wxString defaultValue);
155

    
156
  wxString readPathFromINI(wxString key, const wxString defaultValue);
157

    
158
  wxString readFromINI(wxString section, wxString key, const wxString defaultValue);
159

    
160
  wxString readFromINI(wxString key, const wxString defaultValue);
161

    
162
  wxArrayString sectionKeysFromINI(const wxString section);
163

    
164
  wxArrayString sectionKeysValuesFromINI(const wxString section,wxArrayString keys);
165

    
166
  void showStatusWindow();
167

    
168

    
169
 
170
public:
171

    
172
  LauncherApp();
173

    
174
  virtual ~LauncherApp();
175

    
176
  virtual bool OnInit();
177
  
178
  virtual void OnTimer(wxTimerEvent& event);
179

    
180
protected:
181
   DECLARE_EVENT_TABLE()
182

    
183
};
184

    
185
#endif