}
}
try {
int result;
AEWin32Access accessor = AEWin32Manager.getAccessor(true);
if (accessor == null) {
result = -123;
} else {
if (azRunner != null) {
// create a batch file to run the updater, then to restart azureus
// bceause the updater would restart azureus as administrator user
// and confuse the user
fileRestart = FileUtil.getUserFile("restart.bat");
String s = "title Azureus Updater Runner\r\n";
s += exeUpdater + " \"updateonly\"";
for (int i = 1; i < parameters.length; i++) {
s += " \"" + parameters[i].replaceAll("\\\"", "") + "\"";
}
s += "\r\n";
s += "start \"\" \"" + azRunner + "\"";
byte[] bytes;
String encoding = FileUtil.getScriptCharsetEncoding();
if ( encoding == null ){
bytes = s.getBytes();
}else{
try{
bytes = s.getBytes( encoding );
}catch( Throwable e){
e.printStackTrace();
bytes = s.getBytes();
}
}
FileUtil.writeBytesAsFile(fileRestart.getAbsolutePath(),bytes);
result = accessor.shellExecute(null, fileRestart.getAbsolutePath(),
null, SystemProperties.getApplicationPath(),
AEWin32Access.SW_SHOWMINIMIZED);
} else {
String execEXE = "\"-J" + getClassPath().replaceAll("\\\"", "")
+ "\" ";
for (int i = 0; i < properties.length; i++) {
execEXE += "\"-J" + properties[i].replaceAll("\\\"", "") + "\" ";
}
for (int i = 0; i < parameters.length; i++) {
execEXE += " \"" + parameters[i].replaceAll("\\\"", "") + "\"";
}
log.println("Launch via " + exeUpdater + " params " + execEXE);
result = accessor.shellExecute(null, exeUpdater, execEXE,
SystemProperties.getApplicationPath(), AEWin32Access.SW_NORMAL);
}
}
/*