public bool ReadProperty(Property prop, XmlNode token) { uint value; if (XmlPropertyTokens.ReadPropertyGeneric(token, out value)) { Instance inst = prop.Instance; Type instType = inst?.GetType(); FieldInfo info = instType.GetField(prop.Name, Property.BindingFlags); if (info != null) { Type enumType = info.FieldType; string item = value.ToInvariantString(); prop.Type = PropertyType.Enum; prop.Value = Enum.Parse(enumType, item); return(true); } } return(false); }
public bool ReadProperty(Property prop, XmlNode token) { if (XmlPropertyTokens.ReadPropertyGeneric(token, out uint value)) { Axes axes = (Axes)value; prop.Value = axes; return(true); } return(false); }
public bool ReadProperty(Property prop, XmlNode token) { if (XmlPropertyTokens.ReadPropertyGeneric(token, out int value)) { BrickColor brickColor = BrickColor.FromNumber(value); prop.XmlToken = "BrickColor"; prop.Value = brickColor; return(true); } return(false); }
public bool ReadProperty(Property prop, XmlNode token) { Contract.Requires(prop != null); if (XmlPropertyTokens.ReadPropertyGeneric(token, out uint value)) { Faces faces = (Faces)value; prop.Value = faces; return(true); } return(false); }
public bool ReadProperty(Property prop, XmlNode token) { uint value; if (XmlPropertyTokens.ReadPropertyGeneric(token, out value)) { Faces faces = (Faces)value; prop.Value = faces; return(true); } return(false); }
public bool ReadProperty(Property prop, XmlNode token) { // BrickColors are represented by ints, see if // we can infer when they should be a BrickColor. if (prop.Name.Contains("Color") || prop.Instance.ClassName.Contains("Color")) { var brickColorToken = XmlPropertyTokens.GetHandler <BrickColorToken>(); return(brickColorToken.ReadProperty(prop, token)); } else { return(XmlPropertyTokens.ReadPropertyGeneric <int>(prop, PropertyType.Int, token)); } }
public bool ReadProperty(Property prop, XmlNode token) { if (XmlPropertyTokens.ReadPropertyGeneric(token, out uint value)) { uint r = (value >> 16) & 0xFF; uint g = (value >> 8) & 0xFF; uint b = value & 0xFF; Color3uint8 result = Color3.FromRGB(r, g, b); prop.Value = result; return(true); } return(false); }
public bool ReadProperty(Property prop, XmlNode token) { return(XmlPropertyTokens.ReadPropertyGeneric <long>(prop, PropertyType.Int64, token)); }
public bool ReadProperty(Property prop, XmlNode token) { return(XmlPropertyTokens.ReadPropertyGeneric <double>(prop, PropertyType.Double, token)); }
public bool ReadProperty(Property prop, XmlNode token) { return(XmlPropertyTokens.ReadPropertyGeneric <float>(prop, PropertyType.Float, token)); }
public bool ReadProperty(Property prop, XmlNode token) { return(XmlPropertyTokens.ReadPropertyGeneric <bool>(prop, PropertyType.Bool, token)); }