2019-01-26 00:39:37 +00:00
|
|
|
|
using System;
|
|
|
|
|
|
2019-02-01 17:19:20 +00:00
|
|
|
|
namespace RobloxFiles
|
2019-01-26 00:39:37 +00:00
|
|
|
|
{
|
|
|
|
|
public enum PropertyType
|
|
|
|
|
{
|
|
|
|
|
Unknown,
|
|
|
|
|
String,
|
|
|
|
|
Bool,
|
|
|
|
|
Int,
|
|
|
|
|
Float,
|
|
|
|
|
Double,
|
|
|
|
|
UDim,
|
|
|
|
|
UDim2,
|
|
|
|
|
Ray,
|
|
|
|
|
Faces,
|
|
|
|
|
Axes,
|
|
|
|
|
BrickColor,
|
|
|
|
|
Color3,
|
|
|
|
|
Vector2,
|
|
|
|
|
Vector3,
|
|
|
|
|
Vector2int16,
|
|
|
|
|
CFrame,
|
|
|
|
|
Quaternion,
|
|
|
|
|
Enum,
|
|
|
|
|
Ref,
|
|
|
|
|
Vector3int16,
|
|
|
|
|
NumberSequence,
|
|
|
|
|
ColorSequence,
|
|
|
|
|
NumberRange,
|
|
|
|
|
Rect,
|
|
|
|
|
PhysicalProperties,
|
|
|
|
|
Color3uint8,
|
|
|
|
|
Int64
|
|
|
|
|
}
|
|
|
|
|
|
2019-01-29 09:50:55 +00:00
|
|
|
|
public class Property
|
2019-01-26 00:39:37 +00:00
|
|
|
|
{
|
2019-01-30 06:36:56 +00:00
|
|
|
|
public Instance Instance;
|
2019-01-26 00:39:37 +00:00
|
|
|
|
public string Name;
|
|
|
|
|
public PropertyType Type;
|
|
|
|
|
public object Value;
|
|
|
|
|
|
2019-01-29 09:50:55 +00:00
|
|
|
|
private byte[] RawBuffer = null;
|
|
|
|
|
public bool HasRawBuffer
|
2019-01-26 00:39:37 +00:00
|
|
|
|
{
|
2019-01-29 09:50:55 +00:00
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
if (RawBuffer == null && Value != null)
|
|
|
|
|
{
|
2019-01-30 06:36:56 +00:00
|
|
|
|
// Improvise what the buffer should be if this is a primitive.
|
2019-01-29 09:50:55 +00:00
|
|
|
|
switch (Type)
|
|
|
|
|
{
|
|
|
|
|
case PropertyType.Int:
|
|
|
|
|
RawBuffer = BitConverter.GetBytes((int)Value);
|
|
|
|
|
break;
|
|
|
|
|
case PropertyType.Int64:
|
|
|
|
|
RawBuffer = BitConverter.GetBytes((long)Value);
|
|
|
|
|
break;
|
|
|
|
|
case PropertyType.Bool:
|
|
|
|
|
RawBuffer = BitConverter.GetBytes((bool)Value);
|
|
|
|
|
break;
|
|
|
|
|
case PropertyType.Float:
|
|
|
|
|
RawBuffer = BitConverter.GetBytes((float)Value);
|
|
|
|
|
break;
|
|
|
|
|
case PropertyType.Double:
|
|
|
|
|
RawBuffer = BitConverter.GetBytes((double)Value);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return (RawBuffer != null);
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-01-26 00:39:37 +00:00
|
|
|
|
|
2019-01-30 06:36:56 +00:00
|
|
|
|
public string GetFullName()
|
|
|
|
|
{
|
|
|
|
|
string result = Name;
|
|
|
|
|
|
|
|
|
|
if (Instance != null)
|
|
|
|
|
result = Instance.GetFullName() + '.' + result;
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
2019-01-29 09:50:55 +00:00
|
|
|
|
public override string ToString()
|
|
|
|
|
{
|
|
|
|
|
string typeName = Enum.GetName(typeof(PropertyType), Type);
|
|
|
|
|
string valueLabel = (Value != null ? Value.ToString() : "null");
|
2019-01-26 00:39:37 +00:00
|
|
|
|
|
2019-01-29 09:50:55 +00:00
|
|
|
|
if (Type == PropertyType.String)
|
|
|
|
|
valueLabel = '"' + valueLabel + '"';
|
2019-01-26 00:39:37 +00:00
|
|
|
|
|
|
|
|
|
return string.Join(" ", typeName, Name, '=', valueLabel);
|
|
|
|
|
}
|
2019-01-29 09:50:55 +00:00
|
|
|
|
|
|
|
|
|
internal void SetRawBuffer(byte[] buffer)
|
|
|
|
|
{
|
|
|
|
|
RawBuffer = buffer;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public byte[] GetRawBuffer()
|
|
|
|
|
{
|
|
|
|
|
return RawBuffer;
|
|
|
|
|
}
|
2019-01-26 00:39:37 +00:00
|
|
|
|
}
|
2019-01-30 06:36:56 +00:00
|
|
|
|
}
|