Skip to content

Commit f721e71

Browse files
committed
Fix 200% download progress and installedMods backup/restore
1 parent 9c0d890 commit f721e71

4 files changed

Lines changed: 9 additions & 5 deletions

File tree

QuestAppVersionSwitcher/ClientModels.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@ public class DownloadProgress
8787
public string version { get; set; } = "";
8888
public double percentage { get; set; } = 0.0;
8989
public string percentageString { get; set; } = "";
90+
91+
public bool downloadDone { get; set; } = false;
9092
public long done { get; set; } = 0;
9193
public long total { get; set; } = 0;
9294
public long speed { get; set; } = 0;

QuestAppVersionSwitcher/DownloadManager.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ public void StartDownload(string binaryid, string password, string version, stri
110110
this.percentage = 1.0;
111111
this.percentageString = "100%";
112112
this.textColor = "#30e34b";
113+
this.downloadDone = true;
113114
QAVSWebserver.BroadcastDownloads(true);
114115
};
115116
downloader.OnDownloadError = () =>

QuestAppVersionSwitcher/GameDownloadManager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ public void UpdateManagersAndProgress()
255255
{
256256
UpdateMaxConnections();
257257
totalBytes = apkDownloadManager.total + allObbs.Select(x => x.sizeNumerical).Sum();
258-
downloadedBytes = downloadedFilesTotalBytes + apkDownloadManager.done + downloadManagers.Where(x => x.isObb).Select(x => x.done).Sum();
258+
downloadedBytes = downloadedFilesTotalBytes + (apkDownloadManager.downloadDone ? 0 : apkDownloadManager.done) + downloadManagers.Where(x => x.isObb).Select(x => x.done).Sum();
259259

260260
// Speed
261261
double secondsPassed = (DateTime.Now - lastUpdate).TotalSeconds;

QuestAppVersionSwitcher/WebServer.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -863,8 +863,8 @@ public void Start()
863863
{
864864
Logger.Log("Copying AppData");
865865
if(Directory.Exists(gameDataDir)) FolderPermission.DirectoryCopy(gameDataDir, backupDir + package);
866-
Logger.Log("Copying mods");
867-
if(Directory.Exists(QAVSModManager.modManager.GetModExtractPath(package))) FolderPermission.DirectoryCopy(QAVSModManager.modManager.GetModExtractPath(package), backupDir + "installedMods");
866+
Logger.Log("Copying mods from " + QAVSModManager.modManager.GetModExtractPath(package));
867+
if(Directory.Exists(QAVSModManager.modManager.GetModsExtractPath(package))) FolderPermission.DirectoryCopy(QAVSModManager.modManager.GetModsExtractPath(package), backupDir + "installedMods");
868868
}
869869
catch (Exception e)
870870
{
@@ -1181,8 +1181,9 @@ public void Start()
11811181
if (Directory.Exists(backupDir + "installedMods"))
11821182
{
11831183
Logger.Log("Restoring installed mods of backup " + backupname + " of " + package);
1184-
Directory.Delete(QAVSModManager.modManager.GetModExtractPath(package), true);
1185-
FolderPermission.DirectoryCopy(backupDir + "installedMods", QAVSModManager.modManager.GetModExtractPath(package));
1184+
Directory.Delete(QAVSModManager.modManager.GetModsExtractPath(package), true);
1185+
FolderPermission.DirectoryCopy(backupDir + "installedMods", QAVSModManager.modManager.GetModsExtractPath(package));
1186+
QAVSModManager.Update();
11861187
}
11871188

11881189
serverRequest.SendString(GenericResponse.GetResponse("Game data restored", true), "application/json");

0 commit comments

Comments
 (0)