[734] | 1 | package net.oni2.aeinstaller.updater;
|
---|
| 2 |
|
---|
| 3 | import java.io.File;
|
---|
| 4 | import java.io.FileNotFoundException;
|
---|
| 5 | import java.io.PrintStream;
|
---|
| 6 |
|
---|
| 7 | import javax.swing.JFrame;
|
---|
| 8 | import javax.swing.SwingUtilities;
|
---|
| 9 | import javax.swing.UIManager;
|
---|
| 10 |
|
---|
[852] | 11 | import net.oni2.ProxySettings;
|
---|
[734] | 12 | import net.oni2.aeinstaller.updater.backend.Paths;
|
---|
| 13 | import net.oni2.aeinstaller.updater.gui.MainWin;
|
---|
| 14 |
|
---|
| 15 | /**
|
---|
| 16 | * @author Christian Illy
|
---|
| 17 | * @version 1
|
---|
| 18 | */
|
---|
| 19 | public class AEInstaller2Updater {
|
---|
| 20 |
|
---|
| 21 | /**
|
---|
| 22 | * @param args
|
---|
| 23 | * Command line arguments
|
---|
| 24 | */
|
---|
| 25 | public static void main(String[] args) {
|
---|
| 26 | boolean debug = false;
|
---|
[777] | 27 | for (String a : args) {
|
---|
[734] | 28 | if (a.equalsIgnoreCase("-debug"))
|
---|
| 29 | debug = true;
|
---|
[777] | 30 | if (a.equalsIgnoreCase("-usewd"))
|
---|
| 31 | Paths.useWorkingDirectory = true;
|
---|
| 32 | }
|
---|
[734] | 33 | if (!debug) {
|
---|
| 34 | try {
|
---|
| 35 | PrintStream ps = new PrintStream(new File(Paths.getPrefsPath(),
|
---|
| 36 | "updater_output.log"));
|
---|
| 37 | System.setOut(ps);
|
---|
| 38 | System.setErr(ps);
|
---|
| 39 | } catch (FileNotFoundException e1) {
|
---|
| 40 | e1.printStackTrace();
|
---|
| 41 | }
|
---|
| 42 | }
|
---|
| 43 |
|
---|
[852] | 44 | if (Paths.getProxySettingsFilename().exists()) {
|
---|
| 45 | ProxySettings.deserializeFromFile(Paths.getProxySettingsFilename());
|
---|
| 46 | }
|
---|
| 47 |
|
---|
[734] | 48 | System.setProperty("networkaddress.cache.ttl", "5");
|
---|
| 49 | System.setProperty("networkaddress.cache.negative.ttl", "1");
|
---|
| 50 |
|
---|
| 51 | try {
|
---|
| 52 | UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
|
---|
| 53 | } catch (Exception e) {
|
---|
| 54 | e.printStackTrace();
|
---|
| 55 | }
|
---|
| 56 | JFrame.setDefaultLookAndFeelDecorated(true);
|
---|
| 57 |
|
---|
| 58 | SwingUtilities.invokeLater(new Runnable() {
|
---|
| 59 |
|
---|
| 60 | public void run() {
|
---|
| 61 | try {
|
---|
| 62 | new MainWin().setVisible(true);
|
---|
| 63 | } catch (Exception e) {
|
---|
| 64 | e.printStackTrace();
|
---|
| 65 | }
|
---|
| 66 | }
|
---|
| 67 | });
|
---|
| 68 | }
|
---|
| 69 | }
|
---|