Beispiel #1
0
        public static Disposition Parse(String str)
        {
            // TODO: Verify correct parsing!!!!!
            // Matcher matcher = PATTERN.matcher(str);
            String cleaned = str.ReplaceAll("[ \r\n\t]+", " ");

            var matches = Pattern.Matches(cleaned);

            if (matches.Count > 0)
            {
                if (string.IsNullOrWhiteSpace(matches[1].Value))
                {
                    return(new Disposition(DispositionType.Of(matches[6].Value), null, null));
                }
                else
                {
                    return(new Disposition(
                               DispositionType.Of(matches[2].Value),
                               DispositionModifier.Of(matches[3].Value),
                               DispositionModifierExtension.Of(matches[4].Value)));
                }
            }

            throw new ArgumentException($"Unable to parse disposition '{str}'.");
        }
Beispiel #2
0
 private Disposition(DispositionType type, DispositionModifier modifier, DispositionModifierExtension extension)
 {
     this.Type      = type;
     this.Modifier  = modifier;
     this.Extension = extension;
 }