配置写入文件

This commit is contained in:
雪风 2025-03-12 15:46:07 +08:00
parent 92f4e04cd0
commit 7c14e8b8c6
1 changed files with 6 additions and 7 deletions

View File

@ -1048,7 +1048,8 @@ public class 特殊控制台 extends JFrame {
fileReader = new FileReader(property + "\\配置文件\\战力显示.ini");
String result4 = fileReader.readString();
JSONObject jsonObject2 = JSONObject.parseObject(result4);
Start.zlConfigs = jsonObject2 .getJSONArray("zl").toJavaList(ZLConfig.class).stream().sorted(Comparator.comparing(ZLConfig::getNum)).collect(Collectors.toList());
JSONArray zl = jsonObject2.getJSONArray("zl");
Start.zlConfigs = zl .toJavaList(ZLConfig.class).stream().sorted(Comparator.comparing(ZLConfig::getNum)).collect(Collectors.toList());
}catch (Exception e){
e.printStackTrace();
@ -1076,18 +1077,16 @@ public class 特殊控制台 extends JFrame {
jsonObject1.put("bskg", Start.bskg);
jsonObject1.put("bsitem", Start.bsConfig);
String jsonString1 = jsonObject1.toJSONString();
fileWriter = new FileWriter(property + "\\配置文件\\多倍爆率.ini");
fileWriter = new FileWriter(new File(property + "\\配置文件\\多倍爆率.ini"));
fileWriter.write(jsonString1);
JSONObject jsonObject2 = new JSONObject();
List<ZLConfig> sortedZlConfigs = Start.zlConfigs.stream()
.sorted(Comparator.comparing(ZLConfig::getNum))
.collect(Collectors.toList());
jsonObject2.put("zl", new JSONArray(Collections.singletonList(sortedZlConfigs)));
jsonObject2.put("zl", Start.zlConfigs);
String jsonString2 = jsonObject2.toJSONString();
fileWriter = new FileWriter(property + "\\配置文件\\战力显示.ini");
fileWriter = new FileWriter(new File(property + "\\配置文件\\战力显示.ini"));
fileWriter.write(jsonString2);