/// <summary>
        /// Parse Mentioned Group.
        /// </summary>
        /// <param name="name">Name of the Mentioned Group.</param>
        /// <returns><see cref="MentionedGroup"/> for the name.</returns>
        public static MentionedGroup Parse(string name)
        {
            MentionedGroup mentionedGroup = null;

            if (!MENTIONED_GROUPS.TryGetValue(name, out mentionedGroup))
            {
                mentionedGroup = new MentionedGroup(name);
            }

            return(mentionedGroup);
        }
示例#2
0
        /// <summary>
        /// Appends mention to a person.
        /// </summary>
        /// <param name="group"><see cref="MentionedGroup"/> to be mentioned.</param>
        /// <returns>A reference to this instance after the append operation has completed.</returns>
        public MarkdownBuilder AppendMentionToGroup(MentionedGroup group)
        {
            if (group == MentionedGroup.All)
            {
                this.Append("<@all>");
            }
            else
            {
                this.AppendFormat("<@{0}>", encodeHtml(group.Name));
            }

            return(this);
        }
        /// <summary>
        /// Determines whether this instance and another specified <see cref="MentionedGroup"/> object have the same value.
        /// </summary>
        /// <param name="value">The Mentioned Group to compare to this instance.</param>
        /// <returns>true if the value of the parameter is the same as the value of this instance; otherwise, false. If value is null, the method returns false.</returns>
        public bool Equals(MentionedGroup value)
        {
            if (Object.ReferenceEquals(value, null))
            {
                return(false);
            }

            if (Object.ReferenceEquals(this, value))
            {
                return(true);
            }

            return(this.Name == value.Name);
        }