コード例 #1
0
        private void btnAddShowStatusColoring_Click(object sender, EventArgs e)
        {
            if (this.cboShowStatus.SelectedItem != null && !string.IsNullOrEmpty(this.txtShowStatusColor.Text))
            {
                try
                {
                    ShowStatusColoringType ssct = this.cboShowStatus.SelectedItem as ShowStatusColoringType;
                    if (!ColorTranslator.FromHtml(this.txtShowStatusColor.Text).IsEmpty&& ssct != null)
                    {
                        ListViewItem item = null;
                        item = this.lvwDefinedColors.FindItemWithText(ssct.Text);
                        if (item == null)
                        {
                            item = new ListViewItem();
                            item.SubItems.Add(this.txtShowStatusColor.Text);
                            this.lvwDefinedColors.Items.Add(item);
                        }

                        item.Text             = ssct.Text;
                        item.SubItems[1].Text = this.txtShowStatusColor.Text;
                        item.ForeColor        = ColorTranslator.FromHtml(this.txtShowStatusColor.Text);
                        item.Tag = ssct;
                        this.txtShowStatusColor.Text      = string.Empty;
                        this.txtShowStatusColor.ForeColor = Color.Black;
                    }
                }
                catch { }
            }
        }
コード例 #2
0
        private void FillTreeViewColoringShowStatusTypeCombobox()
        {
            //System.Collections.Generic.KeyValuePair<string, object> item = new System.Collections.Generic.KeyValuePair<string, object>();
            // Shows
            foreach (string status in Enum.GetNames(typeof(ShowItem.ShowAirStatus)))
            {
                ShowStatusColoringType t = new ShowStatusColoringType(true, true, status);
                //System.Collections.Generic.KeyValuePair<string, object> item = new System.Collections.Generic.KeyValuePair<string, object>("Show Seasons Status: " + status, new ShowStatusColoringType(true, true, status));
                this.cboShowStatus.Items.Add(t);
                //this.cboShowStatus.Items.Add("Show Seasons Status: " + status);
            }
            System.Collections.Generic.List <string> showStatusList = new System.Collections.Generic.List <string>();
            List <ShowItem> shows = this.mDoc.GetShowItems(false);

            foreach (ShowItem show in shows)
            {
                if (!showStatusList.Contains(show.ShowStatus))
                {
                    showStatusList.Add(show.ShowStatus);
                }
            }
            foreach (string status in showStatusList)
            {
                ShowStatusColoringType t = new ShowStatusColoringType(false, true, status);
                //System.Collections.Generic.KeyValuePair<string, object> item = new System.Collections.Generic.KeyValuePair<string, object>("Show  Status: " + status, new ShowStatusColoringType(false, true, status));
                this.cboShowStatus.Items.Add(t);
            }
            //this.cboShowStatus.Items.Add(new System.Collections.Generic.KeyValuePair<string, object>("Show Seasons Status: Custom", null));
            // Seasons
            foreach (string status in Enum.GetNames(typeof(Season.SeasonStatus)))
            {
                ShowStatusColoringType t = new ShowStatusColoringType(true, false, status);
                //System.Collections.Generic.KeyValuePair<string, object> item = new System.Collections.Generic.KeyValuePair<string, object>("Seasons Status: " + status, new ShowStatusColoringType(true, false, status));
                this.cboShowStatus.Items.Add(t);
                //this.cboShowStatus.Items.Add("Seasons Status: " + status);
            }
            this.cboShowStatus.DisplayMember = "Text";
            //this.cboShowStatus.ValueMember = ";
        }
コード例 #3
0
        public void load(XmlReader reader)
        {
            this.SetToDefaults();

            reader.Read();
            if (reader.Name != "Settings")
            {
                return; // bail out
            }
            reader.Read();
            while (!reader.EOF)
            {
                if ((reader.Name == "Settings") && !reader.IsStartElement())
                {
                    break; // all done
                }
                if (reader.Name == "Searcher")
                {
                    string srch = reader.ReadElementContentAsString(); // and match it based on name...
                    this.TheSearchers.CurrentSearch = srch;
                }
                else if (reader.Name == "TheSearchers")
                {
                    this.TheSearchers = new Searchers(reader.ReadSubtree());
                    reader.Read();
                }
                else if (reader.Name == "BGDownload")
                {
                    this.BGDownload = reader.ReadElementContentAsBoolean();
                }
                else if (reader.Name == "OfflineMode")
                {
                    this.OfflineMode = reader.ReadElementContentAsBoolean();
                }
                else if (reader.Name == "Replacements" && !reader.IsEmptyElement)
                {
                    this.Replacements.Clear();
                    reader.Read();
                    while (!reader.EOF)
                    {
                        if ((reader.Name == "Replacements") && (!reader.IsStartElement()))
                        {
                            break;
                        }
                        if (reader.Name == "Replace")
                        {
                            this.Replacements.Add(new Replacement(reader.GetAttribute("This"),
                                                                  reader.GetAttribute("That"),
                                                                  reader.GetAttribute("CaseInsensitive") == "Y"));
                            reader.Read();
                        }
                        else
                        {
                            reader.ReadOuterXml();
                        }
                    }
                    reader.Read();
                }
                else if (reader.Name == "ExportWTWRSS" && !reader.IsEmptyElement)
                {
                    this.ExportWTWRSS = reader.ReadElementContentAsBoolean();
                }
                else if (reader.Name == "ExportWTWRSSTo")
                {
                    this.ExportWTWRSSTo = reader.ReadElementContentAsString();
                }
                else if (reader.Name == "ExportWTWXML")
                {
                    this.ExportWTWXML = reader.ReadElementContentAsBoolean();
                }
                else if (reader.Name == "ExportWTWXMLTo")
                {
                    this.ExportWTWXMLTo = reader.ReadElementContentAsString();
                }
                else if (reader.Name == "WTWRecentDays")
                {
                    this.WTWRecentDays = reader.ReadElementContentAsInt();
                }
                else if (reader.Name == "StartupTab")
                {
                    int n = reader.ReadElementContentAsInt();
                    if (n == 6)
                    {
                        this.StartupTab = 2;       // WTW is moved
                    }
                    else if ((n >= 1) && (n <= 3)) // any of the three scans
                    {
                        this.StartupTab = 1;
                    }
                    else
                    {
                        this.StartupTab = 0; // otherwise, My Shows
                    }
                }
                else if (reader.Name == "StartupTab2")
                {
                    this.StartupTab = TabNumberFromName(reader.ReadElementContentAsString());
                }
                else if (reader.Name == "DefaultNamingStyle") // old naming style
                {
                    this.NamingStyle.StyleString = CustomName.OldNStyle(reader.ReadElementContentAsInt());
                }
                else if (reader.Name == "NamingStyle")
                {
                    this.NamingStyle.StyleString = reader.ReadElementContentAsString();
                }
                else if (reader.Name == "NotificationAreaIcon")
                {
                    this.NotificationAreaIcon = reader.ReadElementContentAsBoolean();
                }
                else if ((reader.Name == "GoodExtensions") || (reader.Name == "VideoExtensions"))
                {
                    this.VideoExtensionsString = reader.ReadElementContentAsString();
                }
                else if (reader.Name == "OtherExtensions")
                {
                    this.OtherExtensionsString = reader.ReadElementContentAsString();
                }
                else if (reader.Name == "ExportRSSMaxDays")
                {
                    this.ExportRSSMaxDays = reader.ReadElementContentAsInt();
                }
                else if (reader.Name == "ExportRSSMaxShows")
                {
                    this.ExportRSSMaxShows = reader.ReadElementContentAsInt();
                }
                else if (reader.Name == "ExportRSSDaysPast")
                {
                    this.ExportRSSDaysPast = reader.ReadElementContentAsInt();
                }
                else if (reader.Name == "KeepTogether")
                {
                    this.KeepTogether = reader.ReadElementContentAsBoolean();
                }
                else if (reader.Name == "LeadingZeroOnSeason")
                {
                    this.LeadingZeroOnSeason = reader.ReadElementContentAsBoolean();
                }
                else if (reader.Name == "ShowInTaskbar")
                {
                    this.ShowInTaskbar = reader.ReadElementContentAsBoolean();
                }
                else if (reader.Name == "RenameTxtToSub")
                {
                    this.RenameTxtToSub = reader.ReadElementContentAsBoolean();
                }
                else if (reader.Name == "ShowEpisodePictures")
                {
                    this.ShowEpisodePictures = reader.ReadElementContentAsBoolean();
                }
                else if (reader.Name == "AutoSelectShowInMyShows")
                {
                    this.AutoSelectShowInMyShows = reader.ReadElementContentAsBoolean();
                }
                else if (reader.Name == "SpecialsFolderName")
                {
                    this.SpecialsFolderName = reader.ReadElementContentAsString();
                }
                else if (reader.Name == "SABAPIKey")
                {
                    this.SABAPIKey = reader.ReadElementContentAsString();
                }
                else if (reader.Name == "CheckSABnzbd")
                {
                    this.CheckSABnzbd = reader.ReadElementContentAsBoolean();
                }
                else if (reader.Name == "SABHostPort")
                {
                    this.SABHostPort = reader.ReadElementContentAsString();
                }
                else if (reader.Name == "PreferredLanguage")
                {
                    this.PreferredLanguage = reader.ReadElementContentAsString();
                }
                else if (reader.Name == "WTWDoubleClick")
                {
                    this.WTWDoubleClick = (WTWDoubleClickAction)reader.ReadElementContentAsInt();
                }
                else if (reader.Name == "ExportMissingXML")
                {
                    this.ExportMissingXML = reader.ReadElementContentAsBoolean();
                }
                else if (reader.Name == "ExportMissingXMLTo")
                {
                    this.ExportMissingXMLTo = reader.ReadElementContentAsString();
                }
                else if (reader.Name == "ExportMissingCSV")
                {
                    this.ExportMissingCSV = reader.ReadElementContentAsBoolean();
                }
                else if (reader.Name == "ExportMissingCSVTo")
                {
                    this.ExportMissingCSVTo = reader.ReadElementContentAsString();
                }
                else if (reader.Name == "ExportRenamingXML")
                {
                    this.ExportRenamingXML = reader.ReadElementContentAsBoolean();
                }
                else if (reader.Name == "ExportRenamingXMLTo")
                {
                    this.ExportRenamingXMLTo = reader.ReadElementContentAsString();
                }
                else if (reader.Name == "ExportFOXML")
                {
                    this.ExportFOXML = reader.ReadElementContentAsBoolean();
                }
                else if (reader.Name == "ExportFOXMLTo")
                {
                    this.ExportFOXMLTo = reader.ReadElementContentAsString();
                }
                else if (reader.Name == "ForceLowercaseFilenames")
                {
                    this.ForceLowercaseFilenames = reader.ReadElementContentAsBoolean();
                }
                else if (reader.Name == "IgnoreSamples")
                {
                    this.IgnoreSamples = reader.ReadElementContentAsBoolean();
                }
                else if (reader.Name == "SampleFileMaxSizeMB")
                {
                    this.SampleFileMaxSizeMB = reader.ReadElementContentAsInt();
                }
                else if (reader.Name == "ParallelDownloads")
                {
                    this.ParallelDownloads = reader.ReadElementContentAsInt();
                }
                else if (reader.Name == "uTorrentPath")
                {
                    this.uTorrentPath = reader.ReadElementContentAsString();
                }
                else if (reader.Name == "ResumeDatPath")
                {
                    this.ResumeDatPath = reader.ReadElementContentAsString();
                }
                else if (reader.Name == "SearchRSS")
                {
                    this.SearchRSS = reader.ReadElementContentAsBoolean();
                }
                else if (reader.Name == "EpImgs")
                {
                    this.EpTBNs = reader.ReadElementContentAsBoolean();
                }
                else if (reader.Name == "NFOs")
                {
                    this.NFOs = reader.ReadElementContentAsBoolean();
                }
                else if (reader.Name == "XBMCImages")
                {
                    this.XBMCImages = reader.ReadElementContentAsBoolean();
                }
                else if (reader.Name == "pyTivoMeta")
                {
                    this.pyTivoMeta = reader.ReadElementContentAsBoolean();
                }
                else if (reader.Name == "pyTivoMetaSubFolder")
                {
                    this.pyTivoMetaSubFolder = reader.ReadElementContentAsBoolean();
                }
                else if (reader.Name == "FolderJpg")
                {
                    this.FolderJpg = reader.ReadElementContentAsBoolean();
                }
                else if (reader.Name == "FolderJpgIs")
                {
                    this.FolderJpgIs = (FolderJpgIsType)reader.ReadElementContentAsInt();
                }
                else if (reader.Name == "MonitoredFoldersScanType")
                {
                    this.MonitoredFoldersScanType = (ScanType)reader.ReadElementContentAsInt();
                }
                else if (reader.Name == "SelectedXBMCType")
                {
                    this.SelectedXBMCType = (XBMCType)reader.ReadElementContentAsInt();
                }
                else if (reader.Name == "RenameCheck")
                {
                    this.RenameCheck = reader.ReadElementContentAsBoolean();
                }
                else if (reader.Name == "CheckuTorrent")
                {
                    this.CheckuTorrent = reader.ReadElementContentAsBoolean();
                }
                else if (reader.Name == "MissingCheck")
                {
                    this.MissingCheck = reader.ReadElementContentAsBoolean();
                }
                else if (reader.Name == "SearchLocally")
                {
                    this.SearchLocally = reader.ReadElementContentAsBoolean();
                }
                else if (reader.Name == "LeaveOriginals")
                {
                    this.LeaveOriginals = reader.ReadElementContentAsBoolean();
                }
                else if (reader.Name == "LookForDateInFilename")
                {
                    LookForDateInFilename = reader.ReadElementContentAsBoolean();
                }
                else if (reader.Name == "MonitorFolders")
                {
                    this.MonitorFolders = reader.ReadElementContentAsBoolean();
                }
                else if (reader.Name == "EpJPGs")
                {
                    this.EpJPGs = reader.ReadElementContentAsBoolean();
                }
                else if (reader.Name == "SeriesJpg")
                {
                    this.SeriesJpg = reader.ReadElementContentAsBoolean();
                }
                else if (reader.Name == "Mede8erXML")
                {
                    this.Mede8erXML = reader.ReadElementContentAsBoolean();
                }
                else if (reader.Name == "ShrinkLargeMede8erImages")
                {
                    this.ShrinkLargeMede8erImages = reader.ReadElementContentAsBoolean();
                }
                else if (reader.Name == "FanArtJpg")
                {
                    this.FanArtJpg = reader.ReadElementContentAsBoolean();
                }
                else if (reader.Name == "DeleteEmpty")
                {
                    this.Tidyup.DeleteEmpty = reader.ReadElementContentAsBoolean();
                }
                else if (reader.Name == "DeleteEmptyIsRecycle")
                {
                    this.Tidyup.DeleteEmptyIsRecycle = reader.ReadElementContentAsBoolean();
                }
                else if (reader.Name == "EmptyIgnoreWords")
                {
                    this.Tidyup.EmptyIgnoreWords = reader.ReadElementContentAsBoolean();
                }
                else if (reader.Name == "EmptyIgnoreWordList")
                {
                    this.Tidyup.EmptyIgnoreWordList = reader.ReadElementContentAsString();
                }
                else if (reader.Name == "EmptyIgnoreExtensions")
                {
                    this.Tidyup.EmptyIgnoreExtensions = reader.ReadElementContentAsBoolean();
                }
                else if (reader.Name == "EmptyIgnoreExtensionList")
                {
                    this.Tidyup.EmptyIgnoreExtensionList = reader.ReadElementContentAsString();
                }
                else if (reader.Name == "EmptyMaxSizeCheck")
                {
                    this.Tidyup.EmptyMaxSizeCheck = reader.ReadElementContentAsBoolean();
                }
                else if (reader.Name == "EmptyMaxSizeMB")
                {
                    this.Tidyup.EmptyMaxSizeMB = reader.ReadElementContentAsInt();
                }

                else if (reader.Name == "FNPRegexs" && !reader.IsEmptyElement)
                {
                    this.FNPRegexs.Clear();
                    reader.Read();
                    while (!reader.EOF)
                    {
                        if ((reader.Name == "FNPRegexs") && (!reader.IsStartElement()))
                        {
                            break;
                        }
                        if (reader.Name == "Regex")
                        {
                            string s  = reader.GetAttribute("Enabled");
                            bool   en = s == null || bool.Parse(s);

                            this.FNPRegexs.Add(new FilenameProcessorRE(en, reader.GetAttribute("RE"),
                                                                       bool.Parse(reader.GetAttribute("UseFullPath")),
                                                                       reader.GetAttribute("Notes")));
                            reader.Read();
                        }
                        else
                        {
                            reader.ReadOuterXml();
                        }
                    }
                    reader.Read();
                }
                else if (reader.Name == "RSSURLs" && !reader.IsEmptyElement)
                {
                    this.RSSURLs.Clear();
                    reader.Read();
                    while (!reader.EOF)
                    {
                        if ((reader.Name == "RSSURLs") && (!reader.IsStartElement()))
                        {
                            break;
                        }
                        if (reader.Name == "URL")
                        {
                            this.RSSURLs.Add(reader.ReadElementContentAsString());
                        }
                        else
                        {
                            reader.ReadOuterXml();
                        }
                    }
                    reader.Read();
                }
                else if (reader.Name == "ShowStatusTVWColors" && !reader.IsEmptyElement)
                {
                    this.ShowStatusColors = new ShowStatusColoringTypeList();
                    reader.Read();
                    while (!reader.EOF)
                    {
                        if ((reader.Name == "ShowStatusTVWColors") && (!reader.IsStartElement()))
                        {
                            break;
                        }
                        if (reader.Name == "ShowStatusTVWColor")
                        {
                            ShowStatusColoringType type = null;
                            try
                            {
                                string showStatus  = reader.GetAttribute("ShowStatus");
                                bool   isMeta      = bool.Parse(reader.GetAttribute("IsMeta"));
                                bool   isShowLevel = bool.Parse(reader.GetAttribute("IsShowLevel"));

                                type = new ShowStatusColoringType(isMeta, isShowLevel, showStatus);
                            }
                            catch
                            {
                            }

                            string color = reader.GetAttribute("Color");
                            if (type != null && !string.IsNullOrEmpty(color))
                            {
                                try
                                {
                                    System.Drawing.Color c = System.Drawing.ColorTranslator.FromHtml(color);
                                    this.ShowStatusColors.Add(type, c);
                                }
                                catch
                                {
                                }
                            }
                            reader.Read();
                        }
                        else
                        {
                            reader.ReadOuterXml();
                        }
                    }
                    reader.Read();
                }
                else
                {
                    reader.ReadOuterXml();
                }
            }
        }