From 221666df3e264d5516fbe16eb68da43fbbc01ced Mon Sep 17 00:00:00 2001 From: Gravit Date: Wed, 3 Apr 2019 20:37:31 +0700 Subject: [PATCH] =?UTF-8?q?[FEATURE]=20=D0=A2=D0=BE=D0=BF=D0=BE=D1=80?= =?UTF-8?q?=D0=BD=D0=B0=D1=8F=20=D1=80=D0=B5=D0=B0=D0=BB=D0=B8=D0=B7=D0=B0?= =?UTF-8?q?=D1=86=D0=B8=D1=8F=20=D1=81=D0=BA=D0=B0=D1=87=D0=B8=D0=B2=D0=B0?= =?UTF-8?q?=D0=BD=D0=B8=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../launcher/request/update/UpdateRequest.java | 18 ++++++++++++++---- .../events/request/UpdateRequestEvent.java | 2 ++ 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/LauncherAPI/src/main/java/ru/gravit/launcher/request/update/UpdateRequest.java b/LauncherAPI/src/main/java/ru/gravit/launcher/request/update/UpdateRequest.java index 5570ced5..36bc18d2 100644 --- a/LauncherAPI/src/main/java/ru/gravit/launcher/request/update/UpdateRequest.java +++ b/LauncherAPI/src/main/java/ru/gravit/launcher/request/update/UpdateRequest.java @@ -3,6 +3,7 @@ import ru.gravit.launcher.Launcher; import ru.gravit.launcher.LauncherAPI; import ru.gravit.launcher.LauncherConfig; +import ru.gravit.launcher.downloader.ListDownloader; import ru.gravit.launcher.events.request.UpdateRequestEvent; import ru.gravit.launcher.hasher.FileNameMatcher; import ru.gravit.launcher.hasher.HashedDir; @@ -32,10 +33,8 @@ import java.security.SignatureException; import java.time.Duration; import java.time.Instant; -import java.util.LinkedList; +import java.util.*; import java.util.Map.Entry; -import java.util.Objects; -import java.util.Queue; import java.util.zip.InflaterInputStream; public final class UpdateRequest extends Request implements RequestInterface { @@ -200,7 +199,18 @@ private static void fillActionsQueue(Queue queue, HashedDir mismat @Override public UpdateRequestEvent requestWebSockets() throws Exception { - return (UpdateRequestEvent) LegacyRequestBridge.sendRequest(this); + UpdateRequestEvent e = (UpdateRequestEvent) LegacyRequestBridge.sendRequest(this); + Launcher.profile.pushOptionalFile(e.hdir, !Launcher.profile.isUpdateFastCheck()); + HashedDir.Diff diff = e.hdir.diff(localDir, matcher); + final List adds = new ArrayList<>(); + diff.mismatch.map().entrySet().stream().filter(e1 -> e1.getValue().getType().equals(HashedEntry.Type.FILE)).forEach(a -> { + adds.add(a.getKey()); + }); + totalSize = diff.mismatch.size(); + ListDownloader listDownloader = new ListDownloader(); + listDownloader.download(e.url, adds, dir); + deleteExtraDir(dir, diff.extra, diff.extra.flag); + return e; } // Instance diff --git a/libLauncher/src/main/java/ru/gravit/launcher/events/request/UpdateRequestEvent.java b/libLauncher/src/main/java/ru/gravit/launcher/events/request/UpdateRequestEvent.java index 755b7562..a56989fa 100644 --- a/libLauncher/src/main/java/ru/gravit/launcher/events/request/UpdateRequestEvent.java +++ b/libLauncher/src/main/java/ru/gravit/launcher/events/request/UpdateRequestEvent.java @@ -7,6 +7,8 @@ public class UpdateRequestEvent implements ResultInterface { @LauncherNetworkAPI public HashedDir hdir; + @LauncherNetworkAPI + public String url; @Override public String getType() {