public PropertyBase(ArkArchive archive, PropertyArgs args)
 {
     Name     = args.Name;
     TypeName = args.TypeName;
     DataSize = archive.GetInt();
     Index    = archive.GetInt();
 }
示例#2
0
        public PropertyArray(ArkArchive archive, PropertyArgs args, bool propertyIsExcluded = false) : base(archive, args, propertyIsExcluded)
        {
            if (propertyIsExcluded)
            {
                archive.SkipName();
                archive.Position += DataSize;
                return;
            }

            ArrayType = archive.GetName();

            var position = archive.Position;

            try
            {
                _value = ArkArrayRegistry.read(archive, ArrayType, DataSize);

                if (_value == null)
                {
                    throw new UnreadablePropertyException();
                }
            }
            catch (UnreadablePropertyException)
            {
                archive.Position += DataSize;
                _logger.Error($"Unreadable ArrayProperty with name {Name}, skipping.");
                throw new UnreadablePropertyException();
            }
        }
示例#3
0
        public PropertyText(ArkArchive archive, PropertyArgs args, bool propertyIsExcluded = false) : base(archive, args, propertyIsExcluded)
        {
            if (propertyIsExcluded)
            {
                archive.Position += DataSize;
                return;
            }

            _value = System.Convert.ToBase64String((byte[])(Array)archive.GetBytes(DataSize));
        }
        public PropertyName(ArkArchive archive, PropertyArgs args, bool propertyIsExcluded = false) : base(archive, args, propertyIsExcluded)
        {
            if (propertyIsExcluded)
            {
                archive.SkipName();
                return;
            }

            _value = archive.GetName();
        }
        public PropertyBool(ArkArchive archive, PropertyArgs args, bool propertyIsExcluded = false) : base(archive, args, propertyIsExcluded)
        {
            if (propertyIsExcluded)
            {
                archive.Position += 1;
                return;
            }

            _value = archive.GetByte() != 0;
        }
示例#6
0
        public PropertyInt32(ArkArchive archive, PropertyArgs args, bool propertyIsExcluded = false) : base(archive, args, propertyIsExcluded)
        {
            if (propertyIsExcluded)
            {
                archive.Position += 4;
                return;
            }

            _value = archive.GetInt();
        }
示例#7
0
        public PropertyObject(ArkArchive archive, PropertyArgs args, bool propertyIsExcluded = false) : base(archive, args, propertyIsExcluded)
        {
            if (propertyIsExcluded)
            {
                archive.Position += DataSize;
                return;
            }


            _value = new ObjectReference(archive, DataSize);
        }
示例#8
0
        public PropertyBase(ArkArchive archive, PropertyArgs args, bool propertyIsExcluded = false)
        {
            Name = args.Name;
            //TypeName = args.TypeName;
            DataSize = archive.GetInt();

            if (propertyIsExcluded)
            {
                archive.Position += 4;
                return;
            }

            Index = archive.GetInt();
        }
示例#9
0
        public PropertyStruct(ArkArchive archive, PropertyArgs args) : base(archive, args)
        {
            var structType = archive.GetName();
            var position   = archive.Position;

            try
            {
                _value = StructRegistry.read(archive, structType);
            }
            catch (UnreadablePropertyException)
            {
                // skip struct
                archive.Position += DataSize;
            }
        }
示例#10
0
        public PropertyStruct(ArkArchive archive, PropertyArgs args, bool propertyIsExcluded = false, ArkNameTree exclusivePropertyNameTree = null) : base(archive, args, propertyIsExcluded)
        {
            if (propertyIsExcluded)
            {
                archive.SkipName();
                archive.Position += DataSize;
                return;
            }

            var structType = archive.GetName();
            var position   = archive.Position;

            try
            {
                _value = StructRegistry.read(archive, structType, exclusivePropertyNameTree);
            }
            catch (UnreadablePropertyException)
            {
                // skip struct
                archive.Position += DataSize;
            }
        }
示例#11
0
        public static IProperty readProperty(ArkArchive archive)
        {
            var name = archive.GetName();

            if (name == null || name.Equals(ArkName.EMPTY_NAME))
            {
                _logger.Error($"Property name is {(name == null ? "null" : "empty")}. Ignoring remaining properties.");
                throw new UnreadablePropertyException();
            }

            if (name.Equals(ArkName.NONE_NAME))
            {
                return(null);
            }

            var type = archive.GetName();
            var args = new PropertyArgs(name, type);

            if (type.Equals(_int) || type.Equals(_uint32))
            {
                return(new PropertyInt32(archive, args));
            }
            else if (type.Equals(_bool))
            {
                return(new PropertyBool(archive, args));
            }
            else if (type.Equals(_byte))
            {
                return(new PropertyByte(archive, args));
            }
            else if (type.Equals(_float))
            {
                return(new PropertyFloat(archive, args));
            }
            else if (type.Equals(_double))
            {
                return(new PropertyDouble(archive, args));
            }
            else if (type.Equals(_int8))
            {
                return(new PropertyInt8(archive, args));
            }
            else if (type.Equals(_int16) || type.Equals(_uint16))
            {
                return(new PropertyInt16(archive, args));
            }
            else if (type.Equals(_uint64))
            {
                return(new PropertyInt64(archive, args));
            }
            else if (type.Equals(_name))
            {
                return(new PropertyName(archive, args));
            }
            else if (type.Equals(_object))
            {
                return(new PropertyObject(archive, args));
            }
            else if (type.Equals(_str))
            {
                return(new PropertyStr(archive, args));
            }
            else if (type.Equals(_struct))
            {
                return(new PropertyStruct(archive, args));
            }
            else if (type.Equals(_array))
            {
                return(new PropertyArray(archive, args));
            }
            else if (type.Equals(_text))
            {
                return(new PropertyText(archive, args));
            }
            else
            {
                _logger.Error($"Unknown property type {type} near {archive.Position:X}. Ignoring remaining properties.");
                throw new UnreadablePropertyException();
            }
        }
        public PropertyByte(ArkArchive archive, PropertyArgs args) : base(archive, args)
        {
            var enumName = archive.GetName();

            _value = new ArkByteValue(archive, enumName);
        }
        public PropertyByte(ArkArchive archive, PropertyArgs args, bool propertyIsExcluded = false) : base(archive, args, propertyIsExcluded)
        {
            var enumName = archive.GetName();

            _value = new ArkByteValue(archive, enumName, propertyIsExcluded);
        }
        public static IProperty readProperty(ArkArchive archive, ArkNameTree exclusivePropertyNameTree = null)
        {
            var name = archive.GetName();

            if (name == null || name.Equals(ArkName.EMPTY_NAME))
            {
                _logger.Error($"Property name is {(name == null ? "null" : "empty")}. Ignoring remaining properties.");
                throw new UnreadablePropertyException();
            }

            if (name.Equals(ArkName.NONE_NAME))
            {
                return(null);
            }

            var propertyIsExcluded = exclusivePropertyNameTree?.ContainsKey(name) == false;

            var type = archive.GetName();
            var args = new PropertyArgs(name, type);

            IProperty result = null;

            if (type.Equals(_int) || type.Equals(_uint32))
            {
                result = new PropertyInt32(archive, args, propertyIsExcluded);
            }
            else if (type.Equals(_bool))
            {
                result = new PropertyBool(archive, args, propertyIsExcluded);
            }
            else if (type.Equals(_byte))
            {
                result = new PropertyByte(archive, args, propertyIsExcluded);
            }
            else if (type.Equals(_float))
            {
                result = new PropertyFloat(archive, args, propertyIsExcluded);
            }
            else if (type.Equals(_double))
            {
                result = new PropertyDouble(archive, args, propertyIsExcluded);
            }
            else if (type.Equals(_int8))
            {
                result = new PropertyInt8(archive, args, propertyIsExcluded);
            }
            else if (type.Equals(_int16) || type.Equals(_uint16))
            {
                result = new PropertyInt16(archive, args, propertyIsExcluded);
            }
            else if (type.Equals(_uint64))
            {
                result = new PropertyInt64(archive, args, propertyIsExcluded);
            }
            else if (type.Equals(_name))
            {
                result = new PropertyName(archive, args, propertyIsExcluded);
            }
            else if (type.Equals(_object))
            {
                result = new PropertyObject(archive, args, propertyIsExcluded);
            }
            else if (type.Equals(_str))
            {
                result = new PropertyStr(archive, args, propertyIsExcluded);
            }
            else if (type.Equals(_struct))
            {
                result = new PropertyStruct(archive, args, propertyIsExcluded, exclusivePropertyNameTree == null || propertyIsExcluded ? null : exclusivePropertyNameTree[name]);
            }
            else if (type.Equals(_array))
            {
                result = new PropertyArray(archive, args, propertyIsExcluded);
            }
            else if (type.Equals(_text))
            {
                result = new PropertyText(archive, args, propertyIsExcluded);
            }
            else
            {
                _logger.Error($"Unknown property type {type} near {archive.Position:X}. Ignoring remaining properties.");
                throw new UnreadablePropertyException();
            }

            if (propertyIsExcluded)
            {
                return(ExcludedProperty.Instance);
            }

            return(result);
        }
示例#15
0
 public PropertyFloat(ArkArchive archive, PropertyArgs args) : base(archive, args)
 {
     _value = archive.GetFloat();
 }
 public PropertyInt8(ArkArchive archive, PropertyArgs args) : base(archive, args)
 {
     _value = archive.GetByte();
 }
 public PropertyInt16(ArkArchive archive, PropertyArgs args) : base(archive, args)
 {
     _value = archive.GetShort();
 }
示例#18
0
 public PropertyStr(ArkArchive archive, PropertyArgs args) : base(archive, args)
 {
     _value = archive.GetString();
 }
示例#19
0
 public PropertyInt64(ArkArchive archive, PropertyArgs args) : base(archive, args)
 {
     _value = archive.GetLong();
 }
 public PropertyText(ArkArchive archive, PropertyArgs args) : base(archive, args)
 {
     _value = System.Convert.ToBase64String((byte[])(Array)archive.GetBytes(DataSize));
 }
示例#21
0
 public PropertyName(ArkArchive archive, PropertyArgs args) : base(archive, args)
 {
     _value = archive.GetName();
 }
示例#22
0
 public PropertyInt32(ArkArchive archive, PropertyArgs args) : base(archive, args)
 {
     _value = archive.GetInt();
 }
 public PropertyObject(ArkArchive archive, PropertyArgs args) : base(archive, args)
 {
     _value = new ObjectReference(archive, DataSize);
 }
 public PropertyBool(ArkArchive archive, PropertyArgs args) : base(archive, args)
 {
     _value = archive.GetByte() != 0;
 }