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