public void StartDownload() { if (DownloadManager.AddonFileExists(this)) { AddonObject obj = GetOtherInstalled(); if (obj != null) { if (Settings.isTosRunning()) { Settings.CauseError("Please close ToS before downloading a different version.", "Close ToS", Settings.CloseTos); return; } //Removes current installed addon DownloadManager.DeleteAddon(obj, false); } //Set the progress to 0 addonControl.DynamicNotificationBG.Width = 0; //Update the display currentDisplay.IsQueued = true; tabManager.PopulateAddon(this, 0, 0); DownloadManager.Queue(this, UpdateDownloadProgress); } else { Debug.WriteLine("File couldn't be found on github."); Settings.CauseError("File could not be found. Please contact the Author."); } }
public void StartUpdate() { if (!currentDisplay.hasUpdate) { return; } AddonObject newObj = GetNewest(); //The file can't be downloaded if (!DownloadManager.AddonFileExists(newObj)) { Settings.CauseError("File could not be found. Please contact the Author."); return; } //Make sure it isn't the exact same version if (newObj == currentDisplay) { Settings.CauseError("Cannot update to the same version."); return; } //Remove the current installed file Remove(true); //Set the display to the newest version currentDisplay = newObj; //Set the progress to 0 addonControl.DynamicNotificationBG.Width = 0; //Update the display tabManager.PopulateAddon(this, 0, 0); //Download the newest version DownloadManager.Queue(this, UpdateDownloadProgress); }