Bug fixes and improvements.
- Fixed an issue pertaining to implicit value casting in the property reflection. - Removed some unnecessary generated whitespace in the class data. - Added some missing properties to the generated class data. - Moved the Quaternion type into the DataTypes namespace.
This commit is contained in:
parent
de8df15d3f
commit
4e1fdc0a22
@ -6,7 +6,6 @@ using System.Text;
|
|||||||
|
|
||||||
using RobloxFiles.Enums;
|
using RobloxFiles.Enums;
|
||||||
using RobloxFiles.DataTypes;
|
using RobloxFiles.DataTypes;
|
||||||
using RobloxFiles.Utility;
|
|
||||||
|
|
||||||
namespace RobloxFiles.BinaryFormat.Chunks
|
namespace RobloxFiles.BinaryFormat.Chunks
|
||||||
{
|
{
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using RobloxFiles.Utility;
|
|
||||||
|
|
||||||
namespace RobloxFiles.DataTypes
|
namespace RobloxFiles.DataTypes
|
||||||
{
|
{
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using RobloxFiles.DataTypes;
|
|
||||||
|
|
||||||
namespace RobloxFiles.Utility
|
namespace RobloxFiles.DataTypes
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Quaternion is a utility used by the CFrame DataType to handle rotation interpolation.
|
/// Quaternion is a utility used by the CFrame DataType to handle rotation interpolation.
|
||||||
|
@ -644,7 +644,6 @@ namespace RobloxFiles
|
|||||||
{
|
{
|
||||||
IsService = true;
|
IsService = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ContextActionService : Instance
|
public class ContextActionService : Instance
|
||||||
@ -723,6 +722,9 @@ namespace RobloxFiles
|
|||||||
|
|
||||||
public abstract class BevelMesh : DataModelMesh
|
public abstract class BevelMesh : DataModelMesh
|
||||||
{
|
{
|
||||||
|
public float Bevel = 0;
|
||||||
|
public float Bevel_Roundness = 0;
|
||||||
|
public float Bulge = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class BlockMesh : BevelMesh
|
public class BlockMesh : BevelMesh
|
||||||
@ -1758,7 +1760,6 @@ namespace RobloxFiles
|
|||||||
{
|
{
|
||||||
IsService = true;
|
IsService = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class LocalizationTable : Instance
|
public class LocalizationTable : Instance
|
||||||
@ -1866,7 +1867,6 @@ namespace RobloxFiles
|
|||||||
{
|
{
|
||||||
IsService = true;
|
IsService = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract class PVInstance : Instance
|
public abstract class PVInstance : Instance
|
||||||
@ -2065,6 +2065,7 @@ namespace RobloxFiles
|
|||||||
{
|
{
|
||||||
public Content AssetId = "";
|
public Content AssetId = "";
|
||||||
public byte[] ChildData = new byte[0];
|
public byte[] ChildData = new byte[0];
|
||||||
|
public FormFactor FormFactor = FormFactor.Custom;
|
||||||
public byte[] MeshData = new byte[0];
|
public byte[] MeshData = new byte[0];
|
||||||
public RenderFidelity RenderFidelity = RenderFidelity.Precise;
|
public RenderFidelity RenderFidelity = RenderFidelity.Precise;
|
||||||
public bool UsePartColor = false;
|
public bool UsePartColor = false;
|
||||||
@ -2728,7 +2729,6 @@ namespace RobloxFiles
|
|||||||
{
|
{
|
||||||
IsService = true;
|
IsService = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class StudioData : Instance
|
public class StudioData : Instance
|
||||||
@ -2748,7 +2748,6 @@ namespace RobloxFiles
|
|||||||
{
|
{
|
||||||
IsService = true;
|
IsService = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Team : Instance
|
public class Team : Instance
|
||||||
@ -2983,7 +2982,6 @@ namespace RobloxFiles
|
|||||||
{
|
{
|
||||||
IsService = true;
|
IsService = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract class ValueBase : Instance
|
public abstract class ValueBase : Instance
|
||||||
|
Binary file not shown.
@ -391,7 +391,6 @@ local function generateClasses()
|
|||||||
local firstLine = true
|
local firstLine = true
|
||||||
table.sort(propNames)
|
table.sort(propNames)
|
||||||
|
|
||||||
|
|
||||||
if classTags.Service then
|
if classTags.Service then
|
||||||
writeLine("public %s()", className)
|
writeLine("public %s()", className)
|
||||||
openStack()
|
openStack()
|
||||||
@ -399,8 +398,14 @@ local function generateClasses()
|
|||||||
writeLine("IsService = true;")
|
writeLine("IsService = true;")
|
||||||
closeStack()
|
closeStack()
|
||||||
|
|
||||||
if #propNames > 0 then
|
for i, propName in ipairs(propNames) do
|
||||||
writeLine()
|
local prop = propMap[propName]
|
||||||
|
local serial = prop.Serialization
|
||||||
|
|
||||||
|
if serial.CanLoad then
|
||||||
|
writeLine()
|
||||||
|
break
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -84,6 +84,23 @@ return
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
BevelMesh =
|
||||||
|
{
|
||||||
|
Add =
|
||||||
|
{
|
||||||
|
Bevel = "float";
|
||||||
|
Bevel_Roundness = "float";
|
||||||
|
Bulge = "float";
|
||||||
|
};
|
||||||
|
|
||||||
|
Defaults =
|
||||||
|
{
|
||||||
|
Bevel = 0;
|
||||||
|
Bevel_Roundness = 0;
|
||||||
|
Bulge = 0;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
BinaryStringValue =
|
BinaryStringValue =
|
||||||
{
|
{
|
||||||
Add =
|
Add =
|
||||||
@ -387,6 +404,7 @@ return
|
|||||||
AssetId = "Content";
|
AssetId = "Content";
|
||||||
ChildData = "BinaryString";
|
ChildData = "BinaryString";
|
||||||
MeshData = "BinaryString";
|
MeshData = "BinaryString";
|
||||||
|
FormFactor = "Enum:FormFactor";
|
||||||
};
|
};
|
||||||
|
|
||||||
Defaults =
|
Defaults =
|
||||||
@ -394,6 +412,7 @@ return
|
|||||||
AssetId = "";
|
AssetId = "";
|
||||||
ChildData = "";
|
ChildData = "";
|
||||||
MeshData = "";
|
MeshData = "";
|
||||||
|
FormFactor = Enum.FormFactor.Custom;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ namespace RobloxFiles
|
|||||||
/// <summary>The ClassName of this Instance.</summary>
|
/// <summary>The ClassName of this Instance.</summary>
|
||||||
public string ClassName => GetType().Name;
|
public string ClassName => GetType().Name;
|
||||||
|
|
||||||
/// <summary>Internal list of Properties that are under this Instance.</summary>
|
/// <summary>Internal list of properties that are under this Instance.</summary>
|
||||||
private Dictionary<string, Property> props = new Dictionary<string, Property>();
|
private Dictionary<string, Property> props = new Dictionary<string, Property>();
|
||||||
|
|
||||||
/// <summary>A list of properties that are defined under this Instance.</summary>
|
/// <summary>A list of properties that are defined under this Instance.</summary>
|
||||||
@ -30,7 +30,7 @@ namespace RobloxFiles
|
|||||||
/// <summary>The raw list of children for this Instance.</summary>
|
/// <summary>The raw list of children for this Instance.</summary>
|
||||||
internal List<Instance> Children = new List<Instance>();
|
internal List<Instance> Children = new List<Instance>();
|
||||||
|
|
||||||
/// <summary>Raw value of the Instance's parent.</summary>
|
/// <summary>The raw value of the Instance's parent.</summary>
|
||||||
private Instance RawParent;
|
private Instance RawParent;
|
||||||
|
|
||||||
/// <summary>The name of this Instance.</summary>
|
/// <summary>The name of this Instance.</summary>
|
||||||
|
@ -6,7 +6,6 @@ using RobloxFiles.BinaryFormat;
|
|||||||
using RobloxFiles.BinaryFormat.Chunks;
|
using RobloxFiles.BinaryFormat.Chunks;
|
||||||
|
|
||||||
using RobloxFiles.DataTypes;
|
using RobloxFiles.DataTypes;
|
||||||
using RobloxFiles.Utility;
|
|
||||||
|
|
||||||
namespace RobloxFiles
|
namespace RobloxFiles
|
||||||
{
|
{
|
||||||
@ -140,6 +139,12 @@ namespace RobloxFiles
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Name.Contains(" "))
|
||||||
|
{
|
||||||
|
var implicitName = Name.Replace(' ', '_');
|
||||||
|
return implicitName;
|
||||||
|
}
|
||||||
|
|
||||||
return Name;
|
return Name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -188,13 +193,42 @@ namespace RobloxFiles
|
|||||||
FieldInfo field = Instance.GetType()
|
FieldInfo field = Instance.GetType()
|
||||||
.GetField(ImplicitName, BindingFlags);
|
.GetField(ImplicitName, BindingFlags);
|
||||||
|
|
||||||
try
|
if (field != null)
|
||||||
{
|
{
|
||||||
field?.SetValue(Instance, value);
|
Type fieldType = field.FieldType;
|
||||||
}
|
Type valueType = value?.GetType();
|
||||||
catch
|
|
||||||
{
|
if (fieldType == valueType || value == null)
|
||||||
Console.WriteLine($"RobloxFiles.Property - Failed to cast value {value} into property {Instance.ClassName}.{Name}");
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
field.SetValue(Instance, value);
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
Console.WriteLine($"RobloxFiles.Property - Failed to cast value {value} into property {Instance.ClassName}.{Name}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (valueType != null)
|
||||||
|
{
|
||||||
|
var typeWrapper = new Type[] { valueType };
|
||||||
|
MethodInfo implicitCast = fieldType.GetMethod("op_Implicit", typeWrapper);
|
||||||
|
|
||||||
|
if (implicitCast != null)
|
||||||
|
{
|
||||||
|
var valueWrapper = new object[] { value };
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
object castedValue = implicitCast.Invoke(null, valueWrapper);
|
||||||
|
field.SetValue(Instance, castedValue);
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
Console.WriteLine($"RobloxFiles.Property - Failed to implicitly cast value {value} into property {Instance.ClassName}.{Name}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user