| 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 | import java.text.SimpleDateFormat; | 
 
 
 
 
 | 8 | import java.util.Date; | 
 
 
 
 
 | 9 |  | 
 
 
 
 
 | 10 | import javax.swing.JFrame; | 
 
 
 
 
 | 11 | import javax.swing.SwingUtilities; | 
 
 
 
 
 | 12 | import javax.swing.UIManager; | 
 
 
 
 
 | 13 |  | 
 
 
 
 
 | 14 | import net.oni2.ProxySettings; | 
 
 
 
 
 | 15 | import net.oni2.aeinstaller.updater.backend.Paths; | 
 
 
 
 
 | 16 | import net.oni2.aeinstaller.updater.gui.MainWin; | 
 
 
 
 
 | 17 | import net.oni2.platformtools.PlatformInformation; | 
 
 
 
 
 | 18 |  | 
 
 
 
 
 | 19 | /** | 
 
 
 
 
 | 20 | * @author Christian Illy | 
 
 
 
 
 | 21 | * @version 1 | 
 
 
 
 
 | 22 | */ | 
 
 
 
 
 | 23 | public class AEInstaller2Updater { | 
 
 
 
 
 | 24 |  | 
 
 
 
 
 | 25 | /** | 
 
 
 
 
 | 26 | * @param args | 
 
 
 
 
 | 27 | *            Command line arguments | 
 
 
 
 
 | 28 | */ | 
 
 
 
 
 | 29 | public static void main(String[] args) { | 
 
 
 
 
 | 30 | boolean debug = false; | 
 
 
 
 
 | 31 | for (String a : args) { | 
 
 
 
 
 | 32 | if (a.equalsIgnoreCase("-debug")) | 
 
 
 
 
 | 33 | debug = true; | 
 
 
 
 
 | 34 | if (a.equalsIgnoreCase("-usewd")) | 
 
 
 
 
 | 35 | Paths.useWorkingDirectory = true; | 
 
 
 
 
 | 36 | } | 
 
 
 
 
 | 37 | if (!debug) { | 
 
 
 
 
 | 38 | try { | 
 
 
 
 
 | 39 | PrintStream ps = new PrintStream(new FileOutputStream(new File(Paths.getPrefsPath(), | 
 
 
 
 
 | 40 | "updater_output.log")), true); | 
 
 
 
 
 | 41 | System.setOut(ps); | 
 
 
 
 
 | 42 | System.setErr(ps); | 
 
 
 
 
 | 43 | } catch (FileNotFoundException e1) { | 
 
 
 
 
 | 44 | e1.printStackTrace(); | 
 
 
 
 
 | 45 | } | 
 
 
 
 
 | 46 | } | 
 
 
 
 
 | 47 |  | 
 
 
 
 
 | 48 | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | 
 
 
 
 
 | 49 | System.out.println("Time:      " + sdf.format(new Date())); | 
 
 
 
 
 | 50 | System.out.println("Java:      \"" | 
 
 
 
 
 | 51 | + System.getProperty("java.runtime.name") + "\" v. " | 
 
 
 
 
 | 52 | + System.getProperty("java.version") + " by \"" | 
 
 
 
 
 | 53 | + System.getProperty("java.vendor") + "\" (spec. " | 
 
 
 
 
 | 54 | + System.getProperty("java.specification.version") + ")"); | 
 
 
 
 
 | 55 | System.out.println("Java home: " + System.getProperty("java.home")); | 
 
 
 
 
 | 56 | System.out.println("Command:   " | 
 
 
 
 
 | 57 | + System.getProperty("sun.java.command")); | 
 
 
 
 
 | 58 | System.out.println("PrefsPath: " + Paths.getPrefsPath()); | 
 
 
 
 
 | 59 | System.out.println("DownPath:  " + Paths.getDownloadPath()); | 
 
 
 
 
 | 60 | System.out.println("TempPath:  " + Paths.getTempPath()); | 
 
 
 
 
 | 61 | System.out.println("Platform:  " + System.getProperty("os.name") + | 
 
 
 
 
 | 62 | " detected as " + PlatformInformation.getPlatform().toString()); | 
 
 
 
 
 | 63 | System.out.println("Architect: " | 
 
 
 
 
 | 64 | + PlatformInformation.getArchitecture()); | 
 
 
 
 
 | 65 | System.out.println(""); | 
 
 
 
 
 | 66 |  | 
 
 
 
 
 | 67 | if (Paths.getProxySettingsFilename().exists()) { | 
 
 
 
 
 | 68 | ProxySettings.deserializeFromFile(Paths.getProxySettingsFilename()); | 
 
 
 
 
 | 69 | } | 
 
 
 
 
 | 70 |  | 
 
 
 
 
 | 71 | System.setProperty("networkaddress.cache.ttl", "5"); | 
 
 
 
 
 | 72 | System.setProperty("networkaddress.cache.negative.ttl", "1"); | 
 
 
 
 
 | 73 |  | 
 
 
 
 
 | 74 | try { | 
 
 
 
 
 | 75 | UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); | 
 
 
 
 
 | 76 | } catch (Exception e) { | 
 
 
 
 
 | 77 | e.printStackTrace(); | 
 
 
 
 
 | 78 | } | 
 
 
 
 
 | 79 | JFrame.setDefaultLookAndFeelDecorated(true); | 
 
 
 
 
 | 80 |  | 
 
 
 
 
 | 81 | SwingUtilities.invokeLater(new Runnable() { | 
 
 
 
 
 | 82 |  | 
 
 
 
 
 | 83 | public void run() { | 
 
 
 
 
 | 84 | try { | 
 
 
 
 
 | 85 | new MainWin().setVisible(true); | 
 
 
 
 
 | 86 | } catch (Exception e) { | 
 
 
 
 
 | 87 | e.printStackTrace(); | 
 
 
 
 
 | 88 | } | 
 
 
 
 
 | 89 | } | 
 
 
 
 
 | 90 | }); | 
 
 
 
 
 | 91 | } | 
 
 
 
 
 | 92 | } |