Skip to content

Commit 4f97f47

Browse files
author
ComputerElite
committed
add resume download aka repair game option if folder of game is present, fix crash on searching face your due to release date being null and deserialization failing
1 parent 5ccc692 commit 4f97f47

File tree

1 file changed

+27
-4
lines changed

1 file changed

+27
-4
lines changed

Program.cs

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ static void Main(string[] args)
3939
{
4040
Logger.SetLogFile(AppDomain.CurrentDomain.BaseDirectory + "Log.log");
4141
SetupExceptionHandlers();
42-
DowngradeManager.updater = new Updater("1.8.1", "https://github.com/ComputerElite/Oculus-downgrader", "Oculus downgrader", Assembly.GetExecutingAssembly().Location);
42+
DowngradeManager.updater = new Updater("1.8.2", "https://github.com/ComputerElite/Oculus-downgrader", "Oculus downgrader", Assembly.GetExecutingAssembly().Location);
4343
Logger.LogRaw("\n\n");
4444
Logger.Log("Starting Oculus downgrader version " + DowngradeManager.updater.version);
4545
if (args.Length == 1 && args[0] == "--update")
@@ -1029,10 +1029,33 @@ public void ShowVersions(string appId)
10291029
if(Directory.Exists(exe + "apps\\" + appId + "\\" + selected.id))
10301030
{
10311031
Logger.Log("Version is already downloaded. Asking if user wants to download a second time");
1032-
choice = auto ? "y" : ConsoleUiController.QuestionString("Seems like you already have the version " + selected.version + " downloaded. Do you want to download it again? (Y/n): ");
1032+
choice = auto ? "y" : ConsoleUiController.QuestionString("Seems like you already have the version " + selected.version + " (partially) downloaded. Do you want to download it again/resume the download? (Y/n): ");
10331033
if (choice.ToLower() == "n") return;
1034-
Console.WriteLine("Answer was yes. Deleting existing versions");
1035-
FileManager.RecreateDirectoryIfExisting(exe + "apps\\" + appId + "\\" + selected.id);
1034+
choice = choice = config.headset == Headset.RIFT ? auto ? "y" : ConsoleUiController.QuestionString("Do you want to download a completly fresh copy (n) or repair the existing one (which resumes failed downloads and repair any corrupted files; Y)? (Y/n): ") : "n";
1035+
string baseDirectory = commands.HasArgument("--destination") ? commands.GetValue("--destination") : exe + "apps\\" + appId + "\\" + selected.id + "\\";
1036+
if (choice.ToLower() == "n")
1037+
{
1038+
Logger.Log("Deleting old download");
1039+
Console.WriteLine("Deleting existing versions");
1040+
FileManager.RecreateDirectoryIfExisting(baseDirectory);
1041+
StartDownload(selected, appId, appName);
1042+
return;
1043+
} else
1044+
{
1045+
Console.WriteLine("Validating and repairing version");
1046+
1047+
GameDownloader.DownloadManifest(baseDirectory + "manifest.json", DecryptToken(), selected.id);
1048+
if(!Validator.RepairGameInstall(baseDirectory, baseDirectory + "manifest.json", DecryptToken(), selected.id))
1049+
{
1050+
Logger.Log("Repair failed");
1051+
Console.ForegroundColor = ConsoleColor.Red;
1052+
Console.WriteLine("Failed to repair/download game");
1053+
return;
1054+
}
1055+
Console.ForegroundColor= ConsoleColor.Green;
1056+
Console.WriteLine("Finished. App downloaded and ready to get launched.");
1057+
return;
1058+
}
10361059
}
10371060
Console.WriteLine("Starting download");
10381061
StartDownload(selected, appId, appName);

0 commit comments

Comments
 (0)