Roblox-File-Format/Tokens/Double.cs

26 lines
852 B
C#
Raw Normal View History

using System.Xml;
2021-02-25 20:09:54 +00:00
using RobloxFiles.XmlFormat;
2021-02-25 20:09:54 +00:00
namespace RobloxFiles.Tokens
{
2021-02-25 20:09:54 +00:00
public class DoubleToken : IXmlPropertyToken, IAttributeToken<double>
{
2021-02-25 20:09:54 +00:00
public string XmlPropertyToken => "double";
public AttributeType AttributeType => AttributeType.Double;
public double ReadAttribute(Attribute attr) => attr.ReadDouble();
public void WriteAttribute(Attribute 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();
}
}
}