Cleaning up some things.
This commit is contained in:
35
BinaryFormat/Chunks/PRNT.cs
Normal file
35
BinaryFormat/Chunks/PRNT.cs
Normal file
@ -0,0 +1,35 @@
|
||||
namespace RobloxFiles.BinaryFormat.Chunks
|
||||
{
|
||||
public class PRNT
|
||||
{
|
||||
public readonly byte Format;
|
||||
public readonly int NumRelations;
|
||||
|
||||
public readonly int[] ChildrenIds;
|
||||
public readonly int[] ParentIds;
|
||||
|
||||
public PRNT(BinaryRobloxFileChunk chunk)
|
||||
{
|
||||
using (BinaryRobloxFileReader reader = chunk.GetDataReader())
|
||||
{
|
||||
Format = reader.ReadByte();
|
||||
NumRelations = reader.ReadInt32();
|
||||
|
||||
ChildrenIds = reader.ReadInstanceIds(NumRelations);
|
||||
ParentIds = reader.ReadInstanceIds(NumRelations);
|
||||
}
|
||||
}
|
||||
|
||||
public void Assemble(BinaryRobloxFile file)
|
||||
{
|
||||
for (int i = 0; i < NumRelations; i++)
|
||||
{
|
||||
int childId = ChildrenIds[i];
|
||||
int parentId = ParentIds[i];
|
||||
|
||||
Instance child = file.Instances[childId];
|
||||
child.Parent = (parentId >= 0 ? file.Instances[parentId] : file);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user