4 import java.io.FileInputStream;
5 import java.io.FileNotFoundException;
6 import java.io.FileOutputStream;
7 import java.io.IOException;
8 import java.util.Properties;
10 @SuppressWarnings("serial")
11 public class AppParameters extends Properties {
12 static final String FILE_PATH = "AdjustTime.ini";
14 // GPX: 時間的に間隔が開いたGPXログを別の<trkseg>セグメントに分割する。 {ON | OFF}
15 public static String GPX_GPXSPLIT = "GPX.gpxSplit";
17 // GPX: <trkseg>セグメントの最初の1ノードは無視する。 {ON | OFF}
18 public static String GPX_NO_FIRST_NODE = "GPX.noFirstNode";
20 // GPX: 生成されたGPXファイル(ファイル名が'_.gpx'で終わるもの)も対象にする。 {ON | OFF}
21 public static String GPX_REUSE = "GPX.REUSE";
23 // GPX: 基準時刻 {FILE_UPDATE | EXIF}
24 public static String GPX_BASETIME = "GPX.BASETIME";
28 public AppParameters() throws FileNotFoundException, IOException {
33 public AppParameters(Properties defaults) throws FileNotFoundException, IOException {
38 void syncFile() throws FileNotFoundException, IOException {
39 boolean update = false;
41 this.file = new File(FILE_PATH);
43 // ファイルが存在すれば、その内容をロードする。
44 this.load(new FileInputStream(file));
50 //------------------------------------------------
51 // GPX出力: 時間的に間隔が開いたGPXログを別の<trkseg>セグメントに分割する。 {ON | OFF}
52 String valueStr = this.getProperty(GPX_GPXSPLIT);
53 if (valueStr == null) {
55 this.setProperty(GPX_GPXSPLIT, "ON");
58 //------------------------------------------------
59 // GPX出力: <trkseg>セグメントの最初の1ノードは無視する。 {ON | OFF}
60 valueStr = this.getProperty(GPX_NO_FIRST_NODE);
61 if (valueStr == null) {
63 this.setProperty(GPX_NO_FIRST_NODE, "ON");
66 //------------------------------------------------
67 // GPX出力: 生成されたGPXファイル(ファイル名が'_.gpx'で終わるもの)も対象にする。 {ON | OFF}
68 valueStr = this.getProperty(GPX_REUSE);
69 if (valueStr == null) {
71 this.setProperty(GPX_REUSE, "OFF");
74 //------------------------------------------------
75 // GPX: 基準時刻 {FILE_UPDATE | EXIF}
76 valueStr = this.getProperty(GPX_BASETIME);
77 if (valueStr == null) {
79 this.setProperty(GPX_BASETIME, "FILE_UPDATE");
85 this.store(new FileOutputStream(this.file), "defuilt settings");
89 public void store() throws FileNotFoundException, IOException {
90 this.store(new FileOutputStream(this.file), "by AdjustTime");