diff --git a/gui/src/main/java/de/mc8051/arma3launcher/LauncherGUI.java b/gui/src/main/java/de/mc8051/arma3launcher/LauncherGUI.java
index d7b45d3..f04ddb2 100644
--- a/gui/src/main/java/de/mc8051/arma3launcher/LauncherGUI.java
+++ b/gui/src/main/java/de/mc8051/arma3launcher/LauncherGUI.java
@@ -1244,7 +1244,6 @@ public class LauncherGUI implements Observer {
techCheck();
} else if (s.equals("syncStopped")) {
final Parameter workshopParameter = Parameters.USE_WORKSHOP.toParameter();
- fileCheck(!(workshopParameter.getValue() != null && (boolean) workshopParameter.getValue()));
SwingUtilities.invokeLater(() -> {
syncDownloadButton.setEnabled(false);
syncDownloadAbortButton.setEnabled(false);
@@ -1253,11 +1252,14 @@ public class LauncherGUI implements Observer {
syncStatusLabel.setText("Sync stopped");
TaskBarUtils.getInstance().setValue(0);
TaskBarUtils.getInstance().off();
+
+ if (workshopParameter.getValue() != null && (boolean) workshopParameter.getValue()) checkType = FileChecker.Type.SLOW;
+ else checkType = FileChecker.Type.FAST;
+ RepositoryManger.getInstance().refreshModset();
});
techCheck();
} else if (s.equals("syncComplete")) {
final Parameter workshopParameter = Parameters.USE_WORKSHOP.toParameter();
- fileCheck(!(workshopParameter.getValue() != null && (boolean) workshopParameter.getValue()));
SwingUtilities.invokeLater(() -> {
syncDownloadButton.setEnabled(false);
syncDownloadAbortButton.setEnabled(false);
@@ -1268,6 +1270,10 @@ public class LauncherGUI implements Observer {
TaskBarUtils.getInstance().off();
TaskBarUtils.getInstance().attention();
TaskBarUtils.getInstance().notification("Sync complete", "", TrayIcon.MessageType.INFO);
+
+ if (workshopParameter.getValue() != null && (boolean) workshopParameter.getValue()) checkType = FileChecker.Type.SLOW;
+ else checkType = FileChecker.Type.FAST;
+ RepositoryManger.getInstance().refreshModset();
});
techCheck();
} else if (s.equals("syncContinue")) {
@@ -1315,6 +1321,7 @@ public class LauncherGUI implements Observer {
syncIntensiveCheckButton.setEnabled(false);
syncFastCheckButton.setEnabled(false);
syncCheckAbortButton.setEnabled(true);
+ syncCheckProgress.setValue(0);
syncCheckStatusLabel.setText("Running!");
new Thread(() -> fileChecker.check(fastscan)).start();
@@ -1325,6 +1332,10 @@ public class LauncherGUI implements Observer {
repoTree.setCheckboxesEnabled(false);
repoTree.setCheckboxesChecked(false);
+ syncSizeLabel.setText("0.0 B/0.0 B");
+ syncFileCountLabel.setText("");
+ syncDownloadSpeedLabel.setText("");
+
playButton.setEnabled(false);
playPresetButton.setEnabled(false);
}
diff --git a/gui/src/main/java/de/mc8051/arma3launcher/objects/ModFile.java b/gui/src/main/java/de/mc8051/arma3launcher/objects/ModFile.java
index b32b074..0805a37 100644
--- a/gui/src/main/java/de/mc8051/arma3launcher/objects/ModFile.java
+++ b/gui/src/main/java/de/mc8051/arma3launcher/objects/ModFile.java
@@ -29,7 +29,6 @@ public class ModFile implements AbstractMod {
private String parent;
private String localGeneratedSHA1sum = "";
private long lastModified = -1;
- private long localLastModified = -1;
public ModFile(File f, String modfile, String parent, long size, String sha1sum, long lastModified) {
// File: Abosolut Path
@@ -95,11 +94,7 @@ public class ModFile implements AbstractMod {
}
public long getLocalLastModified() {
- if (localLastModified <= 0 && exists()) {
- localLastModified = (int) (f.lastModified() / 1000);
- }
-
- return localLastModified;
+ return (int) (f.lastModified() / 1000);
}
public long getLastModified() {
diff --git a/gui/src/main/java/de/mc8051/arma3launcher/repo/FileChecker.java b/gui/src/main/java/de/mc8051/arma3launcher/repo/FileChecker.java
index 1bc4b53..1619519 100644
--- a/gui/src/main/java/de/mc8051/arma3launcher/repo/FileChecker.java
+++ b/gui/src/main/java/de/mc8051/arma3launcher/repo/FileChecker.java
@@ -137,15 +137,18 @@ public class FileChecker implements Observable {
return true;
}
- if (mf.getLocalSize() != mf.getSize()
- || mf.getLocalLastModified() != mf.getLastModified()
- || (!fastscan && !mf.getSHA1Sum().equalsIgnoreCase(mf.getLocalGeneratedSHA1Sum()))) {
+ int reason = -1;
+ if(mf.getLocalSize() != mf.getSize()) reason = 0;
+ else if (mf.getLocalLastModified() != mf.getLastModified()) reason = 1;
+ else if (!fastscan && !mf.getSHA1Sum().equalsIgnoreCase(mf.getLocalGeneratedSHA1Sum())) reason = 2;
+
+ if (reason != -1) {
if (changed.containsKey(mod)) temp = changed.get(mod);
temp.add(mf);
changed.put(mod, temp);
changedCount++;
size += mf.getSize();
- logger.debug("File {} changed", mf.getLocaleFile().getAbsolutePath());
+ logger.debug("File {} changed. Reason: {}", mf.getLocaleFile().getAbsolutePath(), reason);
return true;
}
diff --git a/gui/src/main/java/de/mc8051/arma3launcher/repo/sync/Syncer.java b/gui/src/main/java/de/mc8051/arma3launcher/repo/sync/Syncer.java
index 3430997..e5de2d5 100644
--- a/gui/src/main/java/de/mc8051/arma3launcher/repo/sync/Syncer.java
+++ b/gui/src/main/java/de/mc8051/arma3launcher/repo/sync/Syncer.java
@@ -161,6 +161,14 @@ public class Syncer implements Observable, SyncListener {
logger.info("ZSync - Copied");
SwingUtilities.invokeLater(() -> gui.syncStatusLabel.setText(mfModPath + ": Copied"));
success++;
+
+ long lastMotified = mf.getLastModified() * 1000;
+ if (mf.getLocaleFile().setLastModified(lastMotified)) {
+ logger.debug("ZSync - set last motified to {}", lastMotified);
+ } else {
+ logger.debug("ZSync - Failed to set last modified!");
+ }
+
finnishCurrent();
continue;
}
@@ -268,6 +276,16 @@ public class Syncer implements Observable, SyncListener {
final int percentage = (int) ((double) i / (double) Long.valueOf(syncCount).intValue() * 100);
final String modPath = currentDownload.getModPath();
+
+ if(!currentDownload_failed) {
+ long lastMotified = currentDownload.getLastModified() * 1000;
+ if (currentDownload.getLocaleFile().setLastModified(lastMotified)) {
+ logger.debug("ZSync - set last motified to {}", lastMotified);
+ } else {
+ logger.debug("ZSync - Failed to set last modified!");
+ }
+ }
+
SwingUtilities.invokeLater(() -> {
gui.syncDownloadProgress.setValue(i);
gui.syncFileCountLabel.setText(i + "/" + syncCount + " (" + failed + " failed)");
diff --git a/pom.xml b/pom.xml
index 12efb08..0d77064 100644
--- a/pom.xml
+++ b/pom.xml
@@ -5,7 +5,7 @@
4.0.0
- 0.1.1008
+ 0.1.1009
de.mc8051