예제 #1
0
 /// <summary>
 /// Gets all known properties of a given type
 /// </summary>
 /// <param name="type">Type of the property</param>
 /// <returns>All known properties of requested type</returns>
 public static IEnumerable <SgfKnownProperty> GetPropertiesOfType(SgfPropertyType type)
 {
     foreach (var property in KnownProperties.Values)
     {
         if (property.Type == type)
         {
             yield return(property);
         }
     }
 }
예제 #2
0
 /// <summary>
 /// Creates a known property
 /// </summary>
 /// <param name="identifier">Identifier of the property</param>
 /// <param name="parser">Property values parser</param>
 /// <param name="valueMultiplicity">Multiplicity of the values</param>
 /// <param name="type">Type of the property</param>
 public SgfKnownProperty(string identifier, SgfPropertyType type, SgfValueMultiplicity valueMultiplicity = SgfValueMultiplicity.None, SgfPropertyValueParser parser = null)
 {
     if (identifier == null)
     {
         throw new ArgumentNullException(nameof(identifier));
     }
     if (valueMultiplicity != SgfValueMultiplicity.None && parser == null)
     {
         throw new ArgumentNullException(nameof(parser),
                                         $"Property value parser cannot be null unless value multiplicity is None (identifier {identifier})");
     }
     Type              = type;
     Identifier        = identifier;
     Parser            = parser;
     ValueMultiplicity = valueMultiplicity;
 }