public override void Init(ArkArchive archive, PropertyArray property) { int size = archive.ReadInt(); ArkName structType = StructRegistry.MapArrayNameToTypeName(property.Name); if (structType == null) { if (size * 4 + 4 == property.DataSize) { structType = color; } else if (size * 12 + 4 == property.DataSize) { structType = vector; } else if (size * 16 + 4 == property.DataSize) { structType = linearColor; } } for (int n = 0; n < size; n++) { Add(StructRegistry.ReadBinary(archive, structType)); } }
public override void Init(ArkArchive archive, ArkName name) { base.Init(archive, name); structType = archive.ReadName(); long position = archive.Position; try { Value = StructRegistry.ReadBinary(archive, structType); if (Value == null) { throw new UnreadablePropertyException("StructRegistry returned null"); } } catch (UnreadablePropertyException upe) { archive.Position = position; Value = new StructUnknown(archive, DataSize); archive.HasUnknownNames = true; Debug.WriteLine($"Reading StructProperty of type {structType} with name {name} as byte blob because:"); Debug.WriteLine(upe.Message); Debug.WriteLine(upe.StackTrace); } }
public ArkArrayStruct(ArkArchive archive, int dataSize) { var size = archive.GetInt(); Capacity = size; ArkName structType; if (size * 4 + 4 == dataSize) { structType = ArkName.Create("Color"); } else if (size * 12 + 4 == dataSize) { structType = ArkName.Create("Vector"); } else if (size * 16 + 4 == dataSize) { structType = ArkName.Create("LinearColor"); } else { structType = null; } if (structType != null) { for (int n = 0; n < size; n++) { Add(StructRegistry.read(archive, structType)); } } else { for (int n = 0; n < size; n++) { Add(new StructPropertyList(archive, null)); } } }
public override void Init(JArray node, PropertyArray property) { int size = property.DataSize; ArkName structType = StructRegistry.MapArrayNameToTypeName(property.Name); if (structType == null) { if (size * 4 + 4 == property.DataSize) { structType = color; } else if (size * 12 + 4 == property.DataSize) { structType = vector; } else if (size * 16 + 4 == property.DataSize) { structType = linearColor; } } AddRange(node.Select(v => StructRegistry.ReadJson(v, structType))); }
public override void Init(JObject node) { base.Init(node); structType = ArkName.From(node.Value <string>("structType")); Value = node["unknown"] != null && node["unknown"].Type != JTokenType.Null ? new StructUnknown(node["unknown"]) : StructRegistry.ReadJson(node["value"], structType); }