Ejemplo n.º 1
0
        /// <summary>
        /// Populates a given NarrativeEffect struct with all parsable trait changes found in a line.
        /// </summary>
        /// <param name="input">The data line to parse.</param>
        /// <param name="effect">The struct to populate.</param>
        private void PopulateTraitChanges(string input, ref NarrativeEffect effect, List <int> lineNumbers)
        {
            var traitMatches = TraitRegex.Matches(input);

            foreach (Match match in traitMatches)
            {
                var target = match.Groups[1].Value;
                var trait  = match.Groups[2].Value;

                if (string.IsNullOrWhiteSpace(target))
                {
                    effect.characterTraits.Add(trait);
                }
                else if (Symbol.Encounter == target.ToLower())
                {
                    effect.encounterTraits.Add(trait);
                }
                else if (Symbol.Session == target.ToLower())
                {
                    effect.sessionTraits.Add(trait);
                }
                else
                {
                    WarnInvalidTrait(target, lineNumbers);
                }
            }
        }
Ejemplo n.º 2
0
        public IndexerResult.QualityTrait[] GetTraits(string title)
        {
            var traits  = new List <IndexerResult.QualityTrait>();
            var matches = TraitRegex.Matches(title).Select(x => x.Groups["trait"].Value.ToLower());

            foreach (var capture in matches)
            {
                switch (capture)
                {
                case "bluray":
                    traits.Add(IndexerResult.QualityTrait.BluRay);
                    break;

                case "dts-hd.ma":
                    traits.Add(IndexerResult.QualityTrait.DTS_HD_MA);
                    break;

                case "dts_hd":
                    traits.Add(IndexerResult.QualityTrait.DTS_HD);
                    break;

                case "dts":
                    traits.Add(IndexerResult.QualityTrait.DTS);
                    break;

                case "atmos":
                    traits.Add(IndexerResult.QualityTrait.Atmos);
                    break;

                case var a when a.EndsWith("5.1"):
                    traits.Add(IndexerResult.QualityTrait.AC5_1);

                    break;

                case var a when a.EndsWith("7.1"):
                    traits.Add(IndexerResult.QualityTrait.AC7_1);

                    break;

                case "aac":
                    traits.Add(IndexerResult.QualityTrait.AAC);
                    break;

                case "web-dl":
                    traits.Add(IndexerResult.QualityTrait.WEB_DL);
                    break;

                case "proper":
                    traits.Add(IndexerResult.QualityTrait.PROPER);
                    break;

                case "repack":
                    traits.Add(IndexerResult.QualityTrait.REPACK);
                    break;
                }
            }
            return(traits.ToArray());
        }