예제 #1
0
        /// <summary>
        /// Determines whether [is property required] [the specified property name].
        /// </summary>
        /// <param name="propertyName">Name of the property.</param>
        /// <returns>
        ///     <c>true</c> if [is property required] [the specified property name]; otherwise, <c>false</c>.
        /// </returns>
        public bool IsPropertyRequired(string propertyName)
        {
            var requiredPropertyFlagsType = RequiredFlags.GetType();
            var property = requiredPropertyFlagsType.GetProperty(propertyName);

            return((bool)property.GetValue(RequiredFlags, null));
        }
예제 #2
0
 public override int GetHashCode()
 {
     unchecked
     {
         int hashCode = 0;
         foreach (string commandName in CommandNames)
         {
             hashCode = (hashCode * 397) ^ commandName.GetHashCode();
         }
         foreach (KeyValuePair <string, IArgumentTaker> option in Options)
         {
             hashCode = (hashCode * 397) ^ option.Key.GetHashCode();
             hashCode = (hashCode * 397) ^ option.Value.GetHashCode();
         }
         foreach (IArgumentTaker argument in Arguments)
         {
             hashCode = (hashCode * 397) ^ argument.GetHashCode();
         }
         foreach (string tag in Tags)
         {
             hashCode = (hashCode * 397) ^ tag.GetHashCode();
         }
         hashCode = (hashCode * 397) ^ RequiredFlags.GetHashCode();
         hashCode = (hashCode * 397) ^ ForbiddenFlags.GetHashCode();
         return(hashCode);
     }
 }
예제 #3
0
 public MessageTypeInfo(
     string aName,
     int?aLength                = null,
     bool aRepeatable           = false,
     RequiredFlags aRequiredFor = RequiredFlags.None)
 {
     Name         = aName;
     Length       = aLength;
     IsRepeatable = aRepeatable;
     RequiredFor  = aRequiredFor;
 }
예제 #4
0
 /// <summary>
 /// Checks to see if this messag typ eis required for a type of object
 /// </summary>
 /// <returns><c>true</c>, if for was requireded, <c>false</c> otherwise.</returns>
 /// <param name="aMessageType">A message type.</param>
 /// <param name="aFlags">Type of object to check for.</param>
 public static bool RequiredFor(this MessageType aMessageType, RequiredFlags aFlags) =>
 (msrTypeInfo[aMessageType].RequiredFor | aFlags) != 0;