예제 #1
0
        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);
        }
예제 #2
0
        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);
        }
예제 #3
0
        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);
        }
예제 #4
0
        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);
        }
예제 #5
0
        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);
        }
예제 #6
0
        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));
            }
        }
예제 #7
0
        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);
        }
예제 #8
0
 public bool ReadProperty(Property prop, XmlNode token)
 {
     return(XmlPropertyTokens.ReadPropertyGeneric <long>(prop, PropertyType.Int64, token));
 }
예제 #9
0
 public bool ReadProperty(Property prop, XmlNode token)
 {
     return(XmlPropertyTokens.ReadPropertyGeneric <double>(prop, PropertyType.Double, token));
 }
예제 #10
0
 public bool ReadProperty(Property prop, XmlNode token)
 {
     return(XmlPropertyTokens.ReadPropertyGeneric <float>(prop, PropertyType.Float, token));
 }
예제 #11
0
 public bool ReadProperty(Property prop, XmlNode token)
 {
     return(XmlPropertyTokens.ReadPropertyGeneric <bool>(prop, PropertyType.Bool, token));
 }