mirror of
https://github.com/HMCL-dev/HMCL.git
synced 2025-08-04 03:46:57 -04:00
Init log before checking updates
This commit is contained in:
parent
99c7fb997b
commit
b4658463e1
@ -98,43 +98,6 @@ public final class Main implements Runnable {
|
|||||||
|
|
||||||
public static void main(String[] args) throws IOException {
|
public static void main(String[] args) throws IOException {
|
||||||
{
|
{
|
||||||
HMCLApi.HMCL_VERSION = VersionNumber.check(LAUNCHER_VERSION);
|
|
||||||
|
|
||||||
PluginManager.getPlugin(DefaultPlugin.class);
|
|
||||||
for (String s : args)
|
|
||||||
if (s.startsWith("--plugin=")) {
|
|
||||||
String c = s.substring("--plugin=".length());
|
|
||||||
try {
|
|
||||||
PluginManager.getPlugin(Class.forName(c));
|
|
||||||
} catch (ClassNotFoundException ex) {
|
|
||||||
LOGGER.log(Level.WARNING, "Class: " + c + " not found, please add your plugin jar to class path.", ex);
|
|
||||||
}
|
|
||||||
} else if (s.startsWith("--help")) {
|
|
||||||
System.out.println("HMCL command line help");
|
|
||||||
System.out.println("--noupdate: this arg will prevent HMCL from initializing the newest app version in %appdata%/.hmcl");
|
|
||||||
System.out.println("--plugin=<your plugin class>: this arg will allow a new plugin to be loaded, please keep your jar in system class path and this class extends IPlugin.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
PluginManager.loadPlugins();
|
|
||||||
|
|
||||||
IUpgrader.NOW_UPGRADER.parseArguments(HMCLApi.HMCL_VERSION, args);
|
|
||||||
|
|
||||||
System.setProperty("awt.useSystemAAFontSettings", "on");
|
|
||||||
System.setProperty("swing.aatext", "true");
|
|
||||||
System.setProperty("sun.java2d.noddraw", "true");
|
|
||||||
System.setProperty("sun.java2d.dpiaware", "false");
|
|
||||||
System.setProperty("https.protocols", "SSLv3,TLSv1");
|
|
||||||
|
|
||||||
try {
|
|
||||||
SSLContext c = SSLContext.getInstance("SSL");
|
|
||||||
c.init(null, new X509TrustManager[] { XTM }, new java.security.SecureRandom());
|
|
||||||
HttpsURLConnection.setDefaultSSLSocketFactory(c.getSocketFactory());
|
|
||||||
} catch (GeneralSecurityException ignore) {
|
|
||||||
}
|
|
||||||
HttpsURLConnection.setDefaultHostnameVerifier(HNV);
|
|
||||||
|
|
||||||
Thread.setDefaultUncaughtExceptionHandler(new CrashReporter(true));
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
File file = new File("hmcl.log").getAbsoluteFile();
|
File file = new File("hmcl.log").getAbsoluteFile();
|
||||||
if (!file.exists() && !file.createNewFile())
|
if (!file.exists() && !file.createNewFile())
|
||||||
@ -172,6 +135,43 @@ public final class Main implements Runnable {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
HMCLApi.HMCL_VERSION = VersionNumber.check(LAUNCHER_VERSION);
|
||||||
|
|
||||||
|
PluginManager.getPlugin(DefaultPlugin.class);
|
||||||
|
for (String s : args)
|
||||||
|
if (s.startsWith("--plugin=")) {
|
||||||
|
String c = s.substring("--plugin=".length());
|
||||||
|
try {
|
||||||
|
PluginManager.getPlugin(Class.forName(c));
|
||||||
|
} catch (ClassNotFoundException ex) {
|
||||||
|
LOGGER.log(Level.WARNING, "Class: " + c + " not found, please add your plugin jar to class path.", ex);
|
||||||
|
}
|
||||||
|
} else if (s.startsWith("--help")) {
|
||||||
|
System.out.println("HMCL command line help");
|
||||||
|
System.out.println("--noupdate: this arg will prevent HMCL from initializing the newest app version in %appdata%/.hmcl");
|
||||||
|
System.out.println("--plugin=<your plugin class>: this arg will allow a new plugin to be loaded, please keep your jar in system class path and this class extends IPlugin.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
PluginManager.loadPlugins();
|
||||||
|
|
||||||
|
IUpgrader.NOW_UPGRADER.parseArguments(HMCLApi.HMCL_VERSION, args);
|
||||||
|
|
||||||
|
System.setProperty("awt.useSystemAAFontSettings", "on");
|
||||||
|
System.setProperty("swing.aatext", "true");
|
||||||
|
System.setProperty("sun.java2d.noddraw", "true");
|
||||||
|
System.setProperty("sun.java2d.dpiaware", "false");
|
||||||
|
System.setProperty("https.protocols", "SSLv3,TLSv1");
|
||||||
|
|
||||||
|
try {
|
||||||
|
SSLContext c = SSLContext.getInstance("SSL");
|
||||||
|
c.init(null, new X509TrustManager[] { XTM }, new java.security.SecureRandom());
|
||||||
|
HttpsURLConnection.setDefaultSSLSocketFactory(c.getSocketFactory());
|
||||||
|
} catch (GeneralSecurityException ignore) {
|
||||||
|
}
|
||||||
|
HttpsURLConnection.setDefaultHostnameVerifier(HNV);
|
||||||
|
|
||||||
|
Thread.setDefaultUncaughtExceptionHandler(new CrashReporter(true));
|
||||||
|
|
||||||
HMCLog.log("*** " + Main.makeTitle() + " ***");
|
HMCLog.log("*** " + Main.makeTitle() + " ***");
|
||||||
|
|
||||||
String s = Settings.getInstance().getLocalization();
|
String s = Settings.getInstance().getLocalization();
|
||||||
|
@ -33,8 +33,6 @@ HMCLAPI is based on Event bus. There are all events below.
|
|||||||
- DownloadTypeChangedEvent
|
- DownloadTypeChangedEvent
|
||||||
- ThemeChangedEvent
|
- ThemeChangedEvent
|
||||||
* org.jackhuang.hmcl.api.event.launch
|
* org.jackhuang.hmcl.api.event.launch
|
||||||
- DecompressLibrariesEvent
|
|
||||||
- DownloadLibrariesEvent
|
|
||||||
- LaunchEvent
|
- LaunchEvent
|
||||||
- LaunchSucceededEvent
|
- LaunchSucceededEvent
|
||||||
- LaunchingStateChangedEvent
|
- LaunchingStateChangedEvent
|
||||||
|
Loading…
x
Reference in New Issue
Block a user