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

Last change on this file was 1134, checked in by alloc, 4 years ago

Updater with a few more log lines

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