Attribute -> RbxAttribute
This commit is contained in:
@ -8,8 +8,8 @@ namespace RobloxFiles.Tokens
|
||||
public string XmlPropertyToken => "bool";
|
||||
public AttributeType AttributeType => AttributeType.Bool;
|
||||
|
||||
public bool ReadAttribute(Attribute attr) => attr.ReadBool();
|
||||
public void WriteAttribute(Attribute attr, bool value) => attr.WriteBool(value);
|
||||
public bool ReadAttribute(RbxAttribute attr) => attr.ReadBool();
|
||||
public void WriteAttribute(RbxAttribute attr, bool value) => attr.WriteBool(value);
|
||||
|
||||
public bool ReadProperty(Property prop, XmlNode token)
|
||||
{
|
||||
|
@ -12,8 +12,8 @@ namespace RobloxFiles.Tokens
|
||||
public string XmlPropertyToken => "BrickColor";
|
||||
public AttributeType AttributeType => AttributeType.BrickColor;
|
||||
|
||||
public BrickColor ReadAttribute(Attribute attr) => attr.ReadInt();
|
||||
public void WriteAttribute(Attribute attr, BrickColor value) => attr.WriteInt(value.Number);
|
||||
public BrickColor ReadAttribute(RbxAttribute attr) => attr.ReadInt();
|
||||
public void WriteAttribute(RbxAttribute attr, BrickColor value) => attr.WriteInt(value.Number);
|
||||
|
||||
public bool ReadProperty(Property prop, XmlNode token)
|
||||
{
|
||||
|
@ -10,10 +10,10 @@ namespace RobloxFiles.Tokens
|
||||
private readonly string[] XmlFields = new string[3] { "R", "G", "B" };
|
||||
|
||||
public AttributeType AttributeType => AttributeType.Color3;
|
||||
public Color3 ReadAttribute(Attribute attr) => ReadColor3(attr);
|
||||
public void WriteAttribute(Attribute attr, Color3 value) => WriteColor3(attr, value);
|
||||
public Color3 ReadAttribute(RbxAttribute attr) => ReadColor3(attr);
|
||||
public void WriteAttribute(RbxAttribute attr, Color3 value) => WriteColor3(attr, value);
|
||||
|
||||
public static Color3 ReadColor3(Attribute attr)
|
||||
public static Color3 ReadColor3(RbxAttribute attr)
|
||||
{
|
||||
float r = attr.ReadFloat(),
|
||||
g = attr.ReadFloat(),
|
||||
@ -22,7 +22,7 @@ namespace RobloxFiles.Tokens
|
||||
return new Color3(r, g, b);
|
||||
}
|
||||
|
||||
public static void WriteColor3(Attribute attr, Color3 value)
|
||||
public static void WriteColor3(RbxAttribute attr, Color3 value)
|
||||
{
|
||||
attr.WriteFloat(value.R);
|
||||
attr.WriteFloat(value.G);
|
||||
|
@ -52,7 +52,7 @@ namespace RobloxFiles.Tokens
|
||||
node.InnerText = value.ToString() + ' ';
|
||||
}
|
||||
|
||||
public ColorSequence ReadAttribute(Attribute attr)
|
||||
public ColorSequence ReadAttribute(RbxAttribute attr)
|
||||
{
|
||||
int numKeys = attr.ReadInt();
|
||||
var keypoints = new ColorSequenceKeypoint[numKeys];
|
||||
@ -69,7 +69,7 @@ namespace RobloxFiles.Tokens
|
||||
return new ColorSequence(keypoints);
|
||||
}
|
||||
|
||||
public void WriteAttribute(Attribute attr, ColorSequence value)
|
||||
public void WriteAttribute(RbxAttribute attr, ColorSequence value)
|
||||
{
|
||||
attr.WriteInt(value.Keypoints.Length);
|
||||
|
||||
|
@ -8,8 +8,8 @@ namespace RobloxFiles.Tokens
|
||||
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 double ReadAttribute(RbxAttribute attr) => attr.ReadDouble();
|
||||
public void WriteAttribute(RbxAttribute attr, double value) => attr.WriteDouble(value);
|
||||
|
||||
public bool ReadProperty(Property prop, XmlNode token)
|
||||
{
|
||||
|
@ -8,8 +8,8 @@ namespace RobloxFiles.Tokens
|
||||
public string XmlPropertyToken => "float";
|
||||
public AttributeType AttributeType => AttributeType.Float;
|
||||
|
||||
public float ReadAttribute(Attribute attr) => attr.ReadFloat();
|
||||
public void WriteAttribute(Attribute attr, float value) => attr.WriteFloat(value);
|
||||
public float ReadAttribute(RbxAttribute attr) => attr.ReadFloat();
|
||||
public void WriteAttribute(RbxAttribute attr, float value) => attr.WriteFloat(value);
|
||||
|
||||
public bool ReadProperty(Property prop, XmlNode token)
|
||||
{
|
||||
|
@ -40,7 +40,7 @@ namespace RobloxFiles.Tokens
|
||||
node.InnerText = value.ToString() + ' ';
|
||||
}
|
||||
|
||||
public NumberRange ReadAttribute(Attribute attr)
|
||||
public NumberRange ReadAttribute(RbxAttribute attr)
|
||||
{
|
||||
float min = attr.ReadFloat();
|
||||
float max = attr.ReadFloat();
|
||||
@ -48,7 +48,7 @@ namespace RobloxFiles.Tokens
|
||||
return new NumberRange(min, max);
|
||||
}
|
||||
|
||||
public void WriteAttribute(Attribute attr, NumberRange value)
|
||||
public void WriteAttribute(RbxAttribute attr, NumberRange value)
|
||||
{
|
||||
attr.WriteFloat(value.Min);
|
||||
attr.WriteFloat(value.Max);
|
||||
|
@ -49,7 +49,7 @@ namespace RobloxFiles.Tokens
|
||||
node.InnerText = value.ToString() + ' ';
|
||||
}
|
||||
|
||||
public NumberSequence ReadAttribute(Attribute attr)
|
||||
public NumberSequence ReadAttribute(RbxAttribute attr)
|
||||
{
|
||||
int numKeys = attr.ReadInt();
|
||||
var keypoints = new NumberSequenceKeypoint[numKeys];
|
||||
@ -66,7 +66,7 @@ namespace RobloxFiles.Tokens
|
||||
return new NumberSequence(keypoints);
|
||||
}
|
||||
|
||||
public void WriteAttribute(Attribute attr, NumberSequence value)
|
||||
public void WriteAttribute(RbxAttribute attr, NumberSequence value)
|
||||
{
|
||||
attr.WriteInt(value.Keypoints.Length);
|
||||
|
||||
|
@ -51,7 +51,7 @@ namespace RobloxFiles.Tokens
|
||||
node.AppendChild(max);
|
||||
}
|
||||
|
||||
public Rect ReadAttribute(Attribute attr)
|
||||
public Rect ReadAttribute(RbxAttribute attr)
|
||||
{
|
||||
Vector2 min = Vector2Token.ReadVector2(attr);
|
||||
Vector2 max = Vector2Token.ReadVector2(attr);
|
||||
@ -59,7 +59,7 @@ namespace RobloxFiles.Tokens
|
||||
return new Rect(min, max);
|
||||
}
|
||||
|
||||
public void WriteAttribute(Attribute attr, Rect value)
|
||||
public void WriteAttribute(RbxAttribute attr, Rect value)
|
||||
{
|
||||
Vector2Token.WriteVector2(attr, value.Min);
|
||||
Vector2Token.WriteVector2(attr, value.Max);
|
||||
|
@ -7,8 +7,8 @@ namespace RobloxFiles.Tokens
|
||||
public string XmlPropertyToken => "string";
|
||||
public AttributeType AttributeType => AttributeType.String;
|
||||
|
||||
public string ReadAttribute(Attribute attr) => attr.ReadString();
|
||||
public void WriteAttribute(Attribute attr, string value) => attr.WriteString(value);
|
||||
public string ReadAttribute(RbxAttribute attr) => attr.ReadString();
|
||||
public void WriteAttribute(RbxAttribute attr, string value) => attr.WriteString(value);
|
||||
|
||||
public bool ReadProperty(Property prop, XmlNode token)
|
||||
{
|
||||
|
@ -9,8 +9,8 @@ namespace RobloxFiles.Tokens
|
||||
public string XmlPropertyToken => "UDim";
|
||||
public AttributeType AttributeType => AttributeType.UDim;
|
||||
|
||||
public UDim ReadAttribute(Attribute attr) => ReadUDim(attr);
|
||||
public void WriteAttribute(Attribute attr, UDim value) => WriteUDim(attr, value);
|
||||
public UDim ReadAttribute(RbxAttribute attr) => ReadUDim(attr);
|
||||
public void WriteAttribute(RbxAttribute attr, UDim value) => WriteUDim(attr, value);
|
||||
|
||||
public static UDim ReadUDim(XmlNode token, string prefix = "")
|
||||
{
|
||||
@ -41,7 +41,7 @@ namespace RobloxFiles.Tokens
|
||||
node.AppendChild(offset);
|
||||
}
|
||||
|
||||
public static UDim ReadUDim(Attribute attr)
|
||||
public static UDim ReadUDim(RbxAttribute attr)
|
||||
{
|
||||
float scale = attr.ReadFloat();
|
||||
int offset = attr.ReadInt();
|
||||
@ -49,7 +49,7 @@ namespace RobloxFiles.Tokens
|
||||
return new UDim(scale, offset);
|
||||
}
|
||||
|
||||
public static void WriteUDim(Attribute attr, UDim value)
|
||||
public static void WriteUDim(RbxAttribute attr, UDim value)
|
||||
{
|
||||
float scale = value.Scale;
|
||||
attr.WriteFloat(scale);
|
||||
|
@ -8,7 +8,7 @@ namespace RobloxFiles.Tokens
|
||||
public string XmlPropertyToken => "UDim2";
|
||||
public AttributeType AttributeType => AttributeType.UDim2;
|
||||
|
||||
public UDim2 ReadAttribute(Attribute attr)
|
||||
public UDim2 ReadAttribute(RbxAttribute attr)
|
||||
{
|
||||
UDim x = UDimToken.ReadUDim(attr);
|
||||
UDim y = UDimToken.ReadUDim(attr);
|
||||
@ -16,7 +16,7 @@ namespace RobloxFiles.Tokens
|
||||
return new UDim2(x, y);
|
||||
}
|
||||
|
||||
public void WriteAttribute(Attribute attr, UDim2 value)
|
||||
public void WriteAttribute(RbxAttribute attr, UDim2 value)
|
||||
{
|
||||
UDimToken.WriteUDim(attr, value.X);
|
||||
UDimToken.WriteUDim(attr, value.Y);
|
||||
|
@ -9,8 +9,8 @@ namespace RobloxFiles.Tokens
|
||||
private static readonly string[] XmlCoords = new string[2] { "X", "Y" };
|
||||
|
||||
public AttributeType AttributeType => AttributeType.Vector2;
|
||||
public Vector2 ReadAttribute(Attribute attr) => ReadVector2(attr);
|
||||
public void WriteAttribute(Attribute attr, Vector2 value) => WriteVector2(attr, value);
|
||||
public Vector2 ReadAttribute(RbxAttribute attr) => ReadVector2(attr);
|
||||
public void WriteAttribute(RbxAttribute attr, Vector2 value) => WriteVector2(attr, value);
|
||||
|
||||
public static Vector2 ReadVector2(XmlNode token)
|
||||
{
|
||||
@ -46,7 +46,7 @@ namespace RobloxFiles.Tokens
|
||||
node.AppendChild(y);
|
||||
}
|
||||
|
||||
public static Vector2 ReadVector2(Attribute attr)
|
||||
public static Vector2 ReadVector2(RbxAttribute attr)
|
||||
{
|
||||
float x = attr.ReadFloat(),
|
||||
y = attr.ReadFloat();
|
||||
@ -54,7 +54,7 @@ namespace RobloxFiles.Tokens
|
||||
return new Vector2(x, y);
|
||||
}
|
||||
|
||||
public static void WriteVector2(Attribute attr, Vector2 value)
|
||||
public static void WriteVector2(RbxAttribute attr, Vector2 value)
|
||||
{
|
||||
attr.WriteFloat(value.X);
|
||||
attr.WriteFloat(value.Y);
|
||||
|
@ -9,8 +9,8 @@ namespace RobloxFiles.Tokens
|
||||
private static readonly string[] XmlCoords = new string[3] { "X", "Y", "Z" };
|
||||
|
||||
public AttributeType AttributeType => AttributeType.Vector3;
|
||||
public Vector3 ReadAttribute(Attribute attr) => ReadVector3(attr);
|
||||
public void WriteAttribute(Attribute attr, Vector3 value) => WriteVector3(attr, value);
|
||||
public Vector3 ReadAttribute(RbxAttribute attr) => ReadVector3(attr);
|
||||
public void WriteAttribute(RbxAttribute attr, Vector3 value) => WriteVector3(attr, value);
|
||||
|
||||
public static Vector3 ReadVector3(XmlNode token)
|
||||
{
|
||||
@ -49,7 +49,7 @@ namespace RobloxFiles.Tokens
|
||||
node.AppendChild(z);
|
||||
}
|
||||
|
||||
public static Vector3 ReadVector3(Attribute attr)
|
||||
public static Vector3 ReadVector3(RbxAttribute attr)
|
||||
{
|
||||
float x = attr.ReadFloat(),
|
||||
y = attr.ReadFloat(),
|
||||
@ -58,7 +58,7 @@ namespace RobloxFiles.Tokens
|
||||
return new Vector3(x, y, z);
|
||||
}
|
||||
|
||||
public static void WriteVector3(Attribute attr, Vector3 value)
|
||||
public static void WriteVector3(RbxAttribute attr, Vector3 value)
|
||||
{
|
||||
attr.WriteFloat(value.X);
|
||||
attr.WriteFloat(value.Y);
|
||||
|
Reference in New Issue
Block a user