Add --no-rclone-updating flag

This commit is contained in:
Chax
2023-06-18 15:52:31 +02:00
parent ee5222165c
commit 80a85f3858
2 changed files with 20 additions and 14 deletions

View File

@@ -55,6 +55,7 @@ namespace AndroidSideloader
private bool isLoading = true;
public static bool isOffline = false;
public static bool noRcloneUpdating = false;
public static bool hasPublicConfig = false;
public static bool enviromentCreated = false;
public static PublicConfig PublicConfigFile;
@@ -70,6 +71,10 @@ namespace AndroidSideloader
{
isOffline = true;
}
if ( arg =="--no-rclone-update")
{
noRcloneUpdating = true;
}
}
if (isOffline)
{

View File

@@ -336,24 +336,25 @@ namespace AndroidSideloader
var versionInfo = FileVersionInfo.GetVersionInfo(pathToRclone);
string version = versionInfo.ProductVersion;
Logger.Log($"Current RCLONE Version {version}");
if (version != "1.62.2")
if (!MainForm.noRcloneUpdating)
{
Logger.Log("RCLONE Version not matching! Downloading required version.", "WARNING");
File.Delete(pathToRclone);
currentAccessedWebsite = "rclone";
string architecture = Environment.Is64BitOperatingSystem ? "amd64" : "386";
string url = $"https://downloads.rclone.org/v1.62.2/rclone-v1.62.2-windows-{architecture}.zip";
client.DownloadFile(url, "rclone.zip");
Utilities.Zip.ExtractFile(Path.Combine(Environment.CurrentDirectory, "rclone.zip"), Environment.CurrentDirectory);
File.Delete("rclone.zip");
string rcloneDirectory = Path.Combine(Environment.CurrentDirectory, $"rclone-v1.62.2-windows-{architecture}");
File.Move(Path.Combine(rcloneDirectory, "rclone.exe"), pathToRclone);
Directory.Delete(rcloneDirectory, true);
if (version != "1.62.2")
{
Logger.Log("RCLONE Version not matching! Downloading required version.", "WARNING");
File.Delete(pathToRclone);
currentAccessedWebsite = "rclone";
string architecture = Environment.Is64BitOperatingSystem ? "amd64" : "386";
string url = $"https://downloads.rclone.org/v1.62.2/rclone-v1.62.2-windows-{architecture}.zip";
client.DownloadFile(url, "rclone.zip");
Utilities.Zip.ExtractFile(Path.Combine(Environment.CurrentDirectory, "rclone.zip"), Environment.CurrentDirectory);
File.Delete("rclone.zip");
string rcloneDirectory = Path.Combine(Environment.CurrentDirectory, $"rclone-v1.62.2-windows-{architecture}");
File.Move(Path.Combine(rcloneDirectory, "rclone.exe"), pathToRclone);
Directory.Delete(rcloneDirectory, true);
}
}
}
}
}
catch (Exception ex)
{