[FIX] Фикс ClientLauncher.main

This commit is contained in:
Gravit 2019-02-20 18:44:30 +07:00
parent 66f773a8ce
commit 5d77b9c53a
No known key found for this signature in database
GPG key ID: 061981E1E85D3216

View file

@ -411,7 +411,7 @@ public static void main(String... args) throws Throwable {
LogHelper.debug("Reading ClientLauncher params"); LogHelper.debug("Reading ClientLauncher params");
Params params; Params params;
ClientProfile profile; ClientProfile profile;
SignedObjectHolder<HashedDir> assetHDir, clientHDir; HashedDir assetHDir, clientHDir;
RSAPublicKey publicKey = Launcher.getConfig().publicKey; RSAPublicKey publicKey = Launcher.getConfig().publicKey;
try { try {
try (Socket socket = IOHelper.newSocket()) { try (Socket socket = IOHelper.newSocket()) {
@ -421,8 +421,8 @@ public static void main(String... args) throws Throwable {
profile = gson.fromJson(input.readString(0), ClientProfile.class); profile = gson.fromJson(input.readString(0), ClientProfile.class);
// Read hdirs // Read hdirs
assetHDir = new SignedObjectHolder<>(input, publicKey, HashedDir::new); assetHDir = new HashedDir(input);
clientHDir = new SignedObjectHolder<>(input, publicKey, HashedDir::new); clientHDir = new HashedDir(input);
} }
} }
} catch (IOException ex) { } catch (IOException ex) {
@ -457,18 +457,17 @@ public static void main(String... args) throws Throwable {
LogHelper.debug("Starting JVM and client WatchService"); LogHelper.debug("Starting JVM and client WatchService");
FileNameMatcher assetMatcher = profile.getAssetUpdateMatcher(); FileNameMatcher assetMatcher = profile.getAssetUpdateMatcher();
FileNameMatcher clientMatcher = profile.getClientUpdateMatcher(); FileNameMatcher clientMatcher = profile.getClientUpdateMatcher();
try (DirWatcher assetWatcher = new DirWatcher(params.assetDir, assetHDir.object, assetMatcher, digest); try (DirWatcher assetWatcher = new DirWatcher(params.assetDir, assetHDir, assetMatcher, digest);
DirWatcher clientWatcher = new DirWatcher(params.clientDir, clientHDir.object, clientMatcher, digest)) { DirWatcher clientWatcher = new DirWatcher(params.clientDir, clientHDir, clientMatcher, digest)) {
// Verify current state of all dirs // Verify current state of all dirs
//verifyHDir(IOHelper.JVM_DIR, jvmHDir.object, null, digest); //verifyHDir(IOHelper.JVM_DIR, jvmHDir.object, null, digest);
HashedDir hdir = clientHDir.object;
//for (OptionalFile s : Launcher.profile.getOptional()) { //for (OptionalFile s : Launcher.profile.getOptional()) {
// if (params.updateOptional.contains(s)) s.mark = true; // if (params.updateOptional.contains(s)) s.mark = true;
// else hdir.removeR(s.file); // else hdir.removeR(s.file);
//} //}
Launcher.profile.pushOptionalFile(hdir,false); Launcher.profile.pushOptionalFile(clientHDir,false);
verifyHDir(params.assetDir, assetHDir.object, assetMatcher, digest); verifyHDir(params.assetDir, assetHDir, assetMatcher, digest);
verifyHDir(params.clientDir, hdir, clientMatcher, digest); verifyHDir(params.clientDir, clientHDir, clientMatcher, digest);
Launcher.modulesManager.postInitModules(); Launcher.modulesManager.postInitModules();
// Start WatchService, and only then client // Start WatchService, and only then client
CommonHelper.newThread("Asset Directory Watcher", true, assetWatcher).start(); CommonHelper.newThread("Asset Directory Watcher", true, assetWatcher).start();