4 import java.io.IOException;
6 import com.fasterxml.jackson.databind.JsonNode;
7 import com.fasterxml.jackson.databind.ObjectMapper;
10 * 「settings.json」ファイルから各種設定を読み込みます
12 * ・起動時のバージョンチェック (checkVersion)
13 * ・起動時にライブラリの更新有無のチェック (checkLibraryUpdates)
14 * ・ウィンドウサイズ (windowWidth), (windowHeight)
15 * ・デフォルトの曲指定上限数 (songsLimit)
16 * ・スコアログの保存 (saveScoreLog)
17 * ・標準出力へデバッグ用簡易ログを流すかどうか (outputDebugSentences)
24 public class Settings {
27 private final static String FILEPATH = "settings.json";
29 public static boolean needToCheckVersion() {
31 ObjectMapper mapper = new ObjectMapper();
33 JsonNode node = mapper.readTree(new File(FILEPATH));
34 res = node.get("checkVersion").asBoolean();
35 } catch (IOException e) {
41 public static boolean needToCheckLibraryUpdates() {
43 ObjectMapper mapper = new ObjectMapper();
45 JsonNode node = mapper.readTree(new File(FILEPATH));
46 res = node.get("checkLibraryUpdates").asBoolean();
47 } catch (IOException e) {
53 public static int getWindowWidth() {
55 ObjectMapper mapper = new ObjectMapper();
57 JsonNode node = mapper.readTree(new File(FILEPATH));
58 res = node.get("windowWidth").asInt();
59 } catch (IOException e) {
65 public static int getWindowHeight() {
67 ObjectMapper mapper = new ObjectMapper();
69 JsonNode node = mapper.readTree(new File(FILEPATH));
70 res = node.get("windowHeight").asInt();
71 } catch (IOException e) {
77 public static int getSongsLimit() {
79 ObjectMapper mapper = new ObjectMapper();
81 JsonNode node = mapper.readTree(new File(FILEPATH));
82 res = node.get("songsLimit").asInt();
83 } catch (IOException e) {
89 public static boolean saveScoreLog() {
91 ObjectMapper mapper = new ObjectMapper();
93 JsonNode node = mapper.readTree(new File(FILEPATH));
94 res = node.get("saveScoreLog").asBoolean();
95 } catch (IOException e) {
101 public static boolean outputDebugSentences() {
103 ObjectMapper mapper = new ObjectMapper();
105 JsonNode node = mapper.readTree(new File(FILEPATH));
106 res = node.get("outputDebugSentences").asBoolean();
107 } catch (IOException e) {