コード例 #1
0
 public void Modify(TagModifier modifier)
 {
     var lambdaModifier = new LambdaElementModifier(_matches, def => modifier);
     _factory.AddModifier(lambdaModifier);
 }
コード例 #2
0
 public void Modify(TagModifier modifier)
 {
     _factory.AddModifier(new LambdaElementModifier(_matches, (def => modifier)));
 }
コード例 #3
0
 public void SetUp()
 {
     tagModifier = (r, t) => { };
     modifier = new LambdaElementModifier(def => def.Accessor.PropertyType == typeof (string), def => tagModifier);
 }
コード例 #4
0
ファイル: FormatTag.cs プロジェクト: rmangaha/Radarr
        private void ParseRawMatch(Match match)
        {
            var type  = match.Groups["type"].Value.ToLower();
            var value = match.Groups["value"].Value.ToLower();

            if (match.Groups["m_re"].Success)
            {
                TagModifier |= TagModifier.AbsolutelyRequired;
            }
            if (match.Groups["m_r"].Success)
            {
                TagModifier |= TagModifier.Regex;
            }
            if (match.Groups["m_n"].Success)
            {
                TagModifier |= TagModifier.Not;
            }

            switch (type)
            {
            case "r":
                TagType = TagType.Resolution;
                switch (value)
                {
                case "2160":
                    Value = Resolution.R2160P;
                    break;

                case "1080":
                    Value = Resolution.R1080P;
                    break;

                case "720":
                    Value = Resolution.R720P;
                    break;

                case "576":
                    Value = Resolution.R576P;
                    break;

                case "480":
                    Value = Resolution.R480P;
                    break;
                }
                break;

            case "s":
                TagType = TagType.Source;
                switch (value)
                {
                case "cam":
                    Value = Source.CAM;
                    break;

                case "telesync":
                    Value = Source.TELESYNC;
                    break;

                case "telecine":
                    Value = Source.TELECINE;
                    break;

                case "workprint":
                    Value = Source.WORKPRINT;
                    break;

                case "dvd":
                    Value = Source.DVD;
                    break;

                case "tv":
                    Value = Source.TV;
                    break;

                case "webdl":
                    Value = Source.WEBDL;
                    break;

                case "bluray":
                    Value = Source.BLURAY;
                    break;
                }
                break;

            case "m":
                TagType = TagType.Modifier;
                switch (value)
                {
                case "regional":
                    Value = Modifier.REGIONAL;
                    break;

                case "screener":
                    Value = Modifier.SCREENER;
                    break;

                case "rawhd":
                    Value = Modifier.RAWHD;
                    break;

                case "brdisk":
                    Value = Modifier.BRDISK;
                    break;

                case "remux":
                    Value = Modifier.REMUX;
                    break;
                }
                break;

            case "e":
                TagType = TagType.Edition;
                if (TagModifier.HasFlag(TagModifier.Regex))
                {
                    Value = new Regex(value, RegexOptions.Compiled | RegexOptions.IgnoreCase);
                }
                else
                {
                    Value = value;
                }
                break;

            case "l":
                TagType = TagType.Language;
                Value   = Parser.LanguageParser.ParseLanguages(value).First();
                break;

            case "i":
                TagType = TagType.Indexer;
                var flagValues = Enum.GetValues(typeof(IndexerFlags));

                foreach (IndexerFlags flagValue in flagValues)
                {
                    var flagString = flagValue.ToString();
                    if (flagString.ToLower().Replace("_", string.Empty) != value.ToLower().Replace("_", string.Empty))
                    {
                        continue;
                    }
                    Value = flagValue;
                    break;
                }

                break;

            case "c":
            default:
                TagType = TagType.Custom;
                if (TagModifier.HasFlag(TagModifier.Regex))
                {
                    Value = new Regex(value, RegexOptions.Compiled | RegexOptions.IgnoreCase);
                }
                else
                {
                    Value = value;
                }
                break;
            }
        }