v2.01 update

This commit is contained in:
Clisprail
2013-09-04 14:45:23 +02:00
parent 36f7e0407e
commit edb17e188b
89 changed files with 2866 additions and 847 deletions
+48 -12
View File
@@ -5,50 +5,86 @@ import javax.swing.UIManager;
import org.parabot.core.Core;
import org.parabot.core.Directories;
import org.parabot.core.forum.AccountManager;
import org.parabot.core.ui.LoginUI;
import org.parabot.core.ui.ServerSelector;
import org.parabot.core.ui.utils.UILog;
/**
* Parabot v2
*
* @author Clisprail (Parnassian)
* @author Everel/Parnassian
* @author Matt, Dane
* @version 2.0
* @version 2.01
*/
public final class Landing {
// forum account
private static String username = null;
private static String password = null;
public static void main(String... args) {
parseArgs(args);
Core.verbose("Debug mode: " + Core.inDebugMode());
try {
Core.verbose("Setting look and feel: "
+ UIManager.getSystemLookAndFeelClassName());
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (Throwable t) {
t.printStackTrace();
}
Directories.validate();
if(!Core.inDebugMode()) {
UILog.log("Error", "You can only run parabot in debug mode.", JOptionPane.ERROR_MESSAGE);
if (!Core.inDebugMode() && !Core.isValid()) {
UILog.log(
"Updates",
"Please download the newest version of parabot at http://www.parabot.org/",
JOptionPane.INFORMATION_MESSAGE);
return;
}
ServerSelector.getInstance();
Core.verbose("Validating directories...");
Directories.validate();
Core.verbose("Validating account manager...");
AccountManager.validate();
if (username != null && password != null) {
new LoginUI(username, password);
username = null;
password = null;
return;
}
Core.verbose("Starting login gui...");
new LoginUI().setVisible(true);
}
private static void parseArgs(String... args) {
for(int i = 0; i < args.length; i++) {
final String arg = args[i];
switch(arg) {
for (int i = 0; i < args.length; i++) {
final String arg = args[i].toLowerCase();
switch (arg) {
case "-createdirs":
Directories.validate();
System.out.println("Directories created, you can now run parabot.");
System.out
.println("Directories created, you can now run parabot.");
System.exit(0);
break;
case "-debug":
Core.setDebug(true);
break;
case "-v":
case "-verbose":
Core.setVerbose(true);
break;
case "-server":
ServerSelector.initServer = args[++i];
break;
case "-login":
username = args[++i];
password = args[++i];
break;
}
}
}