Example #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);
     }
 }
Example #2
0
        private async static Task InitializeAsync(ISonarrClient client, bool useApiPrefix, bool useCache)
        {
            if (client.IsAuthenticated)
            {
                Task <IndexerSchemaCollection> schemaTask = GetIndexerSchemasAsync(client);
                Task <QualityDictionary>       defTask    = GetQualityDictionaryAsync(client);
                Task <ITagManager>             tagTask    = SonarrFactory.GenerateTagManagerAsync(client, useApiPrefix);

                if (!History.IsInitialized())
                {
                    History.Initialize();
                }

                NoCache = !useCache;

                IndexerSchemas = await schemaTask;
                AllQualities   = await defTask;
                TagManager     = await tagTask;
            }
        }
Example #3
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);
                }
            }
        }
Example #4
0
 internal static void Initialize() => Jobs = SonarrFactory.NewJobHistory();
Example #5
0
 public TermTable() : base(SonarrFactory.NewIgnoreCase())
 {
 }
Example #6
0
 public SeriesProvider(SonarrFactory sonarrFactory)
 {
     _client        = sonarrFactory.GetClient();
     _seriesBuilder = new SeriesBuilder();
 }
Example #7
0
 public EpisodeProvider(SonarrFactory sonarrFactory, EpisodeBuilder episodeBuilder)
 {
     _client        = sonarrFactory.GetClient();
     _seriesBuilder = episodeBuilder;
 }
 public EpisodeFileLookupProvider(SonarrFactory sonarrFactory)
 {
     _client = sonarrFactory.GetClient();
 }
Example #9
0
 public JsonStringSet(string singleString) : base(ConvertToStrings(singleString), SonarrFactory.NewIgnoreCase())
 {
 }
Example #10
0
 public JsonStringSet() : base(SonarrFactory.NewIgnoreCase())
 {
 }
Example #11
0
 protected override void BeginProcessing()
 {
     base.BeginProcessing();
     _comparer = SonarrFactory.NewIgnoreCase();
 }
Example #12
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)
                    }
                }
                ;
            }
        }
Example #13
0
 public QualityProfileNew()
 {
     _comparer = SonarrFactory.NewIgnoreCase();
 }