source: AE/installer2/src/net/oni2/aeinstaller/AEInstaller2.java@ 591

Last change on this file since 591 was 591, checked in by alloc, 12 years ago

AEI2-import

File size: 2.9 KB
RevLine 
[591]1package net.oni2.aeinstaller;
2
3import java.io.File;
4import java.io.FileNotFoundException;
5import java.io.PrintStream;
6
7import javax.swing.JFrame;
8import javax.swing.JToolBar;
9import javax.swing.SwingUtilities;
10import javax.swing.UIManager;
11import javax.swing.UIManager.LookAndFeelInfo;
12
13import net.oni2.aeinstaller.backend.Settings;
14import net.oni2.aeinstaller.backend.StuffToRefactorLater;
15import net.oni2.aeinstaller.backend.depot.DepotManager;
16import net.oni2.aeinstaller.gui.MainWin;
17
18import org.javabuilders.swing.SwingJavaBuilder;
19
20/**
21 * @author Christian Illy
22 * @version 0.1
23 */
24public class AEInstaller2 {
25
26 /**
27 * @param args
28 * Command line arguments
29 */
30 public static void main(String[] args) {
31 new File(Settings.getPrefsPath()).mkdirs();
32 new File(Settings.getDownloadPath()).mkdirs();
33
34 boolean debug = false;
35 for (String a : args)
36 if (a.equalsIgnoreCase("-debug"))
37 debug = true;
38 if (!debug) {
39 try {
40 System.setOut(new PrintStream(Settings.getPrefsPath()
41 + "aei_output.log"));
42 System.setErr(new PrintStream(Settings.getPrefsPath()
43 + "aei_error.log"));
44 } catch (FileNotFoundException e1) {
45 e1.printStackTrace();
46 }
47 }
48
49 Settings.deserializeFromFile();
50 Settings.setDebug(debug);
51 DepotManager.getInstance().loadFromFile(
52 new File(Settings.getDepotCacheFilename()));
53
54 SwingJavaBuilder.getConfig().addResourceBundle("Images");
55 SwingJavaBuilder.getConfig().setMarkInvalidResourceBundleKeys(true);
56 SwingJavaBuilder.getConfig().addType("JToolBarSeparator",
57 JToolBar.Separator.class);
58 // SwingJavaBuilder.getConfig().addType("ScreenshotBrowser",
59 // ScreenshotBrowser.class);
60 // SwingJavaBuilder.getConfig().addType("HTMLLinkLabel",
61 // HTMLLinkLabel.class);
62
63 System.setProperty("networkaddress.cache.ttl", "5");
64 System.setProperty("networkaddress.cache.negative.ttl", "1");
65
66 try {
67 String laf = Settings.getInstance().get("lookandfeel",
68 (String) null);
69 if (laf == null) {
70 for (LookAndFeelInfo lafInfo : UIManager
71 .getInstalledLookAndFeels()) {
72 if (lafInfo.getName().equals("Nimbus"))
73 laf = lafInfo.getClassName();
74 }
75 }
76 if (laf == null)
77 laf = UIManager.getSystemLookAndFeelClassName();
78 UIManager.setLookAndFeel(laf);
79 } catch (Exception e) {
80 e.printStackTrace();
81 }
82 JFrame.setDefaultLookAndFeelDecorated(true);
83
84 // TODO
85 System.out.println("JarPath: " + Settings.getJarPath());
86 System.out.println("PrefsPath: " + Settings.getPrefsPath());
87 System.out.println("DataPath: " + Settings.getDataPath());
88 System.out.println("DownPath: " + Settings.getDownloadPath());
89 System.out.println("TempPath: " + Settings.getTempPath());
90 System.out.println("ValidPath: "
91 + StuffToRefactorLater.verifyRunningDirectory());
92
93 SwingUtilities.invokeLater(new Runnable() {
94
95 public void run() {
96 try {
97 new MainWin().setVisible(true);
98 } catch (Exception e) {
99 e.printStackTrace();
100 }
101 }
102 });
103
104 }
105}
Note: See TracBrowser for help on using the repository browser.