| 1 | package net.oni2.aeinstaller.updater; | 
|---|
| 2 |  | 
|---|
| 3 | import java.io.File; | 
|---|
| 4 | import java.io.FileNotFoundException; | 
|---|
| 5 | import java.io.FileOutputStream; | 
|---|
| 6 | import java.io.PrintStream; | 
|---|
| 7 |  | 
|---|
| 8 | import javax.swing.JFrame; | 
|---|
| 9 | import javax.swing.SwingUtilities; | 
|---|
| 10 | import javax.swing.UIManager; | 
|---|
| 11 |  | 
|---|
| 12 | import net.oni2.ProxySettings; | 
|---|
| 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; | 
|---|
| 28 | for (String a : args) { | 
|---|
| 29 | if (a.equalsIgnoreCase("-debug")) | 
|---|
| 30 | debug = true; | 
|---|
| 31 | if (a.equalsIgnoreCase("-usewd")) | 
|---|
| 32 | Paths.useWorkingDirectory = true; | 
|---|
| 33 | } | 
|---|
| 34 | if (!debug) { | 
|---|
| 35 | try { | 
|---|
| 36 | PrintStream ps = new PrintStream(new FileOutputStream(new File(Paths.getPrefsPath(), | 
|---|
| 37 | "updater_output.log")), true); | 
|---|
| 38 | System.setOut(ps); | 
|---|
| 39 | System.setErr(ps); | 
|---|
| 40 | } catch (FileNotFoundException e1) { | 
|---|
| 41 | e1.printStackTrace(); | 
|---|
| 42 | } | 
|---|
| 43 | } | 
|---|
| 44 |  | 
|---|
| 45 | if (Paths.getProxySettingsFilename().exists()) { | 
|---|
| 46 | ProxySettings.deserializeFromFile(Paths.getProxySettingsFilename()); | 
|---|
| 47 | } | 
|---|
| 48 |  | 
|---|
| 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 | } | 
|---|