コード例 #1
0
        public static IProperty ReadBinary(ArkArchive archive)
        {
            ArkName name = archive.ReadName();

            if (name == null || string.IsNullOrEmpty(name.ToString()))
            {
                archive.HasUnknownData = true;
                throw new UnreadablePropertyException(
                          $"Property name is {(name == null ? "null" : "empty")}, indicating a corrupt file. Ignoring remaining properties.");
            }

            if (name == ArkName.NameNone)
            {
                return(null);
            }

            ArkName type = archive.ReadName();

            if (type != null && typeMap.TryGetValue(type, out PropertyConstructor constructor))
            {
                return(constructor.BinaryConstructor(archive, name));
            }

            archive.DebugMessage($"Unknown property type {name}");
            archive.HasUnknownNames = true;
            return(new PropertyUnknown(archive, name));
        }
コード例 #2
0
        private void readBinary(ArkArchive archive)
        {
            if (Length >= 8)
            {
                ObjectType = archive.ReadInt();
                switch (ObjectType)
                {
                case TypeId:
                    ObjectId = archive.ReadInt();
                    break;

                case TypePath:
                    ObjectString = archive.ReadName();
                    break;

                default:
                    archive.Position = archive.Position - 4;
                    ObjectType       = TypePathNoType;
                    ObjectString     = archive.ReadName();
                    break;
                }
            }
            else if (Length == 4)
            {
                // Only seems to happen in Version 5
                ObjectType = TypeId;
                ObjectId   = archive.ReadInt();
            }
            else
            {
                Debug.WriteLine($"Warning: ObjectReference with length value {Length} at {archive.Position:X}");
                archive.Position = archive.Position + Length;
            }
        }
コード例 #3
0
        public override void Init(ArkArchive archive, ArkName name)
        {
            base.Init(archive, name);

            ArkName arrayType = archive.ReadName();

            long position = archive.Position;

            try {
                Value = ArkArrayRegistry.ReadBinary(archive, arrayType, this);

                if (Value == null)
                {
                    throw new UnreadablePropertyException("ArkArrayRegistry returned null");
                }
            } catch (UnreadablePropertyException upe) {
                archive.Position = position;

                Value = new ArkArrayUnknown(archive, DataSize, arrayType);

                archive.HasUnknownNames = true;
                Debug.WriteLine($"Reading ArrayProperty of type {arrayType} with name {name} as byte blob because:");
                Debug.WriteLine(upe.Message);
                Debug.WriteLine(upe.StackTrace);
            }
        }
コード例 #4
0
        //private static long serialVersionUID = 1L;

        public override void Init(ArkArchive archive, PropertyArray property)
        {
            int size = archive.ReadInt();

            for (int n = 0; n < size; n++)
            {
                Add(archive.ReadName());
            }
        }
コード例 #5
0
 public override void Init(ArkArchive archive, ArkName name)
 {
     base.Init(archive, name);
     Value = archive.ReadName();
 }
コード例 #6
0
 public override void Init(ArkArchive archive, ArkName name)
 {
     base.Init(archive, name);
     EnumType = archive.ReadName();
     Value    = new ArkByteValue(archive, EnumType != ArkName.NameNone);
 }