main functions should still be static
This commit is contained in:
@@ -32,8 +32,9 @@ public class WinLauncher extends CopyConfigDir {
|
|||||||
WindowsUpdatePostProcessor wupp = null;
|
WindowsUpdatePostProcessor wupp = null;
|
||||||
private Router i2pRouter;
|
private Router i2pRouter;
|
||||||
|
|
||||||
public void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
setupLauncher();
|
var launcher = new WinLauncher();
|
||||||
|
launcher.setupLauncher();
|
||||||
initLogger();
|
initLogger();
|
||||||
int privateBrowsing = 0;
|
int privateBrowsing = 0;
|
||||||
boolean usabilityMode = false;
|
boolean usabilityMode = false;
|
||||||
@@ -76,7 +77,7 @@ public class WinLauncher extends CopyConfigDir {
|
|||||||
proxyTimeoutTime = 0;
|
proxyTimeoutTime = 0;
|
||||||
} else if (proxyTimeoutTime > 0) {
|
} else if (proxyTimeoutTime > 0) {
|
||||||
newArgsList.add(arg);
|
newArgsList.add(arg);
|
||||||
} else if (!isAvailable(4444)) {
|
} else if (!launcher.isAvailable(4444)) {
|
||||||
newArgsList.add(arg);
|
newArgsList.add(arg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -84,8 +85,8 @@ public class WinLauncher extends CopyConfigDir {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
File programs = programFile();
|
File programs = launcher.programFile();
|
||||||
File home = homeDir();
|
File home = launcher.homeDir();
|
||||||
|
|
||||||
System.setProperty(
|
System.setProperty(
|
||||||
"i2p.dir.base",
|
"i2p.dir.base",
|
||||||
@@ -123,30 +124,30 @@ public class WinLauncher extends CopyConfigDir {
|
|||||||
System.exit(1);
|
System.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (launchBrowser(privateBrowsing, usabilityMode, chromiumFirst,
|
if (launcher.launchBrowser(privateBrowsing, usabilityMode, chromiumFirst,
|
||||||
proxyTimeoutTime, newArgsList)) {
|
proxyTimeoutTime, newArgsList)) {
|
||||||
System.exit(0);
|
System.exit(0);
|
||||||
}
|
}
|
||||||
i2pRouter = new Router(routerConfig(), System.getProperties());
|
launcher.i2pRouter = new Router(routerConfig(), System.getProperties());
|
||||||
if (!isInstalled("i2p")) {
|
if (!isInstalled("i2p")) {
|
||||||
if (i2pRouter.saveConfig("routerconsole.browser", null)) {
|
if (launcher.i2pRouter.saveConfig("routerconsole.browser", null)) {
|
||||||
logger.info("removed routerconsole.browser config");
|
logger.info("removed routerconsole.browser config");
|
||||||
}
|
}
|
||||||
if (i2pRouter.saveConfig("routerconsole.browser",
|
if (launcher.i2pRouter.saveConfig("routerconsole.browser",
|
||||||
appImageExe() + " -noproxycheck")) {
|
appImageExe() + " -noproxycheck")) {
|
||||||
logger.info("updated routerconsole.browser config " + appImageExe());
|
logger.info("updated routerconsole.browser config " + appImageExe());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
logger.info("Router is configured");
|
logger.info("Router is configured");
|
||||||
|
|
||||||
Thread registrationThread = new Thread(REGISTER_UPP);
|
Thread registrationThread = new Thread(launcher.REGISTER_UPP);
|
||||||
registrationThread.setName("UPP Registration");
|
registrationThread.setName("UPP Registration");
|
||||||
registrationThread.setDaemon(true);
|
registrationThread.setDaemon(true);
|
||||||
registrationThread.start();
|
registrationThread.start();
|
||||||
|
|
||||||
setNotStarting();
|
launcher.setNotStarting();
|
||||||
|
|
||||||
i2pRouter.runRouter();
|
launcher.i2pRouter.runRouter();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setupLauncher() {
|
private void setupLauncher() {
|
||||||
|
|||||||
@@ -268,12 +268,13 @@ public class WindowsServiceUtil {
|
|||||||
return "mac";
|
return "mac";
|
||||||
return "linux";
|
return "linux";
|
||||||
}
|
}
|
||||||
public void main(String args[]) {
|
public static void main(String args[]) {
|
||||||
|
WindowsServiceUtil wsu = new WindowsServiceUtil();
|
||||||
// when querying the I2P router service installed by the IzPack installer
|
// when querying the I2P router service installed by the IzPack installer
|
||||||
// this is the correct call.
|
// this is the correct call.
|
||||||
String state = getServiceState("i2p");
|
String state = wsu.getServiceState("i2p");
|
||||||
int stateInt = getServiceStateInt("i2p");
|
int stateInt = wsu.getServiceStateInt("i2p");
|
||||||
System.out.println("i2p state: " + state + " code: " + stateInt);
|
System.out.println("i2p state: " + state + " code: " + stateInt);
|
||||||
promptServiceStartIfAvailable("i2p");
|
wsu.promptServiceStartIfAvailable("i2p");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user