mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-12-22 16:41:46 +03:00
[ANY] IDEA Reformat code
This commit is contained in:
parent
bee6429bed
commit
3ecc4c3bf1
18 changed files with 79 additions and 173 deletions
|
@ -265,8 +265,8 @@ public static class ExeConf {
|
|||
public String txtFileVersion;
|
||||
public String txtProductVersion;
|
||||
}
|
||||
public static class NettyUpdatesBind
|
||||
{
|
||||
|
||||
public static class NettyUpdatesBind {
|
||||
public String url;
|
||||
public boolean zip;
|
||||
}
|
||||
|
|
|
@ -78,7 +78,7 @@ private void setConfig() {
|
|||
// Prepare JRE
|
||||
Jre jre = new Jre();
|
||||
jre.setMinVersion("1.8.0");
|
||||
if(server.config.launch4j.setMaxVersion)
|
||||
if (server.config.launch4j.setMaxVersion)
|
||||
jre.setMaxVersion(server.config.launch4j.maxVersion);
|
||||
jre.setRuntimeBits(Jre.RUNTIME_BITS_64_AND_32);
|
||||
jre.setJdkPreference(Jre.JDK_PREFERENCE_PREFER_JRE);
|
||||
|
|
|
@ -42,11 +42,11 @@ public JARLauncherBinary(LaunchServer server) throws IOException {
|
|||
public void init() {
|
||||
tasks.add(new PrepareBuildTask(server));
|
||||
tasks.add(new MainBuildTask(server));
|
||||
if(server.config.launcher.attachLibraryBeforeProGuard) tasks.add(new AttachJarsTask(server));
|
||||
if (server.config.launcher.attachLibraryBeforeProGuard) tasks.add(new AttachJarsTask(server));
|
||||
tasks.add(new ProGuardBuildTask(server));
|
||||
tasks.add(new AdditionalFixesApplyTask(server));
|
||||
tasks.add(new RadonBuildTask(server));
|
||||
if(!server.config.launcher.attachLibraryBeforeProGuard) tasks.add(new AttachJarsTask(server));
|
||||
if (!server.config.launcher.attachLibraryBeforeProGuard) tasks.add(new AttachJarsTask(server));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -137,7 +137,7 @@ public Path process(Path inputJar) throws IOException {
|
|||
jaConfigurator.setGuardType(server.config.launcher.guardType);
|
||||
jaConfigurator.setWarningMissArchJava(server.config.isWarningMissArchJava);
|
||||
jaConfigurator.setEnv(server.config.env);
|
||||
if(server.runtime.oemUnlockKey == null) server.runtime.oemUnlockKey = SecurityHelper.randomStringToken();
|
||||
if (server.runtime.oemUnlockKey == null) server.runtime.oemUnlockKey = SecurityHelper.randomStringToken();
|
||||
jaConfigurator.setOemUnlockKey(server.runtime.oemUnlockKey);
|
||||
server.buildHookManager.registerAllClientModuleClass(jaConfigurator);
|
||||
reader.getCp().add(new JarFile(inputJar.toFile()));
|
||||
|
|
|
@ -40,8 +40,7 @@ public void execute(ChannelHandlerContext ctx, Client client) {
|
|||
}
|
||||
String url = LaunchServer.server.config.netty.downloadURL.replace("%dirname%", dirName);
|
||||
boolean zip = false;
|
||||
if (server.config.netty.bindings.get(dirName) != null)
|
||||
{
|
||||
if (server.config.netty.bindings.get(dirName) != null) {
|
||||
LaunchServer.NettyUpdatesBind bind = server.config.netty.bindings.get(dirName);
|
||||
url = bind.url;
|
||||
zip = bind.zip;
|
||||
|
|
|
@ -5,10 +5,12 @@
|
|||
import java.io.IOException;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
|
||||
@LauncherAPI
|
||||
public class GravitGuardBridge {
|
||||
@LauncherAPI
|
||||
public static native void callGuard();
|
||||
|
||||
@LauncherAPI
|
||||
public static int sendHTTPRequest(String strurl) throws IOException {
|
||||
URL url = new URL(strurl);
|
||||
|
|
|
@ -33,47 +33,40 @@ public void preDiff(UpdateRequest request, UpdateRequestEvent e) {
|
|||
|
||||
@Override
|
||||
public void postDiff(UpdateRequest request, UpdateRequestEvent e, HashedDir.Diff diff) throws IOException {
|
||||
if(e.zip) return;
|
||||
if(SettingsManager.settings.featureStore)
|
||||
{
|
||||
if (e.zip) return;
|
||||
if (SettingsManager.settings.featureStore) {
|
||||
LogHelper.info("Enabled HStore feature. Find");
|
||||
AtomicReference<NewLauncherSettings.HashedStoreEntry> lastEn = new AtomicReference<>(null);
|
||||
//ArrayList<String> removed = new ArrayList<>();
|
||||
diff.mismatch.walk(File.separator, (path, name, entry) -> {
|
||||
if(entry.getType() == HashedEntry.Type.DIR) {
|
||||
if (entry.getType() == HashedEntry.Type.DIR) {
|
||||
Files.createDirectories(request.getDir().resolve(path));
|
||||
return HashedDir.WalkAction.CONTINUE;
|
||||
}
|
||||
HashedFile file = (HashedFile) entry;
|
||||
//Первый экспериментальный способ - честно обходим все возможные Store
|
||||
Path ret = null;
|
||||
if(lastEn.get() == null)
|
||||
{
|
||||
for(NewLauncherSettings.HashedStoreEntry en : SettingsManager.settings.lastHDirs)
|
||||
{
|
||||
if (lastEn.get() == null) {
|
||||
for (NewLauncherSettings.HashedStoreEntry en : SettingsManager.settings.lastHDirs) {
|
||||
ret = tryFind(en, file);
|
||||
if(ret != null) {
|
||||
if (ret != null) {
|
||||
lastEn.set(en);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
ret = tryFind(lastEn.get(), file);
|
||||
}
|
||||
if(ret == null)
|
||||
{
|
||||
for(NewLauncherSettings.HashedStoreEntry en : SettingsManager.settings.lastHDirs)
|
||||
{
|
||||
if (ret == null) {
|
||||
for (NewLauncherSettings.HashedStoreEntry en : SettingsManager.settings.lastHDirs) {
|
||||
ret = tryFind(en, file);
|
||||
if(ret != null) {
|
||||
if (ret != null) {
|
||||
lastEn.set(en);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(ret != null)
|
||||
{
|
||||
if (ret != null) {
|
||||
//Еще раз проверим корректность хеша
|
||||
//Возможно эта проверка избыточна
|
||||
//if(file.isSame(ret, true))
|
||||
|
@ -82,8 +75,7 @@ public void postDiff(UpdateRequest request, UpdateRequestEvent e, HashedDir.Diff
|
|||
LogHelper.debug("Copy file %s to %s", ret.toAbsolutePath().toString(), source.toAbsolutePath().toString());
|
||||
//Let's go!
|
||||
Files.copy(ret, source);
|
||||
try(InputStream input = IOHelper.newInput(ret))
|
||||
{
|
||||
try (InputStream input = IOHelper.newInput(ret)) {
|
||||
IOHelper.transfer(input, source);
|
||||
}
|
||||
entry.flag = true;
|
||||
|
@ -94,25 +86,22 @@ public void postDiff(UpdateRequest request, UpdateRequestEvent e, HashedDir.Diff
|
|||
});
|
||||
}
|
||||
}
|
||||
public Path tryFind(NewLauncherSettings.HashedStoreEntry en, HashedFile file) throws IOException
|
||||
{
|
||||
|
||||
public Path tryFind(NewLauncherSettings.HashedStoreEntry en, HashedFile file) throws IOException {
|
||||
AtomicReference<Path> ret = new AtomicReference<>(null);
|
||||
en.hdir.walk(File.separator, (path, name, entry) -> {
|
||||
if(entry.getType() == HashedEntry.Type.DIR) return HashedDir.WalkAction.CONTINUE;
|
||||
if (entry.getType() == HashedEntry.Type.DIR) return HashedDir.WalkAction.CONTINUE;
|
||||
HashedFile tfile = (HashedFile) entry;
|
||||
if(tfile.isSame(file))
|
||||
{
|
||||
if (tfile.isSame(file)) {
|
||||
LogHelper.dev("[DIR:%s] Found file %s in %s", en.name, name, path);
|
||||
Path tdir = Paths.get(en.fullPath).resolve(path);
|
||||
try {
|
||||
if(tfile.isSame(tdir, true))
|
||||
{
|
||||
if (tfile.isSame(tdir, true)) {
|
||||
LogHelper.dev("[DIR:%s] Confirmed file %s in %s", en.name, name, path);
|
||||
ret.set(tdir);
|
||||
return HashedDir.WalkAction.STOP;
|
||||
}
|
||||
} catch (IOException e)
|
||||
{
|
||||
} catch (IOException e) {
|
||||
LogHelper.error("Check file error %s %s", e.getClass().getName(), e.getMessage());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,15 +19,12 @@ public String getUsageDescription() {
|
|||
public void invoke(String... args) throws Exception {
|
||||
verifyArgs(args, 2);
|
||||
boolean enabled = Boolean.valueOf(args[1]);
|
||||
switch (args[0])
|
||||
{
|
||||
case "store":
|
||||
{
|
||||
switch (args[0]) {
|
||||
case "store": {
|
||||
SettingsManager.settings.featureStore = enabled;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
default: {
|
||||
LogHelper.info("Features: [store]");
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -26,20 +26,16 @@ public void invoke(String... args) throws Exception {
|
|||
int ind = 1;
|
||||
int index = Integer.valueOf(args[0]);
|
||||
boolean overwrite = Boolean.valueOf(args[1]);
|
||||
for(NewLauncherSettings.HashedStoreEntry e : SettingsManager.settings.lastHDirs)
|
||||
{
|
||||
if(ind == index)
|
||||
{
|
||||
for (NewLauncherSettings.HashedStoreEntry e : SettingsManager.settings.lastHDirs) {
|
||||
if (ind == index) {
|
||||
LogHelper.info("Copy [%d] FullPath: %s name: %s", ind, e.fullPath, e.name);
|
||||
Path path = Paths.get(e.fullPath);
|
||||
if(!Files.isDirectory(path))
|
||||
{
|
||||
if (!Files.isDirectory(path)) {
|
||||
LogHelper.error("Directory %s not found", path.toAbsolutePath().toString());
|
||||
return;
|
||||
}
|
||||
Path target = Paths.get(SettingsManager.settings.updatesDirPath).resolve(e.name);
|
||||
if(Files.exists(target) && !overwrite)
|
||||
{
|
||||
if (Files.exists(target) && !overwrite) {
|
||||
LogHelper.error("Directory %s found, flag overwrite not found", target.toAbsolutePath().toString());
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -26,20 +26,16 @@ public void invoke(String... args) throws Exception {
|
|||
verifyArgs(args, 1);
|
||||
int ind = 1;
|
||||
int index = Integer.valueOf(args[0]);
|
||||
for(NewLauncherSettings.HashedStoreEntry e : SettingsManager.settings.lastHDirs)
|
||||
{
|
||||
if(ind == index)
|
||||
{
|
||||
for (NewLauncherSettings.HashedStoreEntry e : SettingsManager.settings.lastHDirs) {
|
||||
if (ind == index) {
|
||||
LogHelper.info("Copy [%d] FullPath: %s name: %s", ind, e.fullPath, e.name);
|
||||
Path path = Paths.get(e.fullPath);
|
||||
if(!Files.isDirectory(path))
|
||||
{
|
||||
if (!Files.isDirectory(path)) {
|
||||
LogHelper.error("Directory %s not found", path.toAbsolutePath().toString());
|
||||
return;
|
||||
}
|
||||
Path target = Paths.get(SettingsManager.settings.updatesDirPath).resolve(e.name);
|
||||
if(Files.exists(target))
|
||||
{
|
||||
if (Files.exists(target)) {
|
||||
LogHelper.error("Directory %s already exists", target.toAbsolutePath().toString());
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -19,8 +19,7 @@ public String getUsageDescription() {
|
|||
@Override
|
||||
public void invoke(String... args) throws Exception {
|
||||
int ind = 1;
|
||||
for(NewLauncherSettings.HashedStoreEntry e : SettingsManager.settings.lastHDirs)
|
||||
{
|
||||
for (NewLauncherSettings.HashedStoreEntry e : SettingsManager.settings.lastHDirs) {
|
||||
LogHelper.info("[%d] FullPath: %s name: %s", ind, e.fullPath, e.name);
|
||||
ind++;
|
||||
}
|
||||
|
|
|
@ -32,14 +32,12 @@ public Path getJavaBinPath() {
|
|||
String projectName = Launcher.getConfig().projectname;
|
||||
String wrapperUnpackName = JVMHelper.JVM_BITS == 64 ? projectName.concat("64.exe") : projectName.concat("32.exe");
|
||||
return DirBridge.getGuardDir().resolve(wrapperUnpackName);
|
||||
} else if(ClientLauncher.getJavaBinPath() != null)
|
||||
{
|
||||
} else if (ClientLauncher.getJavaBinPath() != null) {
|
||||
javaBinPath = ClientLauncher.getJavaBinPath();
|
||||
String projectName = Launcher.getConfig().projectname;
|
||||
String wrapperUnpackName = JVMHelper.JVM_BITS == 64 ? projectName.concat("64.exe") : projectName.concat("32.exe");
|
||||
return DirBridge.getGuardDir().resolve(wrapperUnpackName);
|
||||
}
|
||||
else
|
||||
} else
|
||||
return IOHelper.resolveJavaBin(Paths.get(System.getProperty("java.home")));
|
||||
}
|
||||
|
||||
|
@ -60,7 +58,7 @@ public void init(boolean clientInstance) {
|
|||
} catch (IOException e) {
|
||||
throw new SecurityException(e);
|
||||
}
|
||||
if(clientInstance) GravitGuardBridge.callGuard();
|
||||
if (clientInstance) GravitGuardBridge.callGuard();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -71,7 +69,7 @@ public void addCustomParams(ClientLauncherContext context) {
|
|||
@Override
|
||||
public void addCustomEnv(ClientLauncherContext context) {
|
||||
Map<String, String> env = context.builder.environment();
|
||||
if(javaBinPath == null)
|
||||
if (javaBinPath == null)
|
||||
env.put("JAVA_HOME", System.getProperty("java.home"));
|
||||
else
|
||||
env.put("JAVA_HOME", javaBinPath.toAbsolutePath().toString());
|
||||
|
|
|
@ -25,8 +25,7 @@ public FileVisitResult visitFile(Path file, BasicFileAttributes attrs)
|
|||
String fullPath = input.readString(1024);
|
||||
HashedDir dir = new HashedDir(input);
|
||||
settings.lastHDirs.add(new NewLauncherSettings.HashedStoreEntry(dir, dirName, fullPath));
|
||||
} catch (IOException e)
|
||||
{
|
||||
} catch (IOException e) {
|
||||
LogHelper.error("Skip file %s exception: %s", file.toAbsolutePath().toString(), e.getMessage());
|
||||
}
|
||||
return super.visitFile(file, attrs);
|
||||
|
@ -61,10 +60,8 @@ public void setConfig(NewLauncherSettings config) {
|
|||
settings = config;
|
||||
if (settings.updatesDirPath != null)
|
||||
settings.updatesDir = Paths.get(settings.updatesDirPath);
|
||||
if(settings.consoleUnlockKey != null && !ConsoleManager.isConsoleUnlock)
|
||||
{
|
||||
if(ConsoleManager.checkUnlockKey(settings.consoleUnlockKey))
|
||||
{
|
||||
if (settings.consoleUnlockKey != null && !ConsoleManager.isConsoleUnlock) {
|
||||
if (ConsoleManager.checkUnlockKey(settings.consoleUnlockKey)) {
|
||||
ConsoleManager.unlock();
|
||||
LogHelper.info("Console auto unlocked");
|
||||
}
|
||||
|
@ -81,7 +78,7 @@ public void loadHDirStore(Path storePath) throws IOException {
|
|||
public void saveHDirStore(Path storeProjectPath) throws IOException {
|
||||
Files.createDirectories(storeProjectPath);
|
||||
for (NewLauncherSettings.HashedStoreEntry e : settings.lastHDirs) {
|
||||
if(!e.needSave) continue;
|
||||
if (!e.needSave) continue;
|
||||
Path file = storeProjectPath.resolve(e.name.concat(".bin"));
|
||||
if (!Files.exists(file)) Files.createFile(file);
|
||||
try (HOutput output = new HOutput(IOHelper.newOutput(file))) {
|
||||
|
|
|
@ -62,6 +62,7 @@ public void download(String base, List<DownloadTask> applies, Path dstDirFile, D
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void downloadZip(String base, Path dstDirFile, DownloadCallback callback, DownloadTotalCallback totalCallback) throws IOException, URISyntaxException {
|
||||
/*try (CloseableHttpClient httpclient = HttpClients.custom()
|
||||
.setRedirectStrategy(new LaxRedirectStrategy())
|
||||
|
@ -132,23 +133,18 @@ public FileDownloadResponseHandler(Path target, DownloadCallback callback, Downl
|
|||
@Override
|
||||
public Path handleResponse(HttpResponse response) throws IOException {
|
||||
InputStream source = response.getEntity().getContent();
|
||||
if(zip)
|
||||
{
|
||||
try(ZipInputStream input = IOHelper.newZipInput(source))
|
||||
{
|
||||
if (zip) {
|
||||
try (ZipInputStream input = IOHelper.newZipInput(source)) {
|
||||
ZipEntry entry = input.getNextEntry();
|
||||
while(entry != null)
|
||||
{
|
||||
if(entry.isDirectory())
|
||||
{
|
||||
while (entry != null) {
|
||||
if (entry.isDirectory()) {
|
||||
entry = input.getNextEntry();
|
||||
continue;
|
||||
}
|
||||
long size = entry.getSize();
|
||||
String filename = entry.getName();
|
||||
Path target = this.target.resolve(filename);
|
||||
if(callback != null)
|
||||
{
|
||||
if (callback != null) {
|
||||
callback.stateChanged(entry.getName(), 0, entry.getSize());
|
||||
}
|
||||
LogHelper.dev("Resolved filename %s to %s", filename, target.toAbsolutePath().toString());
|
||||
|
|
|
@ -1,60 +0,0 @@
|
|||
package ru.gravit.launcher.request;
|
||||
|
||||
import ru.gravit.launcher.hasher.HashedEntry;
|
||||
import ru.gravit.launcher.serialize.HInput;
|
||||
import ru.gravit.launcher.serialize.HOutput;
|
||||
import ru.gravit.launcher.serialize.stream.EnumSerializer;
|
||||
import ru.gravit.launcher.serialize.stream.StreamObject;
|
||||
import ru.gravit.utils.helper.IOHelper;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public final class UpdateAction extends StreamObject {
|
||||
public enum Type implements EnumSerializer.Itf {
|
||||
CD(1), CD_BACK(2), GET(3), FINISH(255);
|
||||
private static final EnumSerializer<Type> SERIALIZER = new EnumSerializer<>(Type.class);
|
||||
|
||||
public static Type read(HInput input) throws IOException {
|
||||
return SERIALIZER.read(input);
|
||||
}
|
||||
|
||||
private final int n;
|
||||
|
||||
Type(int n) {
|
||||
this.n = n;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getNumber() {
|
||||
return n;
|
||||
}
|
||||
}
|
||||
|
||||
public static final UpdateAction CD_BACK = new UpdateAction(Type.CD_BACK, null, null);
|
||||
|
||||
public static final UpdateAction FINISH = new UpdateAction(Type.FINISH, null, null);
|
||||
// Instance
|
||||
public final Type type;
|
||||
public final String name;
|
||||
|
||||
public final HashedEntry entry;
|
||||
|
||||
public UpdateAction(HInput input) throws IOException {
|
||||
type = Type.read(input);
|
||||
name = type == Type.CD || type == Type.GET ? IOHelper.verifyFileName(input.readString(255)) : null;
|
||||
entry = null;
|
||||
}
|
||||
|
||||
public UpdateAction(Type type, String name, HashedEntry entry) {
|
||||
this.type = type;
|
||||
this.name = name;
|
||||
this.entry = entry;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(HOutput output) throws IOException {
|
||||
EnumSerializer.write(output, type);
|
||||
if (type == Type.CD || type == Type.GET)
|
||||
output.writeString(name, 255);
|
||||
}
|
||||
}
|
|
@ -27,15 +27,20 @@
|
|||
import java.util.Objects;
|
||||
|
||||
public final class UpdateRequest extends Request<UpdateRequestEvent> implements RequestInterface {
|
||||
public interface UpdateController
|
||||
{
|
||||
public interface UpdateController {
|
||||
void preUpdate(UpdateRequest request, UpdateRequestEvent e) throws IOException;
|
||||
|
||||
void preDiff(UpdateRequest request, UpdateRequestEvent e) throws IOException;
|
||||
void postDiff(UpdateRequest request, UpdateRequestEvent e,HashedDir.Diff diff) throws IOException;
|
||||
|
||||
void postDiff(UpdateRequest request, UpdateRequestEvent e, HashedDir.Diff diff) throws IOException;
|
||||
|
||||
void preDownload(UpdateRequest request, UpdateRequestEvent e, List<ListDownloader.DownloadTask> adds) throws IOException;
|
||||
|
||||
void postDownload(UpdateRequest request, UpdateRequestEvent e) throws IOException;
|
||||
|
||||
void postUpdate(UpdateRequest request, UpdateRequestEvent e) throws IOException;
|
||||
}
|
||||
|
||||
private static UpdateController controller;
|
||||
|
||||
public static void setController(UpdateController controller) {
|
||||
|
@ -184,18 +189,17 @@ public double getTotalSizeMiB() {
|
|||
public UpdateRequestEvent requestDo(StandartClientWebSocketService service) throws Exception {
|
||||
LogHelper.debug("Start update request");
|
||||
UpdateRequestEvent e = (UpdateRequestEvent) service.sendRequest(this);
|
||||
if(controller != null) controller.preUpdate(this, e);
|
||||
if (controller != null) controller.preUpdate(this, e);
|
||||
LogHelper.debug("Start update");
|
||||
Launcher.profile.pushOptionalFile(e.hdir, !Launcher.profile.isUpdateFastCheck());
|
||||
if(controller != null) controller.preDiff(this, e);
|
||||
if (controller != null) controller.preDiff(this, e);
|
||||
HashedDir.Diff diff = e.hdir.diff(localDir, matcher);
|
||||
if(controller != null) controller.postDiff(this, e, diff);
|
||||
if (controller != null) controller.postDiff(this, e, diff);
|
||||
final List<ListDownloader.DownloadTask> adds = new ArrayList<>();
|
||||
if(controller != null) controller.preDownload(this, e, adds);
|
||||
if (controller != null) controller.preDownload(this, e, adds);
|
||||
diff.mismatch.walk(IOHelper.CROSS_SEPARATOR, (path, name, entry) -> {
|
||||
if (entry.getType().equals(HashedEntry.Type.FILE)) {
|
||||
if(!entry.flag)
|
||||
{
|
||||
if (!entry.flag) {
|
||||
HashedFile file = (HashedFile) entry;
|
||||
totalSize += file.size;
|
||||
adds.add(new ListDownloader.DownloadTask(path, file.size));
|
||||
|
@ -214,17 +218,14 @@ public UpdateRequestEvent requestDo(StandartClientWebSocketService service) thro
|
|||
updateState("UnknownFile", 0L, 100);
|
||||
ListDownloader listDownloader = new ListDownloader();
|
||||
LogHelper.info("Download %s to %s", dirName, dir.toAbsolutePath().toString());
|
||||
if(e.zip && !adds.isEmpty())
|
||||
{
|
||||
if (e.zip && !adds.isEmpty()) {
|
||||
listDownloader.downloadZip(e.url, dir, this::updateState, (add) -> totalDownloaded += add);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
listDownloader.download(e.url, adds, dir, this::updateState, (add) -> totalDownloaded += add);
|
||||
}
|
||||
if(controller != null) controller.postDownload(this, e);
|
||||
if (controller != null) controller.postDownload(this, e);
|
||||
deleteExtraDir(dir, diff.extra, diff.extra.flag);
|
||||
if(controller != null) controller.postUpdate(this, e);
|
||||
if (controller != null) controller.postUpdate(this, e);
|
||||
LogHelper.debug("Update success");
|
||||
return e;
|
||||
}
|
||||
|
|
|
@ -342,8 +342,8 @@ public void walk(CharSequence separator, WalkCallback callback) throws IOExcepti
|
|||
String append = "";
|
||||
walk(append, separator, callback, true);
|
||||
}
|
||||
public enum WalkAction
|
||||
{
|
||||
|
||||
public enum WalkAction {
|
||||
STOP, CONTINUE
|
||||
}
|
||||
|
||||
|
@ -356,24 +356,21 @@ private WalkAction walk(String append, CharSequence separator, WalkCallback call
|
|||
for (Map.Entry<String, HashedEntry> entry : map.entrySet()) {
|
||||
HashedEntry e = entry.getValue();
|
||||
if (e.getType() == Type.FILE) {
|
||||
if (noSeparator)
|
||||
{
|
||||
if (noSeparator) {
|
||||
WalkAction a = callback.walked(append + entry.getKey(), entry.getKey(), e);
|
||||
if(a == WalkAction.STOP) return a;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (a == WalkAction.STOP) return a;
|
||||
} else {
|
||||
WalkAction a = callback.walked(append + separator + entry.getKey(), entry.getKey(), e);
|
||||
if(a == WalkAction.STOP) return a;
|
||||
if (a == WalkAction.STOP) return a;
|
||||
}
|
||||
} else {
|
||||
String newAppend;
|
||||
if (noSeparator) newAppend = append + entry.getKey();
|
||||
else newAppend = append + separator + entry.getKey();
|
||||
WalkAction a = callback.walked(newAppend, entry.getKey(), e);
|
||||
if(a == WalkAction.STOP) return a;
|
||||
if (a == WalkAction.STOP) return a;
|
||||
a = ((HashedDir) e).walk(newAppend, separator, callback, false);
|
||||
if(a == WalkAction.STOP) return a;
|
||||
if (a == WalkAction.STOP) return a;
|
||||
}
|
||||
}
|
||||
return WalkAction.CONTINUE;
|
||||
|
|
|
@ -113,8 +113,7 @@ public static void debug(String format, Object... args) {
|
|||
|
||||
@LauncherAPI
|
||||
public static void dev(String format, Object... args) {
|
||||
if(isDevEnabled())
|
||||
{
|
||||
if (isDevEnabled()) {
|
||||
dev(String.format(format, args));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue