Ejemplo n.º 1
0
        private static AttributeEntry ParseAttributeEntry(string input)
        {
            var match = PatternMatcher.AttributeEntry.Match(input);

            if (!match.Success)
            {
                throw new ArgumentException("not an attribute entry");
            }

            var            name = match.Groups["name"].Value.ToLowerInvariant();
            AttributeEntry attributeEntry;

            if (name.StartsWith("!"))
            {
                attributeEntry = new UnsetAttributeEntry(name.Substring(1));
            }
            else if (name.EndsWith("!"))
            {
                attributeEntry = new UnsetAttributeEntry(name.Substring(0, name.Length - 1));
            }
            else
            {
                switch (name)
                {
                case "author":
                    attributeEntry = new AuthorInfoAttributeEntry(match.Groups["value"].Value);
                    break;

                default:
                    attributeEntry = new AttributeEntry(name, match.Groups["value"].Value);
                    break;
                }
            }

            return(attributeEntry);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Determines whether the specified <see cref="AuthorInfoAttributeEntry" />, is equal to this instance.
 /// </summary>
 /// <param name="other">The other.</param>
 /// <returns>true if equal; otherwise, false</returns>
 protected bool Equals(AuthorInfoAttributeEntry other) =>
 base.Equals(other) &&
 string.Equals(FirstName, other.FirstName) &&
 string.Equals(LastName, other.LastName) &&
 string.Equals(MiddleName, other.MiddleName);