Bläddra i källkod

初始化提交

Snow 1 månad sedan
förälder
incheckning
c81687151b

+ 45 - 34
.idea/artifacts/SNGL_FX17_jar.xml

@@ -3,49 +3,60 @@
     <output-path>$PROJECT_DIR$/out/artifacts/SNGL_FX17_jar</output-path>
     <root id="archive" name="SNGL-FX17.jar">
       <element id="module-output" name="SNGL-FX17" />
+      <element id="library" level="project" name="Maven: com.googlecode.json-simple:json-simple:1.1" />
+      <element id="library" level="project" name="Maven: org.mortbay.jetty:jetty:6.1.22" />
+      <element id="extracted-dir" path="$MAVEN_REPOSITORY$/com/github/oshi/oshi-core/5.8.6/oshi-core-5.8.6.jar" path-in-jar="/" />
+      <element id="library" level="project" name="Maven: org.openjfx:javafx-base:21-ea+17" />
+      <element id="extracted-dir" path="$MAVEN_REPOSITORY$/dev/3-3/jmccc/3.1.4/jmccc-3.1.4.jar" path-in-jar="/" />
+      <element id="library" level="project" name="Maven: org.antlr:antlr-runtime:3.2" />
+      <element id="extracted-dir" path="$MAVEN_REPOSITORY$/commons-collections/commons-collections/3.2.1/commons-collections-3.2.1.jar" path-in-jar="/" />
+      <element id="library" level="project" name="Maven: org.openjfx:javafx-graphics:mac-aarch64:21-ea+17" />
+      <element id="library" level="project" name="Maven: com.github.stephenc:jamm:0.2.2" />
+      <element id="library" level="project" name="Maven: com.google.guava:guava:r08" />
+      <element id="extracted-dir" path="$MAVEN_REPOSITORY$/dev/3-3/jmccc-microsoft-authenticator/3.1.4/jmccc-microsoft-authenticator-3.1.4.jar" path-in-jar="/" />
+      <element id="library" level="project" name="Maven: org.yaml:snakeyaml:1.6" />
       <element id="library" level="project" name="Maven: org.openjfx:javafx-controls:mac-aarch64:21-ea+17" />
-      <element id="extracted-dir" path="$MAVEN_REPOSITORY$/org/ehcache/modules/ehcache-core/3.10.8/ehcache-core-3.10.8.jar" path-in-jar="/" />
-      <element id="library" level="project" name="Maven: org.glassfish.jaxb:txw2:3.0.0-M5" />
-      <element id="extracted-dir" path="$MAVEN_REPOSITORY$/org/ehcache/modules/ehcache-api/3.10.8/ehcache-api-3.10.8.jar" path-in-jar="/" />
-      <element id="library" level="project" name="Maven: org.glassfish.jaxb:jaxb-runtime:3.0.0-M5" />
+      <element id="extracted-dir" path="$MAVEN_REPOSITORY$/org/ow2/asm/asm/9.4/asm-9.4.jar" path-in-jar="/" />
+      <element id="library" level="project" name="Maven: org.antlr:antlr:3.2" />
       <element id="extracted-dir" path="$MAVEN_REPOSITORY$/org/apache/commons/commons-compress/1.22/commons-compress-1.22.jar" path-in-jar="/" />
-      <element id="library" level="project" name="Maven: com.sun.istack:istack-commons-runtime:4.0.0" />
-      <element id="library" level="project" name="Maven: org.openjfx:javafx-graphics:mac-aarch64:21-ea+17" />
-      <element id="extracted-dir" path="$MAVEN_REPOSITORY$/javax/cache/cache-api/1.1.1/cache-api-1.1.1.jar" path-in-jar="/" />
+      <element id="library" level="project" name="Maven: org.antlr:stringtemplate:3.2" />
+      <element id="extracted-dir" path="$MAVEN_REPOSITORY$/org/terracotta/statistics/2.1.2/statistics-2.1.2.jar" path-in-jar="/" />
+      <element id="library" level="project" name="Maven: javax.cache:cache-api:1.1.0" />
       <element id="library" level="project" name="Maven: org.openjfx:javafx-fxml:mac-aarch64:21-ea+17" />
+      <element id="library" level="project" name="Maven: com.sun.istack:istack-commons-runtime:4.0.0" />
       <element id="extracted-dir" path="$MAVEN_REPOSITORY$/org/terracotta/terracotta-utilities-tools/0.0.15/terracotta-utilities-tools-0.0.15.jar" path-in-jar="/" />
-      <element id="library" level="project" name="Maven: org.apache.httpcomponents:httpcore:4.4.16" />
-      <element id="library" level="project" name="Maven: org.openjfx:javafx-base:21-ea+17" />
-      <element id="extracted-dir" path="$MAVEN_REPOSITORY$/org/terracotta/statistics/2.1.2/statistics-2.1.2.jar" path-in-jar="/" />
-      <element id="library" level="project" name="Maven: org.openjfx:javafx-graphics:21-ea+17" />
-      <element id="library" level="project" name="Maven: com.sun.activation:jakarta.activation:2.0.0" />
-      <element id="extracted-dir" path="$MAVEN_REPOSITORY$/org/tukaani/xz/1.9/xz-1.9.jar" path-in-jar="/" />
-      <element id="library" level="project" name="Maven: org.openjfx:javafx-fxml:21-ea+17" />
+      <element id="extracted-dir" path="$MAVEN_REPOSITORY$/org/mortbay/jetty/servlet-api/2.5-20081211/servlet-api-2.5-20081211.jar" path-in-jar="/" />
       <element id="library" level="project" name="Maven: org.glassfish.jaxb:jaxb-core:3.0.0-M5" />
-      <element id="library" level="project" name="Maven: org.apache.httpcomponents:httpcore-nio:4.4.16" />
-      <element id="extracted-dir" path="$MAVEN_REPOSITORY$/net/java/dev/jna/jna-platform/5.10.0/jna-platform-5.10.0.jar" path-in-jar="/" />
+      <element id="library" level="project" name="Maven: junit:junit:4.4" />
       <element id="extracted-dir" path="$MAVEN_REPOSITORY$/commons-logging/commons-logging/1.2/commons-logging-1.2.jar" path-in-jar="/" />
-      <element id="extracted-dir" path="$MAVEN_REPOSITORY$/org/ehcache/sizeof/0.4.3/sizeof-0.4.3.jar" path-in-jar="/" />
+      <element id="extracted-dir" path="$MAVEN_REPOSITORY$/org/tukaani/xz/1.9/xz-1.9.jar" path-in-jar="/" />
       <element id="extracted-dir" path="$MAVEN_REPOSITORY$/org/terracotta/offheap-store/2.5.3/offheap-store-2.5.3.jar" path-in-jar="/" />
-      <element id="extracted-dir" path="$MAVEN_REPOSITORY$/commons-codec/commons-codec/1.11/commons-codec-1.11.jar" path-in-jar="/" />
-      <element id="library" level="project" name="Maven: org.openjfx:javafx-controls:21-ea+17" />
-      <element id="extracted-dir" path="$MAVEN_REPOSITORY$/org/ehcache/modules/ehcache-impl/3.10.8/ehcache-impl-3.10.8.jar" path-in-jar="/" />
-      <element id="extracted-dir" path="$MAVEN_REPOSITORY$/net/java/dev/jna/jna/5.10.0/jna-5.10.0.jar" path-in-jar="/" />
-      <element id="library" level="project" name="Maven: org.ehcache:ehcache:3.10.0" />
-      <element id="extracted-dir" path="$MAVEN_REPOSITORY$/org/ow2/asm/asm/9.4/asm-9.4.jar" path-in-jar="/" />
+      <element id="library" level="project" name="Maven: com.sun.activation:jakarta.activation:2.0.0" />
       <element id="library" level="project" name="Maven: org.openjfx:javafx-base:mac-aarch64:21-ea+17" />
+      <element id="extracted-dir" path="$MAVEN_REPOSITORY$/dev/3-3/jmccc-yggdrasil-authenticator/3.1.4/jmccc-yggdrasil-authenticator-3.1.4.jar" path-in-jar="/" />
       <element id="library" level="project" name="Maven: jakarta.xml.bind:jakarta.xml.bind-api:3.0.0" />
-      <element id="library" level="project" name="Maven: dev.3-3:jmccc-microsoft-authenticator:3.1.4" />
-      <element id="library" level="project" name="Maven: dev.3-3:jmccc-mcdownloader:3.1.4" />
-      <element id="library" level="project" name="Maven: dev.3-3:jmccc:3.1.4" />
-      <element id="library" level="project" name="Maven: log4j:log4j:1.2.17" />
-      <element id="library" level="project" name="Maven: org.slf4j:slf4j-api:1.7.32" />
-      <element id="library" level="project" name="Maven: dev.3-3:jmccc-mojang-api:3.1.4" />
-      <element id="library" level="project" name="Maven: cn.hutool:hutool-all:5.6.0" />
-      <element id="library" level="project" name="Maven: io.github.mkpaz:atlantafx-base:2.0.0" />
-      <element id="library" level="project" name="Maven: com.github.oshi:oshi-core:5.8.6" />
-      <element id="library" level="project" name="Maven: commons-logging:commons-logging:1.2" />
-      <element id="library" level="project" name="Maven: commons-codec:commons-codec:1.11" />
+      <element id="extracted-dir" path="$MAVEN_REPOSITORY$/net/java/dev/jna/jna/5.10.0/jna-5.10.0.jar" path-in-jar="/" />
+      <element id="library" level="project" name="Maven: org.openjfx:javafx-graphics:21-ea+17" />
+      <element id="library" level="project" name="Maven: jline:jline:0.9.94" />
+      <element id="extracted-dir" path="$MAVEN_REPOSITORY$/javax/servlet/servlet-api/2.5/servlet-api-2.5.jar" path-in-jar="/" />
+      <element id="library" level="project" name="Maven: commons-codec:commons-codec:1.2" />
+      <element id="extracted-dir" path="$MAVEN_REPOSITORY$/commons-lang/commons-lang/2.4/commons-lang-2.4.jar" path-in-jar="/" />
+      <element id="extracted-dir" path="$MAVEN_REPOSITORY$/cn/hutool/hutool-all/5.6.0/hutool-all-5.6.0.jar" path-in-jar="/" />
+      <element id="library" level="project" name="Maven: com.googlecode.concurrentlinkedhashmap:concurrentlinkedhashmap-lru:1.1" />
+      <element id="extracted-dir" path="$MAVEN_REPOSITORY$/com/google/code/gson/gson/2.10.1/gson-2.10.1.jar" path-in-jar="/" />
+      <element id="library" level="project" name="Maven: org.openjfx:javafx-controls:21-ea+17" />
+      <element id="extracted-dir" path="$MAVEN_REPOSITORY$/dev/3-3/jmccc-mcdownloader/3.1.4/jmccc-mcdownloader-3.1.4.jar" path-in-jar="/" />
+      <element id="extracted-dir" path="$MAVEN_REPOSITORY$/org/ehcache/sizeof/0.4.3/sizeof-0.4.3.jar" path-in-jar="/" />
+      <element id="library" level="project" name="Maven: org.mortbay.jetty:jetty-util:6.1.22" />
+      <element id="extracted-dir" path="$MAVEN_REPOSITORY$/antlr/antlr/2.7.7/antlr-2.7.7.jar" path-in-jar="/" />
+      <element id="extracted-dir" path="$MAVEN_REPOSITORY$/io/github/mkpaz/atlantafx-base/2.0.0/atlantafx-base-2.0.0.jar" path-in-jar="/" />
+      <element id="extracted-dir" path="$MAVEN_REPOSITORY$/dev/3-3/jmccc-mojang-api/3.1.4/jmccc-mojang-api-3.1.4.jar" path-in-jar="/" />
+      <element id="library" level="project" name="Maven: org.glassfish.jaxb:jaxb-runtime:3.0.0-M5" />
+      <element id="library" level="project" name="Maven: commons-cli:commons-cli:1.1" />
+      <element id="library" level="project" name="Maven: org.openjfx:javafx-fxml:21-ea+17" />
+      <element id="library" level="project" name="Maven: org.glassfish.jaxb:txw2:3.0.0-M5" />
+      <element id="library" level="project" name="Maven: com.github.stephenc.high-scale-lib:high-scale-lib:1.1.2" />
+      <element id="extracted-dir" path="$MAVEN_REPOSITORY$/net/java/dev/jna/jna-platform/5.10.0/jna-platform-5.10.0.jar" path-in-jar="/" />
     </root>
   </artifact>
 </component>

+ 6 - 0
.idea/git_toolbox_blame.xml

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="GitToolBoxBlameSettings">
+    <option name="version" value="2" />
+  </component>
+</project>

+ 2 - 1
.idea/misc.xml

@@ -7,8 +7,9 @@
         <option value="$PROJECT_DIR$/pom.xml" />
       </list>
     </option>
+    <option name="workspaceImportForciblyTurnedOn" value="true" />
   </component>
-  <component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="zulu-17" project-jdk-type="JavaSDK">
+  <component name="ProjectRootManager" version="2" languageLevel="JDK_17" project-jdk-name="zulu-17" project-jdk-type="JavaSDK">
     <output url="file://$PROJECT_DIR$/out" />
   </component>
 </project>

+ 0 - 0
SNGL/sngl.json


+ 5 - 42
pom.xml

@@ -53,46 +53,6 @@
             <artifactId>hutool-all</artifactId>
             <version>5.6.0</version>
         </dependency>
-        <dependency>
-            <groupId>org.ehcache</groupId>
-            <artifactId>ehcache</artifactId>
-            <version>3.10.0</version>
-        </dependency>
-        <!-- https://mvnrepository.com/artifact/org.apache.httpcomponents/httpcore -->
-        <dependency>
-            <groupId>org.apache.httpcomponents</groupId>
-            <artifactId>httpcore</artifactId>
-            <version>4.4.16</version>
-        </dependency>
-        <!-- https://mvnrepository.com/artifact/org.apache.httpcomponents.client5/httpclient5 -->
-        <dependency>
-            <groupId>org.apache.httpcomponents.client5</groupId>
-            <artifactId>httpclient5</artifactId>
-            <version>5.2.1</version>
-        </dependency>
-        <!-- https://mvnrepository.com/artifact/org.apache.httpcomponents/httpcore-nio -->
-        <dependency>
-            <groupId>org.apache.httpcomponents</groupId>
-            <artifactId>httpcore-nio</artifactId>
-            <version>4.4.16</version>
-        </dependency>
-        <dependency>
-            <groupId> org.apache.cassandra</groupId>
-            <artifactId>cassandra-all</artifactId>
-            <version>0.8.1</version>
-
-            <exclusions>
-                <exclusion>
-                    <groupId>org.slf4j</groupId>
-                    <artifactId>slf4j-log4j12</artifactId>
-                </exclusion>
-                <exclusion>
-                    <groupId>log4j</groupId>
-                    <artifactId>log4j</artifactId>
-                </exclusion>
-            </exclusions>
-
-        </dependency>
         <dependency>
             <groupId>dev.3-3</groupId>
             <artifactId>jmccc</artifactId>
@@ -118,8 +78,11 @@
             <artifactId>jmccc-mcdownloader</artifactId>
             <version>3.1.4</version>
         </dependency>
-
-
+        <dependency>
+            <groupId>com.google.code.gson</groupId>
+            <artifactId>gson</artifactId>
+            <version>2.10.1</version> <!-- 使用最新版本 -->
+        </dependency>
     </dependencies>
 
     <build>

+ 16 - 0
readme.md

@@ -0,0 +1,16 @@
+## SNGL 一款基于Java开发的全平台启动器
+### 特点:全平台、轻量级、调试优化
+### 已完成功能:
+* 离线登陆
+* 日志收集
+* 启动内存设置
+* 分辨率控制
+* 游戏目录设置
+* Java目录设置
+* 版本切换
+---
+### 待完成功能:
+* 微软登陆&统一通行证登陆
+* 服务器快速进入
+* mod管理
+* 启动器配置

+ 83 - 0
src/main/java/com/snowchen/snglfx17/AppCore/ConfigCore.java

@@ -0,0 +1,83 @@
+package com.snowchen.snglfx17.AppCore;
+
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
+import java.io.FileWriter;
+import java.io.IOException;
+import com.snowchen.snglfx17.AppCore.*;
+
+public class ConfigCore {
+    public class CreateDirectory{
+        /**
+         * 检查指定名称的目录是否在根目录下存在,如果不存在则创建它。
+         *
+         * @param directoryName 要检查的目录名称
+         */
+        public static void createDirectoryIfNotExists(String directoryName) {
+            // 获取程序根目录的路径
+            Path rootPath = Paths.get("");
+
+            // 构建要检查的目录的完整路径
+            Path directoryPath = rootPath.resolve(directoryName);
+
+            // 检查目录是否存在
+            if (!Files.exists(directoryPath)) {
+                try {
+                    // 如果目录不存在,则创建它
+                    Files.createDirectories(directoryPath);
+                    System.out.println("目录 " + directoryName + " 已成功创建在根目录下。");
+                } catch (IOException e) {
+                    // 处理创建目录时可能出现的异常
+                    System.err.println("创建目录时发生错误: " + e.getMessage());
+                }
+            } else {
+                System.out.println("目录 " + directoryName + " 已经存在于根目录下。");
+            }
+        }
+
+    }
+    public class CreateConfig{
+        /**
+         * 检查指定目录下是否存在特定文件,如果不存在则创建它。
+         *
+         * @param directoryPath 目录路径
+         * @param fileName      文件名
+         * @return 是否创建了文件
+         */
+        public static boolean checkAndCreateFile(String directoryPath, String fileName) {
+            // 拼接完整的文件路径
+            Path filePath = Paths.get(directoryPath, fileName);
+
+            // 检查文件是否存在
+            if (!Files.exists(filePath)) {
+                // 文件不存在,尝试创建父目录并创建文件
+                try {
+                    // 创建父目录(如果它不存在)
+                    Path directory = Paths.get(directoryPath);
+                    if (!Files.exists(directory)) {
+                        Files.createDirectories(directory);
+                    }
+
+                    // 创建空的文件
+                    Files.createFile(filePath);
+                    return true; // 返回true表示文件已创建
+                } catch (IOException e) {
+                    System.err.println("创建文件时发生错误: " + e.getMessage());
+                    return false; // 返回false表示文件创建失败
+                }
+            }
+            return false; // 如果文件已存在,返回false
+        }
+    }
+    public  class SaveData{
+
+    }
+
+}
+
+
+

+ 22 - 67
src/main/java/com/snowchen/snglfx17/AppCore/DownloadCore.java

@@ -8,110 +8,65 @@ import org.to2mbn.jmccc.mcdownloader.download.tasks.DownloadTask;
 import org.to2mbn.jmccc.mcdownloader.download.concurrent.CallbackAdapter;
 import org.to2mbn.jmccc.option.MinecraftDirectory;
 import org.to2mbn.jmccc.version.Version;
-import org.to2mbn.jmccc.mcdownloader.provider.DefaultLayoutProvider;
-import com.snowchen.snglfx17.AppCore.LaunchCore;
 
-public class DownloadCore {
-    public class BmclApiProvider extends DefaultLayoutProvider {
-    //新增BangBang93API
-        @Override
-        protected String getLibraryBaseURL() {
-            return "http://bmclapi2.bangbang93.com/libraries/";
-        }
-
-        @Override
-        protected String getVersionBaseURL() {
-            return "http://bmclapi2.bangbang93.com/versions/";
-        }
-
-        @Override
-        protected String getAssetIndexBaseURL() {
-            return "http://bmclapi2.bangbang93.com/indexes/";
-        }
-
-        @Override
-        protected String getVersionListURL() {
-            return "http://bmclapi2.bangbang93.com/mc/game/version_manifest.json";
-        }
-
-        @Override
-        protected String getAssetBaseURL() {
-            return "http://bmclapi2.bangbang93.com/assets/";
-        }
 
-    }
+public class DownloadCore {
 
     public static void DownloadMinecraftVersion() {
-        // 下载位置(要下载到的.minecraft目录)
-        MinecraftDirectory dir = new MinecraftDirectory(LaunchCore.Game_Directory+"/versions");
-
-        // 创建MinecraftDownloader
-        MinecraftDownloader downloader = MinecraftDownloaderBuilder.create().build();
-
-        // 下载Minecraft1.x
-        downloader.downloadIncrementally(dir, "1.20.1", new CallbackAdapter<Version>() {
+        MinecraftDirectory dir = new MinecraftDirectory("/.minecraft");
+        MinecraftDownloader downloader = MinecraftDownloaderBuilder.buildDefault();
+        downloader.downloadIncrementally(dir, "1.20.4", new CallbackAdapter<Version>() {
 
             @Override
-            public void done(Version result) {
-                // 当完成时调用
-                // 参数代表实际下载到的Minecraft版本
-                System.out.printf("下载完成,下载到的Minecraft版本:%s%n", result);
+            public void failed(Throwable e) {
+                // when the task fails
             }
 
             @Override
-            public void failed(Throwable e) {
-                // 当失败时调用
-                // 参数代表是由于哪个异常而失败的
-                System.out.printf("下载失败%n");
-                e.printStackTrace();
+            public void done(Version result) {
+                // when the task finishes
             }
 
             @Override
             public void cancelled() {
-                // 当被取消时调用
-                System.out.printf("下载取消%n");
+                // when the task cancels
             }
 
             @Override
             public <R> DownloadCallback<R> taskStart(DownloadTask<R> task) {
-                // 当有一个下载任务被派生出来时调用
-                // 在这里返回一个DownloadCallback就可以监听该下载任务的状态
-                System.out.printf("开始下载:%s%n", task.getURI());
+                // when a new sub download task starts
+                // return a DownloadCallback to listen the status of the task
                 return new CallbackAdapter<R>() {
 
                     @Override
                     public void done(R result) {
-                        // 当这个DownloadTask完成时调用
-                        System.out.printf("子任务完成:%s%n", task.getURI());
+                        // when the sub download task finishes
                     }
 
                     @Override
                     public void failed(Throwable e) {
-                        // 当这个DownloadTask失败时调用
-                        System.out.printf("子任务失败:%s。原因:%s%n", task.getURI(), e);
+                        // when the sub download task fails
                     }
 
                     @Override
                     public void cancelled() {
-                        // 当这个DownloadTask被取消时调用
-                        System.out.printf("子任务取消:%s%n", task.getURI());
+                        // when the sub download task cancels
+                    }
+
+                    @Override
+                    public void updateProgress(long done, long total) {
+                        // when the progress of the sub download task has updated
                     }
 
                     @Override
                     public void retry(Throwable e, int current, int max) {
-                        // 当这个DownloadTask因出错而重试时调用
-                        // 重试不代表着失败
-                        // 也就是说,一个DownloadTask可以重试若干次,
-                        // 每次决定要进行一次重试时就会调用这个方法
-                        // 当最后一次重试失败,这个任务也将失败了,failed()才会被调用
-                        // 所以调用顺序就是这样:
-                        // retry()->retry()->...->failed()
-                        System.out.printf("子任务重试[%d/%d]:%s。原因:%s%n", current, max, task.getURI(), e);
+                        // when the sub download task fails, and the downloader decides to retry the task
+                        // in this case, failed() won't be called
                     }
                 };
             }
         });
-
+        downloader.shutdown();
     }
     public static void DownloadRemoteVersionList(){
         MinecraftDownloader downloader = MinecraftDownloaderBuilder

+ 3 - 1
src/main/java/com/snowchen/snglfx17/AppCore/LaunchCore.java

@@ -33,7 +33,9 @@ public class LaunchCore {
                 .nativeFastCheck(true) //是否开启快速检查Natives文件
                 .build(); //构建Laucher对象
         try {
-             option = new LaunchOption(Game_Version, MicrosoftAuthenticator.login(it -> System.out.println(it.message)),
+             //option = new LaunchOption(Game_Version, MicrosoftAuthenticator.login(it -> System.out.println(it.message)),
+                    //new MinecraftDirectory(Game_Directory));//启动指令
+            option = new LaunchOption(Game_Version, new OfflineAuthenticator(Player_Name),
                     new MinecraftDirectory(Game_Directory));//启动指令
             GameOption();//启动设置
             launcher.launch(option, new ProcessListener()

+ 6 - 1
src/main/java/com/snowchen/snglfx17/HelloApplication.java

@@ -8,11 +8,16 @@ import javafx.scene.Scene;
 import javafx.stage.Stage;
 import java.io.IOException;
 import java.time.LocalTime;
-
+import javafx.scene.image.Image;
 
 public class HelloApplication extends Application {
     @Override
     public void start(Stage stage) throws IOException {
+        // 加载图标
+        Image icon = new Image(getClass().getResourceAsStream("/icons/icon.png"));
+
+        // 设置窗口图标
+        stage.getIcons().add(icon);
         LocalTime now = LocalTime.now();
         LocalTime sevenPm = LocalTime.of(19, 0); // 晚上7点
         LocalTime sixAm = LocalTime.of(6, 0); // 早上6点

+ 17 - 0
src/main/java/com/snowchen/snglfx17/HelloController.java

@@ -1,6 +1,7 @@
 package com.snowchen.snglfx17;
 
 import cn.hutool.system.oshi.OshiUtil;
+import com.snowchen.snglfx17.AppCore.ConfigCore;
 import com.snowchen.snglfx17.AppCore.DownloadCore;
 import com.snowchen.snglfx17.AppCore.LaunchCore;
 import javafx.application.Platform;
@@ -30,6 +31,17 @@ public class HelloController {
         InitializeVersionChoice();
         InitializeMaxMem();
         SetMaxMemListen();
+        String directoryName = "SNGL";
+        String directoryPath = "SNGL";
+        String fileName = "sngl.json";
+        ConfigCore.CreateDirectory.createDirectoryIfNotExists(directoryName);
+        directoryName = ".minecraft";
+        ConfigCore.CreateDirectory.createDirectoryIfNotExists(directoryName);
+        if (ConfigCore.CreateConfig.checkAndCreateFile(directoryPath, fileName)) {
+            System.out.println("文件 " + fileName + " 已创建在 " + directoryPath + " 目录下");
+        } else {
+            System.out.println("文件 " + fileName + " 已存在于 " + directoryPath + " 目录下");
+        }
 
     }
     private void showAlert(String message) {
@@ -203,6 +215,9 @@ public class HelloController {
         } else {
             System.out.println("其他操作系统");
         }
+    }
+    private void DataSave(){
+
     }
     @FXML
     protected void TestDownload(){
@@ -247,6 +262,8 @@ public class HelloController {
     @FXML
     private Label JavaVersion;
 
+    @FXML
+    private Button ManualSave;
 
 
 

+ 0 - 30
src/main/java/com/snowchen/snglfx17/PopupController.java

@@ -1,30 +0,0 @@
-package com.snowchen.snglfx17;
-
-import javafx.fxml.FXML;
-import javafx.scene.control.Button;
-import javafx.scene.text.Text;
-import javafx.stage.Stage;
-
-import java.awt.event.ActionEvent;
-
-public class PopupController {
-    @FXML
-    private Button CloseButton;
-
-    @FXML
-    private Text TheText;
-
-    @FXML
-    private void initialize() {
-        // 设置Text控件的文字
-        TheText.setText("这是要显示的文字");
-    }
-    @FXML
-    public void HandleClose(javafx.event.ActionEvent actionEvent) {
-        // 获取当前窗口的Stage实例
-        Stage stage = (Stage) CloseButton.getScene().getWindow();
-
-        // 关闭窗口
-        stage.close();
-    }
-}

+ 1 - 0
src/main/java/module-info.java

@@ -9,6 +9,7 @@ module com.snowchen.snglfx17 {
     requires jmccc.microsoft.authenticator;
     requires jmccc.mcdownloader;
     requires jmccc.yggdrasil.authenticator;
+    requires com.google.gson;
 
 
     opens com.snowchen.snglfx17 to javafx.fxml;

+ 42 - 3
src/main/resources/com/snowchen/snglfx17/hello-view.fxml

@@ -13,6 +13,8 @@
 <?import javafx.scene.control.TabPane?>
 <?import javafx.scene.control.TextArea?>
 <?import javafx.scene.control.TextField?>
+<?import javafx.scene.image.Image?>
+<?import javafx.scene.image.ImageView?>
 <?import javafx.scene.layout.AnchorPane?>
 <?import javafx.scene.text.Font?>
 <?import javafx.scene.text.Text?>
@@ -52,9 +54,9 @@
                               <Font name="164-SSJianZhengTi" size="18.0" />
                            </font>
                         </CheckBox>
-                        <Text layoutX="14.0" layoutY="401.0" strokeType="OUTSIDE" strokeWidth="0.0" text="SNGL Ver 0.2 .1 Alpha" wrappingWidth="182.0791015625" AnchorPane.bottomAnchor="6.046875" AnchorPane.leftAnchor="13.5" AnchorPane.rightAnchor="478.9208984375" AnchorPane.topAnchor="387.5" />
+                        <Text layoutX="14.0" layoutY="401.0" strokeType="OUTSIDE" strokeWidth="0.0" text="SNGL Ver 0.3 Alpha" wrappingWidth="182.0791015625" AnchorPane.bottomAnchor="6.046875" AnchorPane.leftAnchor="13.5" AnchorPane.rightAnchor="478.9208984375" AnchorPane.topAnchor="387.5" />
                         <Hyperlink layoutX="529.0" layoutY="384.0" prefHeight="25.0" prefWidth="134.0" text="Powered by JMCCC" textAlignment="RIGHT" AnchorPane.bottomAnchor="1.0" AnchorPane.leftAnchor="529.0" AnchorPane.rightAnchor="12.0" AnchorPane.topAnchor="384.0" />
-                        <TextArea fx:id="LogArea" editable="false" layoutX="12.0" layoutY="11.0" prefHeight="374.0" prefWidth="420.0" promptText="Launcher Version:SNGL Ver0.2.1 Alpha" wrapText="true" AnchorPane.bottomAnchor="25.0" AnchorPane.leftAnchor="12.0" AnchorPane.rightAnchor="243.0" AnchorPane.topAnchor="11.0">
+                        <TextArea fx:id="LogArea" editable="false" layoutX="12.0" layoutY="11.0" prefHeight="374.0" prefWidth="420.0" promptText="Launcher Version:SNGL Ver0.3 Alpha" wrapText="true" AnchorPane.bottomAnchor="25.0" AnchorPane.leftAnchor="12.0" AnchorPane.rightAnchor="243.0" AnchorPane.topAnchor="11.0">
                            <font>
                               <Font name="Consolas" size="13.0" />
                            </font></TextArea>
@@ -130,6 +132,11 @@
                               <Font size="16.0" />
                            </font>
                         </Label>
+                        <Button fx:id="ManualSave" layoutX="440.0" layoutY="199.0" mnemonicParsing="false" prefHeight="36.0" prefWidth="87.0" text="手动保存">
+                           <font>
+                              <Font name="164-SSJianZhengTi" size="16.0" />
+                           </font>
+                        </Button>
                      </children></AnchorPane>
               </content>
             </Tab>
@@ -173,7 +180,39 @@
             </Tab>
             <Tab text="关于">
                <content>
-                  <AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="180.0" prefWidth="200.0" />
+                  <AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="180.0" prefWidth="200.0">
+                     <children>
+                        <Text layoutX="206.0" layoutY="243.0" strokeType="OUTSIDE" strokeWidth="0.0" text="一款基于Java的开源启动器" textAlignment="CENTER" wrappingWidth="262.6748046875">
+                           <font>
+                              <Font size="18.0" />
+                           </font>
+                        </Text>
+                        <Text layoutX="221.0" layoutY="266.0" strokeType="OUTSIDE" strokeWidth="0.0" text="没有多余的功能,简单而纯粹" textAlignment="CENTER">
+                           <font>
+                              <Font size="18.0" />
+                           </font>
+                        </Text>
+                        <ImageView fitHeight="204.0" fitWidth="372.0" layoutX="156.0" layoutY="21.0" pickOnBounds="true" preserveRatio="true">
+                           <image>
+                              <Image url="@../../../icons/title.png" />
+                           </image>
+                        </ImageView>
+                        <Text fill="#486282" layoutX="257.0" layoutY="288.0" strokeType="OUTSIDE" strokeWidth="0.0" text="当前版本:0.3 Alpha" textAlignment="CENTER">
+                           <font>
+                              <Font size="18.0" />
+                           </font>
+                        </Text>
+                        <Hyperlink layoutX="221.0" layoutY="293.0" text="开源地址:Gitea">
+                           <font>
+                              <Font size="18.0" />
+                           </font>
+                        </Hyperlink>
+                        <Hyperlink layoutX="366.0" layoutY="293.0" text="By--Snow">
+                           <font>
+                              <Font size="18.0" />
+                           </font>
+                        </Hyperlink>
+                     </children></AnchorPane>
                </content>
             </Tab>
         </tabs>

+ 0 - 21
src/main/resources/com/snowchen/snglfx17/popup-view.fxml

@@ -1,21 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<?import javafx.scene.control.Button?>
-<?import javafx.scene.layout.AnchorPane?>
-<?import javafx.scene.text.Font?>
-<?import javafx.scene.text.Text?>
-
-<AnchorPane prefHeight="175.0" prefWidth="275.0" xmlns="http://javafx.com/javafx/21" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.snowchen.snglfx17.PopupController">
-   <children>
-      <Text fx:id="TheText" layoutX="7.0" layoutY="46.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Text" textAlignment="CENTER" wrappingWidth="259.9780316352844">
-         <font>
-            <Font name="164-SSJianZhengTi" size="20.0" />
-         </font>
-      </Text>
-      <Button fx:id="CloseButton" alignment="CENTER" contentDisplay="CENTER" layoutX="100.0" layoutY="125.0" minHeight="-Infinity" minWidth="-Infinity" mnemonicParsing="false" onAction="#HandleClose" prefHeight="29.0" prefWidth="82.0" text="确定">
-         <font>
-            <Font size="11.0" />
-         </font>
-      </Button>
-   </children>
-</AnchorPane>

BIN
src/main/resources/icons/icon.png


BIN
src/main/resources/icons/title.png