Statistics
| Revision:

root / import / ext3D / trunk / install-extension3d / launcher / izpack-launcher-1.3 / src / launcher.h @ 15280

History | View | Annotate | Download (4.17 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
  wxString javaHome;
52
  wxString javaExecPath;
53
// std::map<wxString, wxString> params;
54
  wxString paramsJar;
55
  wxString paramsCommand;  
56
  bool paramsLaunchJarAsync;
57
  bool paramsAskForCheckingProcess;
58
  wxString paramsJre;
59
  wxString paramsJreDownload;
60
  bool paramsCheckJai;
61
  wxString paramsJai;
62
  wxString paramsJaiDownload;
63
  bool paramsCheckJaiIo;
64
  wxString paramsJaiIo;
65
  wxString paramsJaiIoDownload;
66
  bool paramsEnabledDownload;
67
  bool paramsDoChecks;
68
  bool paramsChecksJREExecutionTerminationCode;
69
  wxString paramsJreHome;
70
  StatusDialog* statusDialog;
71
  bool isStatusDialogVisible;
72
  wxTimer* myTimer;
73

    
74
  wxArrayString variables;
75
  wxArrayString variablesValues;
76

    
77
  wxString paramsLaunchMode;
78
  
79
  wxString paramsJreVersion;
80
  wxString paramsJreVersionPrefered;
81

    
82
  wxString localVersionToUse;
83

    
84

    
85
  wxLocale locale;
86

    
87
  bool completed;
88

    
89
  wxString cfgName;
90

    
91
  void loadParams();
92

    
93
  void error(const wxString &msg);
94

    
95
  bool searchJRE();
96

    
97
  void runJRE();
98

    
99
  void manualLaunch();
100

    
101
  void jreInstall();
102

    
103
  void netDownload();
104

    
105
  void echo(const wxString &msg);
106
  
107
  void confirm(const wxString &msg);
108

    
109
  bool confirmYesNoCancel(const wxString &msg,const int yesDefault);
110
  
111
  void notifyToUser(const wxString &msg);
112
  
113
  bool compareVersions(const wxString localVersion, const wxString requireVersion);
114

    
115
  void jaiInstall();
116

    
117
  bool checkVersion(const wxString msg);
118
  
119
  void jaiIoInstall();
120

    
121
  bool checksJaiIo();
122
  
123
  bool checksJai();
124
  
125
  void fixSystemJREConfig();
126
  
127
  bool downloadFileHttp(const wxString urlOfFile, const wxString filePath, const wxString msg);
128

    
129
  bool copyFile(const wxString urlOfFile, const wxString filePath, const wxString msg);
130
  
131
  bool checkInstallerFile(const wxString filePath, const wxString urlDownload, const wxString fileDescription);
132
  
133
  void showStatusMsg(const wxString msg);
134
  
135
  void run();
136
  
137
  void calculateJavaExePath(const wxString aJavaHome);
138

    
139
  wxString parseCommand();
140

    
141
  wxString parseString(const wxString theString);
142

    
143
  bool copyRequiredFiles();
144

    
145

    
146
  wxString readPathFromINI(wxString section, wxString key, const wxString defaultValue);
147

    
148
  wxString readPathFromINI(wxString key, const wxString defaultValue);
149

    
150
  wxString readFromINI(wxString section, wxString key, const wxString defaultValue);
151

    
152
  wxString readFromINI(wxString key, const wxString defaultValue);
153

    
154
  wxArrayString sectionKeysFromINI(const wxString section);
155

    
156
  wxArrayString sectionKeysValuesFromINI(const wxString section,wxArrayString keys);
157

    
158
  void showStatusWindow();
159

    
160

    
161
 
162
public:
163

    
164
  LauncherApp();
165

    
166
  virtual ~LauncherApp();
167

    
168
  virtual bool OnInit();
169
  
170
  virtual void OnTimer(wxTimerEvent& event);
171

    
172
protected:
173
   DECLARE_EVENT_TABLE()
174

    
175
};
176

    
177
#endif