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);
        }
        public void GenerateList()
        {
            installedAddons = new Dictionary <string, AddonDisplayObject>();
            var _installedAddons = DownloadManager.GetInstalledAddons();

            foreach (AddonObject addon in _installedAddons)
            {
                AddonDisplayObject _instAddonDisplay = new AddonDisplayObject();

                addon.SetDefaults();

                _instAddonDisplay.currentDisplay  = addon;
                _instAddonDisplay.InstalledAddons = this;
                _instAddonDisplay.addons          = new List <AddonObject> {
                    addon
                };

                if (installedAddons.ContainsKey(addon.addon.file))
                {
                    if (installedAddons[addon.addon.file].addons == null)
                    {
                        installedAddons[addon.addon.file].addons = new List <AddonObject>();
                    }

                    //is it the same version? Technically shouldn't happen but still does
                    if (installedAddons[addon.addon.file].addons[0] == addon)
                    {
                        //Debug.WriteLine("Found same addons: " + addon.addon.file + " V1: " + installedAddons[addon.addon.file].addons[0].addon.fileVersion + " V2: " + addon.addon.fileVersion);
                        installedAddons[addon.addon.file].addons.Add(addon);
                    }
                }
                else
                {
                    installedAddons.Add(addon.addon.file, _instAddonDisplay);
                }
            }
        }
        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);
            }
        }