Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,7 @@ build/
/Graphics/
/src/test/resources/DataStorage/
/Tools/Test/
/Schemaspy/
/Database/.idea/.name
/Database/.idea/data_source_mapping.xml
/Database/.idea/sqldialects.xml
21 changes: 21 additions & 0 deletions Database/.idea/dataSources.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import java.io.IOException;
import java.time.*;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.regex.MatchResult;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
Expand Down Expand Up @@ -383,7 +384,7 @@ private String fetchModIoPageContent(Page webPage, String modId, Result<String[]
retries++;
if (retries < MAX_RETRIES) {
//TODO: Tool around with the delay for retries AND for the separation between thread calls.
Thread.sleep(delay);
TimeUnit.MILLISECONDS.sleep(delay);
delay += random.nextInt(2000);
webPage.reload();
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ private String getSpaceEngineersDiskLocation(String filePath) throws IOException
HashMap<String, Object> steamInstallLocations = (HashMap<String, Object>) vdfParser.parseVdf(filePath).get("libraryfolders");

//Go through every map and submap we have, which represents the hierarchy of a .vdf file, to find the SE 244850 app ID.
//We KNOW this hashmap will be the type we expect, and you can't do the check in a one line anyway, so we're using a raw
for (Object diskBlockObj : steamInstallLocations.values()) {
if (diskBlockObj instanceof HashMap diskBlock) {
Object appsObj = diskBlock.get("apps");
Expand All @@ -139,7 +140,6 @@ private String getSpaceEngineersDiskLocation(String filePath) throws IOException
return "";
}


@Override
public Result<Void> downloadMod(String modId, SaveProfileInfo saveProfileInfo) throws IOException, InterruptedException {
Result<Void> modDownloadResult = new Result<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import java.net.*;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.concurrent.TimeUnit;
import java.util.function.BiConsumer;
import java.util.function.Consumer;

Expand Down Expand Up @@ -265,7 +266,7 @@ private Result<Void> downloadFileWithResumeAndRetries(URL steamCmdUrl, String do
messageUpdater.accept(String.format("Retrying... (%d/%d)", retryCount, maxRetries));
downloadResult.addMessage(String.format("%s download failed, retrying... Attempt %d", toolName, retryCount), ResultType.WARN);
//Wait the specified time of our retry delay before retrying the download.
Thread.sleep(retryDelay);
TimeUnit.MILLISECONDS.sleep(retryDelay);
} else {
Files.deleteIfExists(Path.of(steamCmdArchivePath));
downloadResult.addMessage(getStackTrace(e), ResultType.FAILED);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package com.gearshiftgaming.se_mod_manager.controller;

import com.gearshiftgaming.se_mod_manager.backend.domain.mod.ModDownloadService;
import com.gearshiftgaming.se_mod_manager.backend.domain.mod.SEOneSteamModDownloadService;

/**
* Copyright (C) 2025 Gear Shift Gaming - All Rights Reserved
* You may use, distribute, and modify this code under the terms of the GPL3 license.
Expand All @@ -12,4 +15,7 @@ public class ModDownloadController {
//TODO: We need service classes for all three (four? SE1 and 2 for Mod.io...) mod types.

//TODO: Wrap downloadMod in a task.
private SEOneSteamModDownloadService seOneSteamModDownloadService;

//Init the service in a constructor
}
Original file line number Diff line number Diff line change
Expand Up @@ -349,35 +349,35 @@ public Task<List<Result<Mod>>> importModsFromList(List<Mod> modList) {
return new Task<>() {
@Override
protected List<Result<Mod>> call() {
List<Result<Mod>> modInfoFillOutResults = new ArrayList<>();
Map<Mod, Result<Mod>> resultsByMod = new IdentityHashMap<>();
AtomicInteger completedMods = new AtomicInteger(0);
int totalMods = modList.size();
updateMessage(String.format("Mods Processed: 0/%s", totalMods));
updateProgress(0, totalMods);

try (ExecutorService executorService = Executors.newVirtualThreadPerTaskExecutor()) {
CompletionService<Result<Mod>> completionService = new ExecutorCompletionService<>(executorService);
CompletionService<Map.Entry<Mod, Result<Mod>>> completionService = new ExecutorCompletionService<>(executorService);
Random random = new Random();
for (Mod m : modList) {
// Submit the task without waiting for it to finish
// Submits the task without waiting for it to finish
completionService.submit(() -> {
if (m instanceof ModIoMod && totalMods > 1) {
Thread.sleep(random.nextInt(200, 600));
TimeUnit.MILLISECONDS.sleep(random.nextInt(200, 600));
}
return fillOutModInformation(m);
Result<Mod> result = fillOutModInformation(m);
return Map.entry(m, result);
});
}

for (int i = 0; i < totalMods; i++) {
Future<Result<Mod>> completedFuture;
Result<Mod> result;
try {
completedFuture = completionService.take();
result = completedFuture.get();
modInfoFillOutResults.add(result);
Future<Map.Entry<Mod, Result<Mod>>> completedFuture = completionService.take();
Map.Entry<Mod, Result<Mod>> entry = completedFuture.get();
resultsByMod.put(entry.getKey(), entry.getValue());
} catch (InterruptedException | ExecutionException e) {
result = new Result<>();
result.addMessage(getStackTrace(e), ResultType.FAILED);
modInfoFillOutResults.add(result);
Result<Mod> fail = new Result<>();
fail.addMessage(getStackTrace(e), ResultType.FAILED);
resultsByMod.put(modList.get(i), fail);
}

int done = completedMods.incrementAndGet();
Expand All @@ -386,7 +386,14 @@ protected List<Result<Mod>> call() {
}
updateMessage("All mods processed!");
}
return modInfoFillOutResults;

// Rebuild the list to the original order
List<Result<Mod>> orderedResults = new ArrayList<>(modList.size());
for (Mod m : modList) {
orderedResults.add(resultsByMod.get(m));
}

return orderedResults;
}
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public class ModTableRowFactory implements Callback<TableView<Mod>, TableRow<Mod
private final ModListManagerHelper modlistManagerHelper;

//TODO: I think we need an object property here to define the mod download status. Mods also need to persist their status

private enum RowBorderType {
TOP,
BOTTOM
Expand Down Expand Up @@ -286,7 +286,7 @@ public ModTableRow call(@NotNull TableView<Mod> modTable) {
dragEvent.consume();
});

//This is a dumb hack but I can't get the row's height any other way
//This is a dumb hack, but I can't get the row's height any other way
if (modlistManagerView.getSingleTableRow() == null) modlistManagerView.setSingleTableRow(row);

return row;
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/version.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#Mon Aug 11 23:27:21 EDT 2025
#Sat Nov 08 22:36:09 EST 2025
version=0.8.2a
Loading