[ANY] Переименование JAConfigurator

This commit is contained in:
Gravit 2019-08-28 17:12:03 +07:00
parent 0920fe18f4
commit 79a2881089
No known key found for this signature in database
GPG key ID: 061981E1E85D3216
4 changed files with 22 additions and 22 deletions

View file

@ -13,12 +13,12 @@
public class BuildContext {
public final ZipOutputStream output;
public final JAConfigurator config;
public final LauncherConfigurator config;
public final MainBuildTask data;
public final HashSet<String> fileList;
public BuildContext(ZipOutputStream output, JAConfigurator config, MainBuildTask data) {
public BuildContext(ZipOutputStream output, LauncherConfigurator config, MainBuildTask data) {
this.output = output;
this.config = config;
this.data = data;

View file

@ -24,7 +24,7 @@
import pro.gravit.launchserver.asm.ClassMetadataReader;
import pro.gravit.launchserver.asm.SafeClassWriter;
public class JAConfigurator {
public class LauncherConfigurator {
private static final String modulesManagerName = "pro/gravit/launcher/modules/LauncherModulesManager";
private static final String launcherName = "pro/gravit/launcher/LauncherEngine";
private static final String modulesManagerDesc = "Lpro/gravit/launcher/client/ClientModulesManager;";
@ -35,7 +35,7 @@ public class JAConfigurator {
private final MethodNode constructor;
private final MethodNode initModuleMethod;
public JAConfigurator(ClassNode configclass) {
public LauncherConfigurator(ClassNode configclass) {
this.configclass = configclass;
constructor = configclass.methods.stream().filter(e -> "<init>".equals(e.name)).findFirst().get();
constructor.instructions = new InsnList();

View file

@ -26,7 +26,7 @@
import pro.gravit.launchserver.LaunchServer;
import pro.gravit.launchserver.asm.ClassMetadataReader;
import pro.gravit.launchserver.binary.BuildContext;
import pro.gravit.launchserver.binary.JAConfigurator;
import pro.gravit.launchserver.binary.LauncherConfigurator;
import pro.gravit.utils.helper.IOHelper;
import pro.gravit.utils.helper.LogHelper;
import pro.gravit.utils.helper.SecurityHelper;
@ -119,23 +119,23 @@ public Path process(Path inputJar) throws IOException {
try (ZipOutputStream output = new ZipOutputStream(IOHelper.newOutput(outputJar))) {
ClassNode cn = new ClassNode();
new ClassReader(IOHelper.getResourceBytes(AutogenConfig.class.getName().replace('.', '/').concat(".class"))).accept(cn, 0);
JAConfigurator jaConfigurator = new JAConfigurator(cn);
BuildContext context = new BuildContext(output, jaConfigurator, this);
LauncherConfigurator launcherConfigurator = new LauncherConfigurator(cn);
BuildContext context = new BuildContext(output, launcherConfigurator, this);
server.buildHookManager.hook(context);
jaConfigurator.setAddress(server.config.netty.address);
launcherConfigurator.setAddress(server.config.netty.address);
if (server.config.guardLicense != null)
jaConfigurator.setGuardLicense(server.config.guardLicense.name, server.config.guardLicense.key, server.config.guardLicense.encryptKey);
launcherConfigurator.setGuardLicense(server.config.guardLicense.name, server.config.guardLicense.key, server.config.guardLicense.encryptKey);
else
jaConfigurator.nullGuardLicense();
jaConfigurator.setProjectName(server.config.projectName);
jaConfigurator.setSecretKey(SecurityHelper.randomStringAESKey());
jaConfigurator.setClientPort(32148 + SecurityHelper.newRandom().nextInt(512));
jaConfigurator.setGuardType(server.config.launcher.guardType);
jaConfigurator.setWarningMissArchJava(server.config.launcher.warningMissArchJava);
jaConfigurator.setEnv(server.config.env);
launcherConfigurator.nullGuardLicense();
launcherConfigurator.setProjectName(server.config.projectName);
launcherConfigurator.setSecretKey(SecurityHelper.randomStringAESKey());
launcherConfigurator.setClientPort(32148 + SecurityHelper.newRandom().nextInt(512));
launcherConfigurator.setGuardType(server.config.launcher.guardType);
launcherConfigurator.setWarningMissArchJava(server.config.launcher.warningMissArchJava);
launcherConfigurator.setEnv(server.config.env);
if (server.runtime.oemUnlockKey == null) server.runtime.oemUnlockKey = SecurityHelper.randomStringToken();
jaConfigurator.setOemUnlockKey(server.runtime.oemUnlockKey);
server.buildHookManager.registerAllClientModuleClass(jaConfigurator);
launcherConfigurator.setOemUnlockKey(server.runtime.oemUnlockKey);
server.buildHookManager.registerAllClientModuleClass(launcherConfigurator);
reader.getCp().add(new JarFile(inputJar.toFile()));
server.launcherBinary.coreLibs.forEach(e -> {
try {
@ -144,7 +144,7 @@ public Path process(Path inputJar) throws IOException {
LogHelper.error(e1);
}
});
String zPath = jaConfigurator.getZipEntryPath();
String zPath = launcherConfigurator.getZipEntryPath();
try (ZipInputStream input = new ZipInputStream(IOHelper.newInput(inputJar))) {
ZipEntry e = input.getNextEntry();
while (e != null) {
@ -203,7 +203,7 @@ public Path process(Path inputJar) throws IOException {
output.write(launcherConfigBytes);
ZipEntry e = newZipEntry(zPath);
output.putNextEntry(e);
output.write(jaConfigurator.getBytecode(reader));
output.write(launcherConfigurator.getBytecode(reader));
}
reader.close();
return outputJar;

View file

@ -7,7 +7,7 @@
import pro.gravit.launcher.AutogenConfig;
import pro.gravit.launchserver.binary.BuildContext;
import pro.gravit.launchserver.binary.JAConfigurator;
import pro.gravit.launchserver.binary.LauncherConfigurator;
import pro.gravit.launchserver.binary.tasks.MainBuildTask;
public class BuildHookManager {
@ -75,7 +75,7 @@ public void hook(BuildContext context) {
for (BuildHook hook : HOOKS) hook.build(context);
}
public void registerAllClientModuleClass(JAConfigurator cfg) {
public void registerAllClientModuleClass(LauncherConfigurator cfg) {
for (String clazz : MODULE_CLASS) cfg.addModuleClass(clazz);
}