public Format(string name, bool download) { InitializeComponent(); Text = download ? name + " - Select Download Options" : name + " - Change Download Options"; butOk.Text = download ? "Download" : "Change"; foreach (Quality q in Enum.GetValues(typeof(Quality))) cmbQuality.Items.Add(q.ToText()); cmbQuality.SelectedIndexChanged += (a, b) => { if (cmbQuality.SelectedIndex != -1) FileQuality = (Quality) cmbQuality.SelectedIndex; }; foreach (ADBaseLibrary.Format f in Enum.GetValues(typeof(ADBaseLibrary.Format))) { chkListBox.Items.Add(f.ToText(), false); } int tl = 0; chkListBox.ItemCheck += (a, b) => { tl += 18; ADBaseLibrary.Format[] fmts=Enum.GetValues(typeof (ADBaseLibrary.Format)).Cast<ADBaseLibrary.Format>().ToArray(); if (b.NewValue==CheckState.Checked) { _formats |= fmts[b.Index]; } else if (b.NewValue == CheckState.Unchecked) { _formats &= ~fmts[b.Index]; } }; chkListBox.Height = tl; }
public MultiSelect(bool follow, string showname) { InitializeComponent(); _follow = follow; this.Text = (follow ? " Follow " : string.Empty) + showname + " - " + (follow ? "Select additional Episodes to download..." : "Select Episodes to download..."); butOk.Text = follow ? "Follow" : "Download"; olvFile.AspectGetter = (d) => { Episode e = (Episode)d; return(TemplateParser.FilenameFromEpisode(e, _quality, Settings.Instance.DownloadTemplate)); }; foreach (Quality q in Enum.GetValues(typeof(Quality))) { cmbQuality.Items.Add(q.ToText()); } cmbQuality.SelectedIndexChanged += (a, b) => { if (cmbQuality.SelectedIndex != -1) { FileQuality = (Quality)cmbQuality.SelectedIndex; } }; int tl = 0; foreach (ADBaseLibrary.Format f in Enum.GetValues(typeof(ADBaseLibrary.Format))) { tl += 18; chkListBox.Items.Add(f.ToText(), false); } chkListBox.Height = tl; chkListBox.ItemCheck += (a, b) => { ADBaseLibrary.Format[] fmts = Enum.GetValues(typeof(ADBaseLibrary.Format)).Cast <ADBaseLibrary.Format>().ToArray(); if (b.NewValue == CheckState.Checked) { _formats |= fmts[b.Index]; } else if (b.NewValue == CheckState.Unchecked) { _formats &= ~fmts[b.Index]; } }; }
public MultiSelect(bool follow, string showname) { InitializeComponent(); _follow = follow; this.Text = (follow ? " Follow " : string.Empty) + showname+" - "+(follow ? "Select additional Episodes to download..." : "Select Episodes to download..."); butOk.Text = follow ? "Follow" : "Download"; olvFile.AspectGetter = (d) => { Episode e = (Episode) d; return TemplateParser.FilenameFromEpisode(e,_quality,Settings.Instance.DownloadTemplate); }; foreach (Quality q in Enum.GetValues(typeof(Quality))) cmbQuality.Items.Add(q.ToText()); cmbQuality.SelectedIndexChanged += (a, b) => { if (cmbQuality.SelectedIndex != -1) FileQuality = (Quality)cmbQuality.SelectedIndex; }; int tl = 0; foreach (ADBaseLibrary.Format f in Enum.GetValues(typeof(ADBaseLibrary.Format))) { tl += 18; chkListBox.Items.Add(f.ToText(), false); } chkListBox.Height = tl; chkListBox.ItemCheck += (a, b) => { ADBaseLibrary.Format[] fmts = Enum.GetValues(typeof(ADBaseLibrary.Format)).Cast<ADBaseLibrary.Format>().ToArray(); if (b.NewValue == CheckState.Checked) { _formats |= fmts[b.Index]; } else if (b.NewValue == CheckState.Unchecked) { _formats &= ~fmts[b.Index]; } }; }
public void AddDownloadEpisode(Episode ep, Quality quality, ADBaseLibrary.Format format, bool logerror = true) { if (IsInDownloadList(ep.Id, quality)) { if (logerror) { Log(LogType.Info, TemplateParser.FilenameFromEpisode(ep, quality, Settings.Instance.DownloadTemplate) + " was already added"); } } else { DownloadItem dinfo = _manager.Add(EpisodeWithDownloadSettings.FromEpisode(ep, quality, format), Settings.Instance.DownloadTemplate, Settings.Instance.DownloadPath); Log(LogType.Info, "Adding " + dinfo.DownloadInfo.FileName + " to downloads"); objDownloads.AddObject(dinfo); if (objDownloads.Items.Count == 1) { objDownloads.SelectedObject = dinfo; } RefreshInfo(); } }
public Format(string name, bool download) { InitializeComponent(); Text = download ? name + " - Select Download Options" : name + " - Change Download Options"; butOk.Text = download ? "Download" : "Change"; foreach (Quality q in Enum.GetValues(typeof(Quality))) { cmbQuality.Items.Add(q.ToText()); } cmbQuality.SelectedIndexChanged += (a, b) => { if (cmbQuality.SelectedIndex != -1) { FileQuality = (Quality)cmbQuality.SelectedIndex; } }; foreach (ADBaseLibrary.Format f in Enum.GetValues(typeof(ADBaseLibrary.Format))) { chkListBox.Items.Add(f.ToText(), false); } int tl = 0; chkListBox.ItemCheck += (a, b) => { tl += 18; ADBaseLibrary.Format[] fmts = Enum.GetValues(typeof(ADBaseLibrary.Format)).Cast <ADBaseLibrary.Format>().ToArray(); if (b.NewValue == CheckState.Checked) { _formats |= fmts[b.Index]; } else if (b.NewValue == CheckState.Unchecked) { _formats &= ~fmts[b.Index]; } }; chkListBox.Height = tl; }