Roblox-File-Format/Tokens/Double.cs
2021-06-05 17:21:12 -05:00

26 lines
858 B
C#

using System.Xml;
using RobloxFiles.XmlFormat;
namespace RobloxFiles.Tokens
{
public class DoubleToken : IXmlPropertyToken, IAttributeToken<double>
{
public string XmlPropertyToken => "double";
public AttributeType AttributeType => AttributeType.Double;
public double ReadAttribute(RbxAttribute attr) => attr.ReadDouble();
public void WriteAttribute(RbxAttribute attr, double value) => attr.WriteDouble(value);
public bool ReadProperty(Property prop, XmlNode token)
{
return XmlPropertyTokens.ReadPropertyGeneric<double>(prop, PropertyType.Double, token);
}
public void WriteProperty(Property prop, XmlDocument doc, XmlNode node)
{
double value = prop.CastValue<double>();
node.InnerText = value.ToInvariantString();
}
}
}