2019-01-30 06:36:56 +00:00
|
|
|
|
using System.Xml;
|
|
|
|
|
|
2019-02-01 17:19:20 +00:00
|
|
|
|
namespace RobloxFiles.XmlFormat.PropertyTokens
|
2019-01-30 06:36:56 +00:00
|
|
|
|
{
|
|
|
|
|
public class IntToken : IXmlPropertyToken
|
|
|
|
|
{
|
|
|
|
|
public string Token => "int";
|
|
|
|
|
|
2019-05-17 12:08:06 +00:00
|
|
|
|
public bool ReadProperty(Property prop, XmlNode token)
|
2019-01-30 06:36:56 +00:00
|
|
|
|
{
|
|
|
|
|
// 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>();
|
2019-05-17 12:08:06 +00:00
|
|
|
|
return brickColorToken.ReadProperty(prop, token);
|
2019-01-30 06:36:56 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2019-05-17 12:08:06 +00:00
|
|
|
|
return XmlPropertyTokens.ReadPropertyGeneric<int>(prop, PropertyType.Int, token);
|
2019-01-30 06:36:56 +00:00
|
|
|
|
}
|
2019-05-17 12:08:06 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void WriteProperty(Property prop, XmlDocument doc, XmlNode node)
|
|
|
|
|
{
|
2019-06-30 22:01:19 +00:00
|
|
|
|
int value = prop.CastValue<int>();
|
|
|
|
|
node.InnerText = value.ToInvariantString();
|
2019-01-30 06:36:56 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|