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 DoubleToken : IXmlPropertyToken, IAttributeToken<double>
|
2019-01-30 06:36:56 +00:00
|
|
|
|
{
|
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);
|
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<double>(prop, PropertyType.Double, token);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void WriteProperty(Property prop, XmlDocument doc, XmlNode node)
|
|
|
|
|
{
|
2019-06-30 22:01:19 +00:00
|
|
|
|
double value = prop.CastValue<double>();
|
|
|
|
|
node.InnerText = value.ToInvariantString();
|
2019-01-30 06:36:56 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|