+
+ 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);
+ }