internal void removeFromOutdated(ContentClass addon) { if (this.outdatedAddons.Contains(addon)) { this.outdatedAddons.Remove(addon); } }
internal void addSize(ContentClass sender) { int i = this.toHash.FindIndex(x => x == sender); this.sizes[i] = sender.totalSize; this.totalSize += sender.totalSize; }
internal void informWorkerSize(ContentClass addon) { if (this.md5Worker != null) { this.md5Worker.addSize(addon); } }
internal void AddonProgress(ContentClass addon, double progress) { if ((this.md5Worker != null) && (this.MD5ProgressChanged != null)) { this.md5Worker.updateProgress(addon, progress); this.MD5ProgressChanged(this, new MD5ProgressChangedEventArgs(md5Worker.totalProgress)); } }
internal void SetAddonSelected(int id, bool selected) { ContentClass addon = getAddonByID(id); if (addon != null) { SetAddonSelected(addon, selected); } }
internal void SetAddonSelected(string name, bool selected) { ContentClass addon = getAddonByName(name); if (addon != null) { SetAddonSelected(addon, selected); } }
internal bool checkPassword(ContentClass addon, string password) { if (!addon.protection) { return(true); } else { return(checkTyped(password, addon.password)); } }
internal bool GetAddonSelected(ContentClass addon) { if (addon != null) { return(addon.isActive); } else { return(false); } }
internal bool checkPassword(ContentClass addon, string hash, bool some) { if (!addon.protection) { return(true); } else { return(checkSaved(hash, addon.password)); } }
internal bool GetAddonSelected(int id) { ContentClass addon = getAddonByID(id); if (addon != null) { return(addon.isActive); } else { return(false); } }
internal bool GetAddonSelected(string name) { ContentClass addon = getAddonByName(name); if (addon != null) { return(addon.isActive); } else { return(false); } }
internal double updateProgress(ContentClass sender, double progress) { int i = this.toHash.FindIndex(x => x == sender); this.progressList[i] = progress; this.totalProgress = 0.0; for (int k = 0; k < this.toHash.Count; k++) { this.totalProgress += this.progressList[k] * this.sizes[k]; } this.totalProgress /= this.totalSize; return(this.totalProgress); }
internal void SetAddonSelected(ContentClass addon, bool selected, bool ignoreSettings) { if ((selected) && (!this.selectedAddons.Contains(addon))) { this.selectedAddons.RemoveAll(x => x == addon); this.selectedAddons.Add(addon); addon.setSelected(selected, ignoreSettings); } else if ((!selected) && (this.selectedAddons.Contains(addon))) { this.selectedAddons.RemoveAll(x => x == addon); addon.setSelected(selected, ignoreSettings); } }
internal ContentClass getAddonByID(int id) { ContentClass found = null; foreach (ContentClass addon in this.availableAddons) { if (addon.ID == id) { if (found == null) { found = addon; } else { ContentManagerException e = new ContentManagerException(addon, "Only one addon per ID is supported."); throw e; } } } return(found); }
internal ContentClass getAddonByName(string name) { ContentClass found = null; foreach (ContentClass addon in this.availableAddons) { if (addon.name == name) { if (found == null) { found = addon; } else { ContentManagerException e = new ContentManagerException(addon, "More then one addon of this name."); throw e; } } } return(found); }
internal void SetAddonSelected(ContentClass addon, bool selected) { if ((selected) && (!this.selectedAddons.Contains(addon))) { addon.addonState = AddonState.Installed; this.selectedAddons.RemoveAll(x => x == addon); this.selectedAddons.Add(addon); addon.setSelected(selected); //if (this.getUpToDateAddons().Contains(addon)) // this.Parent.quietSeed.Restart(); } else if ((!selected) && (this.selectedAddons.Contains(addon))) { addon.addonState = AddonState.NotInstalled; bool restart = (this.getUpToDateAddons().Contains(addon)); this.selectedAddons.RemoveAll(x => x == addon); addon.setSelected(selected); //if (restart) // this.Parent.quietSeed.Restart(); } }
private void getAddonImage(ContentClass addon) { WebClient webClient = new WebClient(); webClient.DownloadFileCompleted += new AsyncCompletedEventHandler( delegate(object o, AsyncCompletedEventArgs args) { if (args.Error != null) { if (args.Error.GetType() == (typeof(WebException))) { MessageBox.Show("Could not connect to the server.\nA Please check your connections and/or try again later.\nProgram will shut down."); Environment.Exit(4); } } this.label6.Visible = false; this.label6.Enabled = false; this.pictureBox1.ImageLocation = Path.Combine(this.localAppDataFolder, addon.ID + addon.pictureType); this.pictureBox1.Visible = true; this.pictureBox1.Enabled = true; webClient.Dispose(); }); webClient.DownloadFileAsync(addon.pictureURL, Path.Combine(this.localAppDataFolder, addon.ID + addon.pictureType)); }
private void listBox1_SelectedValueChanged(object sender, EventArgs e) { if (listBox1.SelectedItem == null) { return; } this.activeAddon = contentManager.getAddonByName(listBox1.Text); this.label3.Text = this.activeAddon.name + " v." + this.activeAddon.version; this.label4.Text = this.activeAddon.addonState.ToString().Replace("sR", "s R").Replace("tI", "t I").Replace("eA", "e A"); this.label5.Text = "Current Status:"; this.label4.ForeColor = getStateColor(this.activeAddon.addonState); this.richTextBox1.Text = this.activeAddon.description; this.toolTip1.SetToolTip(linkLabel1, this.activeAddon.contact.ToString()); //this.checkBox1.Checked = this.activeAddon.isActive; if (this.activeAddon.isActive) { this.button5.Text = "Remove"; } else { this.button5.Text = "Install"; } if (!(File.Exists(Path.Combine(this.localAppDataFolder, this.activeAddon.ID + this.activeAddon.pictureType)))) { getAddonImage(this.activeAddon); //this.pictureBox1.ImageLocation = Path.Combine(this.localAppDataFolder, "placeholder.png"); this.pictureBox1.Visible = false; this.pictureBox1.Enabled = false; this.label6.Enabled = true; this.label6.Visible = true; } else { this.pictureBox1.ImageLocation = Path.Combine(this.localAppDataFolder, this.activeAddon.ID + this.activeAddon.pictureType); } }
internal void setOnly(ContentClass addon) { this.tempList = new List <ContentClass>(this.selectedAddons); this.selectedAddons.RemoveAll(x => x != addon); }