|設定項目|値|デフォルト|説明|
|:--:|:--:|:--:|:--:|
-|`checkVersion`|`true`/`false`|`true`|アプリケーションのバージョンをチェックします(機能作成中のためこの値は使用していません)|
+|`checkVersion`|`true`/`false`|`true`|アプリケーションのバージョンをチェックします|
|`checkLibaryUpdates`|`true`/`false`|`true`|楽曲ライブラリの更新を毎回チェックします|
|`windowWidth`|1以上の整数値|`640`|ウィンドウの横長さを指定します(機能作成中のためこの値は使用していません)|
|`windowHeight`|1以上の整数値|`360`|ウィンドウの縦長さを指定します(機能作成中のためこの値は使用していません)|
package com.ranfa.lib;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import javax.swing.JOptionPane;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.JsonMappingException;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
import com.ranfa.main.DelesteRandomSelector;
public class CheckVersion {
-
- public static boolean needToBeUpdated() {
-
+
+ private final static String URI = "https://raw.githubusercontent.com/hizumiaoba/DelesteRandomSelector/master/version.json";
+ private final static String RELEASE_STRING = "https://github.com/hizumiaoba/DelesteRandomSelector/releases";
+
+ public static void needToBeUpdated() {
+ int latestMajor = 0;
+ int latestMinor = 0;
+ int latestPatch = 0;
+ try {
+ JsonNode node = new ObjectMapper().readTree(new URL(URI));
+ latestMajor = node.get("major").asInt();
+ latestMinor = node.get("minor").asInt();
+ latestPatch = node.get("patch").asInt();
+ } catch (JsonMappingException e) {
+ // TODO 自動生成された catch ブロック
+ e.printStackTrace();
+ } catch (JsonProcessingException e) {
+ // TODO 自動生成された catch ブロック
+ e.printStackTrace();
+ } catch (MalformedURLException e) {
+ // TODO 自動生成された catch ブロック
+ e.printStackTrace();
+ } catch (IOException e) {
+ // TODO 自動生成された catch ブロック
+ e.printStackTrace();
+ }
+ if(latestPatch > getPatchVersion()) {
+ JOptionPane.showInputDialog(null, "ソフトウェアのバグ修正が公開されています。こちらから最新バージョンをダウンロードしてください。\n", RELEASE_STRING);
+ } else if(latestMinor > getMinorVersion()) {
+ JOptionPane.showInputDialog(null, "ソフトウェアの軽微な機能改修が公開されています。こちらから最新バージョンをダウンロードしてください。\n", RELEASE_STRING);
+ } else if(latestMajor > getMajorVersion()) {
+ JOptionPane.showInputDialog(null, "大規模なソフトウェアの更新が公開されています。速やかにアップデートをお願いします。\n" + RELEASE_STRING);
+ }
}
-
-
+
+
/**
* アノテーションで記載されているバージョンを取得します
* @since v1.0.0
import com.ranfa.lib.TwitterIntegration;
import com.ranfa.lib.Version;
-@Version(major = 1, minor = 2, patch = 2)
+@Version(major = 1, minor = 3, patch = 0)
public class DelesteRandomSelector extends JFrame {
private static ArrayList<Song> selectedSongsList = new ArrayList<Song>();
+ "\nSong Limit: " + property.getSongLimit()
+ "\nSaveScoreLog: " + property.isSaveScoreLog()
+ "\nOutputDebugSentences: " + property.isOutputDebugSentences());
+ if(property.isCheckVersion())
+ CheckVersion.needToBeUpdated();
BiConsumer<ArrayList<Song>, ArrayList<Song>> updateConsumer = (list1, list2) -> {
LimitedLog.println(this.getClass() + ":[INFO]: " + "Checking database updates...");
if(list1.size() > list2.size()) {