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 Remove(bool isUpdate = false) { if (Settings.isTosRunning()) { Settings.CauseError("Please close ToS before " + (isUpdate ? "updating" : "removing") + " addons.", "Close ToS", Settings.CloseTos); return; } if (!isUpdate) { AddonObject installedObj = GetOtherInstalled(); //Remove it from the list if there isn't another installed one if (installedObj == null) { InstalledAddons.RemoveAddon(this); DownloadManager.DeleteAddon(this); } else //Remove it and update the display to the installed one { DownloadManager.DeleteAddon(this, false); //Set it to uninstalled currentDisplay.isInstalled = false; //Update the display currentDisplay = installedObj; tabManager.PopulateAddon(this, 0, 0); } } else { currentDisplay.isInstalled = false; currentDisplay.hasUpdate = false; DownloadManager.DeleteAddon(this, false); } }