2019-01-30 06:36:56 +00:00
|
|
|
|
using System.Xml;
|
2021-02-25 20:09:54 +00:00
|
|
|
|
using RobloxFiles.XmlFormat;
|
2019-01-30 06:36:56 +00:00
|
|
|
|
|
2021-02-25 20:09:54 +00:00
|
|
|
|
namespace RobloxFiles.Tokens
|
2019-01-30 06:36:56 +00:00
|
|
|
|
{
|
2021-02-25 20:09:54 +00:00
|
|
|
|
public class FloatToken : IXmlPropertyToken, IAttributeToken<float>
|
2019-01-30 06:36:56 +00:00
|
|
|
|
{
|
2021-02-25 20:09:54 +00:00
|
|
|
|
public string XmlPropertyToken => "float";
|
|
|
|
|
public AttributeType AttributeType => AttributeType.Float;
|
|
|
|
|
|
2021-06-05 22:21:12 +00:00
|
|
|
|
public float ReadAttribute(RbxAttribute attr) => attr.ReadFloat();
|
|
|
|
|
public void WriteAttribute(RbxAttribute attr, float value) => attr.WriteFloat(value);
|
2019-01-30 06:36:56 +00:00
|
|
|
|
|
2019-05-17 12:08:06 +00:00
|
|
|
|
public bool ReadProperty(Property prop, XmlNode token)
|
2019-01-30 06:36:56 +00:00
|
|
|
|
{
|
2019-05-17 12:08:06 +00:00
|
|
|
|
return XmlPropertyTokens.ReadPropertyGeneric<float>(prop, PropertyType.Float, token);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void WriteProperty(Property prop, XmlDocument doc, XmlNode node)
|
|
|
|
|
{
|
2019-06-30 22:01:19 +00:00
|
|
|
|
float value = prop.CastValue<float>();
|
|
|
|
|
node.InnerText = value.ToInvariantString();
|
2019-01-30 06:36:56 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|