Roblox-File-Format/Tokens/UniqueId.cs
Max 034799a4de 0.513.0.5130420 + UniqueId
Caught up with latest API changes and implemented UniqueId.
2022-02-10 15:22:44 -06:00

30 lines
674 B
C#

using System;
using System.Xml;
namespace RobloxFiles.Tokens
{
public class UniqueId : IXmlPropertyToken
{
public string XmlPropertyToken => "UniqueId";
public bool ReadProperty(Property prop, XmlNode token)
{
string hex = token.InnerText;
if (Guid.TryParse(hex, out var guid))
{
prop.Value = guid;
return true;
}
return false;
}
public void WriteProperty(Property prop, XmlDocument doc, XmlNode node)
{
var guid = prop.CastValue<Guid>();
node.InnerText = guid.ToString("N");
}
}
}