mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-12-23 09:01:08 +03:00
Перевод конфигов на Json часть 5
Правки рантайма Комплируется, пока не работает
This commit is contained in:
parent
123250246c
commit
2c06cdec24
2 changed files with 13 additions and 16 deletions
|
@ -1,6 +1,7 @@
|
||||||
package ru.gravit.launchserver;
|
package ru.gravit.launchserver;
|
||||||
|
|
||||||
import com.google.gson.GsonBuilder;
|
import com.google.gson.GsonBuilder;
|
||||||
|
import com.google.gson.annotations.Expose;
|
||||||
import ru.gravit.launcher.Launcher;
|
import ru.gravit.launcher.Launcher;
|
||||||
import ru.gravit.launcher.LauncherConfig;
|
import ru.gravit.launcher.LauncherConfig;
|
||||||
import ru.gravit.launcher.hasher.HashedDir;
|
import ru.gravit.launcher.hasher.HashedDir;
|
||||||
|
@ -89,7 +90,9 @@ public static final class Config {
|
||||||
|
|
||||||
public String[] mirrors;
|
public String[] mirrors;
|
||||||
public String binaryName;
|
public String binaryName;
|
||||||
|
@Expose
|
||||||
private String address;
|
private String address;
|
||||||
|
@Expose
|
||||||
private String bindAddress;
|
private String bindAddress;
|
||||||
public LauncherConfig.LauncherEnvironment env;
|
public LauncherConfig.LauncherEnvironment env;
|
||||||
public boolean isWarningMissArchJava;
|
public boolean isWarningMissArchJava;
|
||||||
|
@ -301,6 +304,7 @@ public LaunchServer(Path dir) throws IOException, InvalidKeySpecException {
|
||||||
modulesManager.autoload(dir.resolve("modules"));
|
modulesManager.autoload(dir.resolve("modules"));
|
||||||
modulesManager.preInitModules();
|
modulesManager.preInitModules();
|
||||||
initGson();
|
initGson();
|
||||||
|
LogHelper.setStacktraceEnabled(true);
|
||||||
|
|
||||||
// Read LaunchServer config
|
// Read LaunchServer config
|
||||||
generateConfigIfNotExists();
|
generateConfigIfNotExists();
|
||||||
|
@ -356,6 +360,7 @@ public static void initGson()
|
||||||
{
|
{
|
||||||
if(Launcher.gson != null) return;
|
if(Launcher.gson != null) return;
|
||||||
Launcher.gsonBuilder = new GsonBuilder();
|
Launcher.gsonBuilder = new GsonBuilder();
|
||||||
|
Launcher.gsonBuilder.setPrettyPrinting();
|
||||||
Launcher.gson = Launcher.gsonBuilder.create();
|
Launcher.gson = Launcher.gsonBuilder.create();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -402,10 +407,14 @@ private void generateConfigIfNotExists() throws IOException {
|
||||||
|
|
||||||
// Create new config
|
// Create new config
|
||||||
LogHelper.info("Creating LaunchServer config");
|
LogHelper.info("Creating LaunchServer config");
|
||||||
Config newConfig;
|
Config newConfig = new Config();
|
||||||
try (BufferedReader reader = IOHelper.newReader(IOHelper.getResourceURL("ru/gravit/launchserver/defaults/config.cfg"))) {
|
newConfig.mirrors = new String[]{"http://mirror.gravitlauncher.ml"};
|
||||||
newConfig = Launcher.gson.fromJson(reader,Config.class);
|
newConfig.launch4j = new ExeConf();
|
||||||
}
|
newConfig.buildPostTransform = new PostBuildTransformConf();
|
||||||
|
newConfig.env = LauncherConfig.LauncherEnvironment.STD;
|
||||||
|
//try (BufferedReader reader = IOHelper.newReader(IOHelper.getResourceURL("ru/gravit/launchserver/defaults/config.cfg"))) {
|
||||||
|
// newConfig = Launcher.gson.fromJson(reader,Config.class);
|
||||||
|
//}
|
||||||
|
|
||||||
// Set server address
|
// Set server address
|
||||||
LogHelper.println("LaunchServer address: ");
|
LogHelper.println("LaunchServer address: ");
|
||||||
|
|
|
@ -45,18 +45,6 @@ var SignedBytesHolder = SignedBytesHolderClass.static;
|
||||||
var SignedObjectHolder = SignedObjectHolderClass.static;
|
var SignedObjectHolder = SignedObjectHolderClass.static;
|
||||||
var EnumSerializer = EnumSerializerClass.static;
|
var EnumSerializer = EnumSerializerClass.static;
|
||||||
|
|
||||||
// Config serialization class bindings
|
|
||||||
var ConfigObject = ConfigObjectClass.static;
|
|
||||||
var ConfigObjectAdapter = ConfigObjectAdapterClass.static;
|
|
||||||
var BlockConfigEntry = BlockConfigEntryClass.static;
|
|
||||||
var BooleanConfigEntry = BooleanConfigEntryClass.static;
|
|
||||||
var IntegerConfigEntry = IntegerConfigEntryClass.static;
|
|
||||||
var ListConfigEntry = ListConfigEntryClass.static;
|
|
||||||
var StringConfigEntry = StringConfigEntryClass.static;
|
|
||||||
var ConfigEntryType = ConfigEntryTypeClass.static;
|
|
||||||
var TextConfigReader = TextConfigReaderClass.static;
|
|
||||||
var TextConfigWriter = TextConfigWriterClass.static;
|
|
||||||
|
|
||||||
// Helper class API imports
|
// Helper class API imports
|
||||||
var CommonHelper = CommonHelperClass.static;
|
var CommonHelper = CommonHelperClass.static;
|
||||||
var IOHelper = IOHelperClass.static;
|
var IOHelper = IOHelperClass.static;
|
||||||
|
|
Loading…
Reference in a new issue