2019-02-01 17:19:20 +00:00
|
|
|
|
namespace RobloxFiles.BinaryFormat.Chunks
|
2019-01-26 00:39:37 +00:00
|
|
|
|
{
|
|
|
|
|
public class PRNT
|
|
|
|
|
{
|
|
|
|
|
public readonly byte Format;
|
|
|
|
|
public readonly int NumRelations;
|
|
|
|
|
|
|
|
|
|
public readonly int[] ChildrenIds;
|
|
|
|
|
public readonly int[] ParentIds;
|
|
|
|
|
|
2019-05-19 04:44:51 +00:00
|
|
|
|
public PRNT(BinaryRobloxFileChunk chunk)
|
2019-01-26 00:39:37 +00:00
|
|
|
|
{
|
2019-05-19 04:44:51 +00:00
|
|
|
|
using (BinaryRobloxFileReader reader = chunk.GetDataReader())
|
2019-01-26 00:39:37 +00:00
|
|
|
|
{
|
|
|
|
|
Format = reader.ReadByte();
|
|
|
|
|
NumRelations = reader.ReadInt32();
|
|
|
|
|
|
|
|
|
|
ChildrenIds = reader.ReadInstanceIds(NumRelations);
|
|
|
|
|
ParentIds = reader.ReadInstanceIds(NumRelations);
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-01-29 09:50:55 +00:00
|
|
|
|
|
2019-01-30 06:36:56 +00:00
|
|
|
|
public void Assemble(BinaryRobloxFile file)
|
2019-01-29 09:50:55 +00:00
|
|
|
|
{
|
|
|
|
|
for (int i = 0; i < NumRelations; i++)
|
|
|
|
|
{
|
|
|
|
|
int childId = ChildrenIds[i];
|
|
|
|
|
int parentId = ParentIds[i];
|
|
|
|
|
|
|
|
|
|
Instance child = file.Instances[childId];
|
2019-05-19 04:44:51 +00:00
|
|
|
|
child.Parent = (parentId >= 0 ? file.Instances[parentId] : file);
|
2019-01-29 09:50:55 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2019-01-26 00:39:37 +00:00
|
|
|
|
}
|
|
|
|
|
}
|