source: java/AEInstaller2-Updater/src/net/oni2/aeinstaller/updater/AEInstaller2Updater.java@ 1089

Last change on this file since 1089 was 1078, checked in by alloc, 7 years ago

Hopefully better log output for AEI2Updater

File size: 1.6 KB
Line 
1package net.oni2.aeinstaller.updater;
2
3import java.io.File;
4import java.io.FileNotFoundException;
5import java.io.FileOutputStream;
6import java.io.PrintStream;
7
8import javax.swing.JFrame;
9import javax.swing.SwingUtilities;
10import javax.swing.UIManager;
11
12import net.oni2.ProxySettings;
13import net.oni2.aeinstaller.updater.backend.Paths;
14import net.oni2.aeinstaller.updater.gui.MainWin;
15
16/**
17 * @author Christian Illy
18 * @version 1
19 */
20public 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}
Note: See TracBrowser for help on using the repository browser.