-
Notifications
You must be signed in to change notification settings - Fork 2
/
Cadencii.java
105 lines (84 loc) · 3.17 KB
/
Cadencii.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
/*
* Cadencii.cs
* Copyright © 2009-2011 kbinani
*
* This file is part of org.kbinani.cadencii.
*
* org.kbinani.cadencii is free software; you can redistribute it and/or
* modify it under the terms of the GPLv3 License.
*
* org.kbinani.cadencii is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
import org.kbinani.*;
import org.kbinani.apputil.*;
import org.kbinani.cadencii.*;
public class Cadencii implements Thread.UncaughtExceptionHandler {
private static String mPathVsq = "";
private static String mPathResource = "";
private static boolean mPrintVersion = false;
/// <summary>
/// 起動時に渡されたコマンドライン引数を評価します。
/// 戻り値は、コマンドライン引数のうちVSQ,またはXVSQファイルとして指定された引数、または空文字です。
/// </summary>
/// <param name="arg"></param>
private static void parseArguments(String[] arg) {
String currentparse = "";
for (int i = 0; i < arg.length; i++) {
String argi = arg[i];
if (str.startsWith(argi, "-")) {
currentparse = argi;
if (str.compare(argi, "--version")) {
mPrintVersion = true;
currentparse = "";
}
} else {
if (str.compare(currentparse, "")) {
mPathVsq = argi;
} else if (str.compare(currentparse, "-resources")) {
mPathResource = argi;
}
currentparse = "";
}
}
}
private static void handleUnhandledException(Exception ex) {
ExceptionNotifyFormController controller = new ExceptionNotifyFormController();
controller.setReportTarget(ex);
controller.getUi().showDialog(null);
}
public static void main(String[] args) {
Thread.setDefaultUncaughtExceptionHandler(new Cadencii());
// 引数を解釈
parseArguments(args);
if (mPrintVersion) {
System.out.print(BAssemblyInfo.fileVersion);
return;
}
String file = mPathVsq;
if (!str.compare(mPathResource, "")) {
Resources.setBasePath(mPathResource);
}
try {
Messaging.loadMessages();
} catch (Exception ex) {
Logger.write(Cadencii.class + ".main; ex=" + ex + "\n");
serr.println("Cadencii.main; ex=" + ex);
}
AppManager.init();
AppManager.mMainWindowController = new FormMainController();
AppManager.mMainWindow = new FormMain(AppManager.mMainWindowController,
file);
AppManager.mMainWindow.setVisible(true);
}
@Override
public void uncaughtException(Thread arg0, Throwable arg1) {
Exception ex = new Exception(
"unknown exception handled at 'Cadencii::Cadencii_UnhandledException");
if ((arg1 != null) && arg1 instanceof Exception) {
ex = (Exception) arg1;
}
handleUnhandledException(ex);
}
}