static FieldGetter() { formatingRule fr = null; // hide the episodesummary if option is set fr = new formatingRule(delegate(string value, string field, DBTable item) { DBEpisode e = item as DBEpisode; if (null == e) { return(false); } return(field == "<Episode.Summary>" && DBOption.GetOptions(DBOption.cHideUnwatchedSummary) && !e[DBOnlineEpisode.cWatched]); }, delegate(string value, string field, DBTable item) { return(Translation._Hidden_to_prevent_spoilers_); }); formatingRules.Add(fr); // replace seasonindex and episodeindex for different episode sortby // skins using these properties will display correct indexes based on sort order fr = new formatingRule(delegate(string value, string field, DBTable item) { DBEpisode e = item as DBEpisode; if (null == e) { return(false); } if (field.Contains("<Episode.SeasonIndex>") || field.Contains("<Episode.EpisodeIndex>")) { DBSeries s = Helper.getCorrespondingSeries(e[DBOnlineEpisode.cSeriesID]); if (null != s && s[DBOnlineSeries.cEpisodeSortOrder] == "DVD") { return(true); } } return(false); }, delegate(string value, string field, DBTable item) { string replacement = string.Empty; replacement = field.Replace("<Episode.SeasonIndex>", "<Episode.Combined_season>"); replacement = replacement.Replace("<Episode.EpisodeIndex>", "<Episode.Combined_episodenumber>"); return(resolveDynString(replacement, item)); }); formatingRules.Add(fr); fr = new formatingRule("\\n", Environment.NewLine); formatingRules.Add(fr); fr = new formatingRule("''", "'"); formatingRules.Add(fr); fr = new formatingRule("\\\"", "\""); formatingRules.Add(fr); fr = new formatingRule("\\'", "'"); formatingRules.Add(fr); fr = new formatingRule(Translation.Season + @"\:{0,1}\s{0,2}0", Translation.specials, true); formatingRules.Add(fr); fr = new formatingRule(@"Season\:{0,1}\s{0,2}0", Translation.specials, true); formatingRules.Add(fr); fr = new formatingRule(@"Season\:{0,1}\s{0,2}", Translation.Season + " ", true); formatingRules.Add(fr); fr = new formatingRule(@"(?<!\d)0x\d{1,3}", Translation.special + " ", true); formatingRules.Add(fr); // enable user to show 0/1 as Boolean (will show up as Yes/No) fr = new formatingRule("asBool(0)", Translation.No); formatingRules.Add(fr); fr = new formatingRule("asBool(1)", Translation.Yes); formatingRules.Add(fr); // want to ensure these show as is nonFormattingFields.Add("<Episode.EpisodeFilename>"); //_dateFormat = DBOption.GetOptions(DBOption.cDateFormatString); _dateFormat = System.Globalization.DateTimeFormatInfo.CurrentInfo.ShortDatePattern; _formatDates = !String.IsNullOrEmpty(_dateFormat) && DBOption.GetOptions(DBOption.cUseRegionalDateFormatString); }
static FieldGetter() { formatingRule fr = null; // hide the episodesummary if option is set fr = new formatingRule(delegate(string value, string field, DBTable item) { DBEpisode e = item as DBEpisode; if (null == e) return false; return field == "<Episode.Summary>" && DBOption.GetOptions(DBOption.cView_Episode_HideUnwatchedSummary) && !e[DBOnlineEpisode.cWatched]; }, delegate(string value, string field, DBTable item) { return Translation._Hidden_to_prevent_spoilers_; }); formatingRules.Add(fr); // replace seasonindex and episodeindex for different episode sortby // skins using these properties will display correct indexes based on sort order fr = new formatingRule(delegate(string value, string field, DBTable item) { DBEpisode e = item as DBEpisode; if (null == e) return false; if (field.Contains("<Episode.SeasonIndex>") || field.Contains("<Episode.EpisodeIndex>")) { DBSeries s = Helper.getCorrespondingSeries(e[DBOnlineEpisode.cSeriesID]); if (null != s && s[DBOnlineSeries.cEpisodeSortOrder] == "DVD") return true; } return false; }, delegate(string value, string field, DBTable item) { string replacement = string.Empty; replacement = field.Replace("<Episode.SeasonIndex>", "<Episode.Combined_season>"); replacement = replacement.Replace("<Episode.EpisodeIndex>", "<Episode.Combined_episodenumber>"); return resolveDynString(replacement, item); }); formatingRules.Add(fr); fr = new formatingRule("\\n", Environment.NewLine); formatingRules.Add(fr); fr = new formatingRule("''", "'"); formatingRules.Add(fr); fr = new formatingRule("\\\"", "\""); formatingRules.Add(fr); fr = new formatingRule("\\'", "'"); formatingRules.Add(fr); fr = new formatingRule(Translation.Season + @"\:{0,1}\s{0,2}0", Translation.specials, true); formatingRules.Add(fr); fr = new formatingRule(@"Season\:{0,1}\s{0,2}0", Translation.specials, true); formatingRules.Add(fr); fr = new formatingRule(@"Season\:{0,1}\s{0,2}", Translation.Season + " ", true); formatingRules.Add(fr); fr = new formatingRule(@"(?<!\d)0x\d{1,3}", Translation.special + " ", true); formatingRules.Add(fr); // enable user to show 0/1 as Boolean (will show up as Yes/No) fr = new formatingRule("asBool(0)", Translation.No); formatingRules.Add(fr); fr = new formatingRule("asBool(1)", Translation.Yes); formatingRules.Add(fr); // want to ensure these show as is nonFormattingFields.Add("<Episode.EpisodeFilename>"); //_dateFormat = DBOption.GetOptions(DBOption.cDateFormatString); _dateFormat = System.Globalization.DateTimeFormatInfo.CurrentInfo.ShortDatePattern; _formatDates = !String.IsNullOrEmpty(_dateFormat) && DBOption.GetOptions(DBOption.cUseRegionalDateFormatString); }