public PropertyBase(ArkArchive archive, PropertyArgs args) { Name = args.Name; TypeName = args.TypeName; DataSize = archive.GetInt(); Index = archive.GetInt(); }
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(); } }
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; }
public PropertyInt32(ArkArchive archive, PropertyArgs args, bool propertyIsExcluded = false) : base(archive, args, propertyIsExcluded) { if (propertyIsExcluded) { archive.Position += 4; return; } _value = archive.GetInt(); }
public PropertyObject(ArkArchive archive, PropertyArgs args, bool propertyIsExcluded = false) : base(archive, args, propertyIsExcluded) { if (propertyIsExcluded) { archive.Position += DataSize; return; } _value = new ObjectReference(archive, DataSize); }
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(); }
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; } }
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; } }
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); }
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(); }
public PropertyStr(ArkArchive archive, PropertyArgs args) : base(archive, args) { _value = archive.GetString(); }
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)); }
public PropertyName(ArkArchive archive, PropertyArgs args) : base(archive, args) { _value = archive.GetName(); }
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; }