internal static BaseProperty ReadAsObject(PackageReader reader, FPropertyTag tag, FName type, ReadType readType) { BaseProperty prop = type.String switch { "ByteProperty" => new ByteProperty(reader, tag, readType), "BoolProperty" => new BoolProperty(reader, tag, readType), "IntProperty" => new IntProperty(reader), "FloatProperty" => new FloatProperty(reader), "ObjectProperty" => new ObjectProperty(reader), "NameProperty" => new NameProperty(reader), "DelegateProperty" => new DelegateProperty(reader), "DoubleProperty" => new DoubleProperty(reader), "ArrayProperty" => new ArrayProperty(reader, tag), "StructProperty" => new StructProperty(reader, tag), "StrProperty" => new StrProperty(reader), "TextProperty" => new TextProperty(reader), "InterfaceProperty" => new InterfaceProperty(reader), //"MulticastDelegateProperty" => new MulticastDelegateProperty(reader, tag), //"LazyObjectProperty" => new LazyObjectProperty(reader, tag), "SoftObjectProperty" => new SoftObjectProperty(reader, readType), "AssetObjectProperty" => new SoftObjectProperty(reader, readType), "UInt64Property" => new UInt64Property(reader), "UInt32Property" => new UInt32Property(reader), "UInt16Property" => new UInt16Property(reader), "Int64Property" => new Int64Property(reader), "Int16Property" => new Int16Property(reader), "Int8Property" => new Int8Property(reader), "MapProperty" => new MapProperty(reader, tag), "SetProperty" => new SetProperty(reader, tag), "EnumProperty" => new EnumProperty(reader), _ => null, //throw new NotImplementedException($"Parsing of {type.String} types aren't supported yet."), }; return(prop); }
// https://github.com/EpicGames/UnrealEngine/blob/bf95c2cbc703123e08ab54e3ceccdd47e48d224a/Engine/Source/Runtime/CoreUObject/Private/UObject/PropertySet.cpp#L216 internal SetProperty(PackageReader reader, FPropertyTag tag) { var NumKeysToRemove = reader.ReadInt32(); if (NumKeysToRemove != 0) { // Let me know if you find a package that has a non-zero NumKeysToRemove value throw new NotImplementedException("Parsing of non-zero NumKeysToRemove sets aren't supported yet."); } var NumEntries = reader.ReadInt32(); Value = new BaseProperty[NumEntries]; for (int i = 0; i < NumEntries; i++) { Value[i] = ReadProperty(reader, tag, tag.InnerType, ReadType.ARRAY); } }
internal ArrayProperty(PackageReader reader, FPropertyTag tag) { int length = reader.ReadInt32(); Value = new BaseProperty[length]; FPropertyTag InnerTag = default; // Execute if UE4 version is at least VER_UE4_INNER_ARRAY_TAG_INFO if (tag.InnerType.String == "StructProperty") { // Serialize a PropertyTag for the inner property of this array, allows us to validate the inner struct to see if it has changed InnerTag = new FPropertyTag(reader); } for (int i = 0; i < length; i++) { Value[i] = ReadProperty(reader, InnerTag, tag.InnerType, ReadType.ARRAY); } }
// https://github.com/EpicGames/UnrealEngine/blob/7d9919ac7bfd80b7483012eab342cb427d60e8c9/Engine/Source/Runtime/CoreUObject/Private/UObject/PropertyMap.cpp#L243 internal MapProperty(PackageReader reader, FPropertyTag tag) { Position = reader.Position; var NumKeysToRemove = reader.ReadInt32(); if (NumKeysToRemove != 0) { // Let me know if you find a package that has a non-zero NumKeysToRemove value throw new NotImplementedException("Parsing of non-zero NumKeysToRemove maps aren't supported yet."); } var NumEntries = reader.ReadInt32(); var dict = new Dictionary <object, object>(NumEntries); for (int i = 0; i < NumEntries; i++) { dict[ReadAsValue(reader, tag, tag.InnerType, ReadType.MAP)] = BaseProperty.ReadAsObject(reader, tag, tag.ValueType, ReadType.MAP); } Value = dict; }
internal static BaseProperty ReadProperty(PackageReader reader, FPropertyTag tag, FName type, ReadType readType) { BaseProperty prop = type.String switch { "ByteProperty" => new ByteProperty(reader, tag, readType), "BoolProperty" => new BoolProperty(reader, tag, readType), "IntProperty" => new IntProperty(reader, tag), "FloatProperty" => new FloatProperty(reader, tag), "ObjectProperty" => new ObjectProperty(reader, tag), "NameProperty" => new NameProperty(reader, tag), "DelegateProperty" => new DelegateProperty(reader, tag), "DoubleProperty" => new DoubleProperty(reader, tag), "ArrayProperty" => new ArrayProperty(reader, tag), "StructProperty" => new StructProperty(reader, tag), // No code in UE4 source despite these being technically serializable properties //"VectorProperty" => new VectorProperty(reader, tag), //"RotatorProperty" => new RotatorProperty(reader, tag), "StrProperty" => new StrProperty(reader, tag), "TextProperty" => new TextProperty(reader, tag), "InterfaceProperty" => new InterfaceProperty(reader, tag), "MulticastDelegateProperty" => new MulticastDelegateProperty(reader, tag), "LazyObjectProperty" => new LazyObjectProperty(reader, tag), "SoftObjectProperty" => new SoftObjectProperty(reader, tag, readType), "UInt64Property" => new UInt64Property(reader, tag), "UInt32Property" => new UInt32Property(reader, tag), "UInt16Property" => new UInt16Property(reader, tag), "Int64Property" => new Int64Property(reader, tag), "Int16Property" => new Int16Property(reader, tag), "Int8Property" => new Int8Property(reader, tag), "MapProperty" => new MapProperty(reader, tag), "SetProperty" => new SetProperty(reader, tag), "EnumProperty" => new EnumProperty(reader, tag), _ => null, //throw new NotImplementedException($"Parsing of {type.String} types aren't supported yet."), }; return(prop); }