Exemple #1
0
        // https://github.com/EpicGames/UnrealEngine/blob/bf95c2cbc703123e08ab54e3ceccdd47e48d224a/Engine/Source/Runtime/CoreUObject/Private/UObject/PropertySet.cpp#L216
        internal SetProperty(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 sets aren't supported yet.");
            }

            var NumEntries = reader.ReadInt32();

            Value = new object[NumEntries];
            for (int i = 0; i < NumEntries; i++)
            {
                Value[i] = BaseProperty.ReadAsObject(reader, tag, tag.InnerType, ReadType.ARRAY);
            }
        }
Exemple #2
0
        // 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;
        }
Exemple #3
0
        internal ArrayProperty(PackageReader reader, FPropertyTag tag)
        {
            Position = reader.Position;

            int length = reader.ReadInt32();

            Value = new object[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] = BaseProperty.ReadAsObject(reader, InnerTag, tag.InnerType, ReadType.ARRAY);
            }
        }