예제 #1
0
 private IEnumerable <LogFile> FilterResults(List <LogFile> logFiles)
 {
     logFiles.Sort();
     if (this.ContainsParameter(x => x.LogFileId))
     {
         return(logFiles.Where(x => this.LogFileId.Contains(x.LogFileId)));
     }
     if (this.ContainsParameter(x => x.Name))
     {
         IEqualityComparer <string> ig = SonarrFactory.NewIgnoreCase();
         return(logFiles.Where(x => this.Name.Contains(x.FileName, ig)));
     }
     else
     {
         return(logFiles);
     }
 }
예제 #2
0
        public ReplaceHashtable(IDictionary dict)
        {
            IEqualityComparer <string> ieq = SonarrFactory.NewIgnoreCase();

            this.Ignored  = new JsonStringSet();
            this.Required = new JsonStringSet();

            IEnumerable <string> keys = dict.Keys.Cast <string>();

            if (keys.Contains(IGNORED, ieq))
            {
                string ikey = keys.FirstOrDefault(x => x.Equals(IGNORED, StringComparison.CurrentCultureIgnoreCase));
                if (dict[ikey] is IEnumerable enumerable1)
                {
                    foreach (IConvertible icon1 in enumerable1)
                    {
                        this.Ignored.Add(Convert.ToString(icon1));
                    }
                }
                else if (dict[ikey] is string str1)
                {
                    this.Ignored.Add(str1);
                }
            }
            if (keys.Contains(REQUIRED, ieq))
            {
                string rkey = keys.FirstOrDefault(x => x.Equals(REQUIRED, StringComparison.CurrentCultureIgnoreCase));
                if (dict[rkey] is IEnumerable enumerable2)
                {
                    foreach (IConvertible icon2 in enumerable2)
                    {
                        this.Required.Add(Convert.ToString(icon2));
                    }
                }
                else if (dict[rkey] is string str2)
                {
                    this.Required.Add(str2);
                }
            }
        }
예제 #3
0
 public TermTable() : base(SonarrFactory.NewIgnoreCase())
 {
 }
예제 #4
0
 public JsonStringSet(string singleString) : base(ConvertToStrings(singleString), SonarrFactory.NewIgnoreCase())
 {
 }
예제 #5
0
 public JsonStringSet() : base(SonarrFactory.NewIgnoreCase())
 {
 }
예제 #6
0
 protected override void BeginProcessing()
 {
     base.BeginProcessing();
     _comparer = SonarrFactory.NewIgnoreCase();
 }
예제 #7
0
        internal AddRemoveHashtable(IDictionary dict)
        {
            string[] keys = dict.Keys.Cast <string>().ToArray();
            var      igc  = SonarrFactory.NewIgnoreCase();

            if (!keys.Contains(REPLACE, igc))
            {
                if (keys.Contains(ADD, igc))
                {
                    string addKey = keys.Single(x => x.Equals(ADD, StringComparison.CurrentCultureIgnoreCase));
                    object addObj = dict[addKey];
                    if (addObj is string str)
                    {
                        this.AddTerms = new string[1] {
                            str
                        }
                    }
                    ;

                    else if (addObj is string[] strs)
                    {
                        this.AddTerms = strs;
                    }

                    else if (addObj is object[] array)
                    {
                        this.AddTerms = new string[array.Length];
                        for (int i = 0; i < array.Length; i++)
                        {
                            this.AddTerms[i] = Convert.ToString(array[i]);
                        }
                    }
                }

                if (keys.Contains(REMOVE, igc))
                {
                    string remKey = keys.Single(x => x.Equals(REMOVE, StringComparison.CurrentCultureIgnoreCase));
                    object remObj = dict[remKey];
                    if (remObj is string str)
                    {
                        this.RemoveTerms = new string[1] {
                            str
                        }
                    }
                    ;

                    else if (remObj is string[] strs)
                    {
                        this.RemoveTerms = strs;
                    }

                    else if (remObj is object[] array)
                    {
                        this.RemoveTerms = new string[array.Length];
                        for (int i = 0; i < array.Length; i++)
                        {
                            this.RemoveTerms[i] = Convert.ToString(array[i]);
                        }
                    }
                }
            }
            else
            {
                string repKey = keys.FirstOrDefault(x => x.Equals(REPLACE, StringComparison.CurrentCultureIgnoreCase));
                object repObj = dict[repKey];
                if (repObj is IEnumerable enumerable)
                {
                    this.ReplaceTerms = this.GetReplaceTerms(enumerable).ToArray();
                }
                else if (repObj is IConvertible icon)
                {
                    this.ReplaceTerms = new string[1] {
                        Convert.ToString(icon)
                    }
                }
                ;
            }
        }
예제 #8
0
 public QualityProfileNew()
 {
     _comparer = SonarrFactory.NewIgnoreCase();
 }