Example #1
0
        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));
            }
        }
Example #2
0
        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);
            }
        }