internal static UEProperty Deserialize(string name, string type, long valueLength, BinaryReader reader)
        {
            UEProperty result;
            var        itemOffset = reader.BaseStream.Position;

            switch (type)
            {
            case "BoolProperty":
                result = new UEBoolProperty(reader, valueLength);
                break;

            case "IntProperty":
                result = new UEIntProperty(reader, valueLength);
                break;

            case "FloatProperty":
                result = new UEFloatProperty(reader, valueLength);
                break;

            case "NameProperty":
            case "StrProperty":
            case "SoftObjectProperty":
            case "ObjectProperty":
                result = new UEStringProperty(reader, valueLength);
                break;

            case "TextProperty":
                result = new UETextProperty(reader, valueLength);
                break;

            case "EnumProperty":
                result = new UEEnumProperty(reader, valueLength);
                break;

            case "StructProperty":
                result = UEStructProperty.Read(reader, valueLength);
                break;

            case "ArrayProperty":
                result = new UEArrayProperty(reader, valueLength);
                break;

            case "MapProperty":
                result = new UEMapProperty(reader, valueLength);
                break;

            case "ByteProperty":
                result = UEByteProperty.Read(reader, valueLength);
                break;

            default:
                throw new FormatException($"Offset: 0x{itemOffset:x8}. Unknown value type '{type}' of item '{name}'");
            }
            result.Name        = name;
            result.Type        = type;
            result.ValueLength = valueLength;
            return(result);
        }
Exemplo n.º 2
0
        private UETextProperty ReadUETextProperty(JObject o)
        {
            UETextProperty value = new UETextProperty();

            value.Flags = long.Parse(o["Flags"].ToString());
            value.Id    = o["Id"].ToString();
            value.Value = o["Value"].ToString();
            return(value);
        }
Exemplo n.º 3
0
        internal static UEProperty Deserialize(string name, string type, long valueLength, BinaryReader reader)
        {
            UEProperty result;
            var        itemOffset = reader.BaseStream.Position;

            switch (type)
            {
            case "BoolProperty":
                result = new UEBoolProperty(reader, valueLength);
                break;

            case "IntPropertyArray":
                result = new UEIntProperty(reader, valueLength, false);
                break;

            case "IntProperty":
                result = new UEIntProperty(reader, valueLength, true);
                break;

            case "UInt32Property":
                result = new UEInt32Property(reader, valueLength);
                break;

            case "FloatProperty":
                result = new UEFloatProperty(reader, valueLength);
                break;

            case "NameProperty":
            case "StrProperty":
                result = new UEStringProperty(reader, valueLength);
                break;

            case "TextProperty":
                result = new UETextProperty(reader, valueLength);
                break;

            case "EnumProperty":
                result = new UEEnumProperty(reader, valueLength);
                break;

            case "StructProperty":
                result         = UEStructProperty.Read(reader, valueLength);
                result.Address = $"0x{ reader.BaseStream.Position - 1:x8}";
                break;

            case "ArrayProperty":
                result = new UEArrayProperty(reader, valueLength);
                break;

            case "MapProperty":
                result = new UEMapProperty(reader, valueLength);
                break;

            case "ByteProperty":
                result         = UEByteProperty.Read(reader, valueLength);
                result.Address = $"0x{ reader.BaseStream.Position - 1:x8}";
                break;

            case "SetProperty":
                result = new UESetProperty(reader, valueLength);
                break;

            case "SoftObjectProperty":
                result = new UEStringProperty(reader, valueLength);
                break;

            case "ObjectProperty":
                result = new UEStringProperty(reader, valueLength);
                break;

            default:
                result = new UEStringProperty(reader, valueLength);
                break;
            }

            result.Name = name;
            result.Type = type;

            Debug.WriteLine(String.Format("{0} ({1}) {2}", name, type, $"0x{ reader.BaseStream.Position - 1:x8}"));

            return(result);
        }
Exemplo n.º 4
0
            public async Task <Info> GetInfo()
            {
                if (InfoChanged)
                {
                    return(CurInfo);
                }

                if (!IsValid())
                {
                    return new Info {
                               Type = PropertyType.Unknown
                    }
                }
                ;

                if (await IsA <UEByteProperty>())
                {
                    InfoChanged = true;

                    CurInfo = await this.Cast <UEByteProperty>().GetInfo();
                }
                else if (await IsA <UEUInt16Property>())
                {
                    InfoChanged = true;
                    CurInfo     = UEUInt16Property.GetInfo();
                }
                else if (await IsA <UEUInt32Property>())
                {
                    InfoChanged = true;
                    CurInfo     = UEUInt32Property.GetInfo();
                }
                else if (await IsA <UEUInt64Property>())
                {
                    InfoChanged = true;
                    CurInfo     = UEUInt64Property.GetInfo();
                }
                else if (await IsA <UEInt8Property>())
                {
                    InfoChanged = true;
                    CurInfo     = UEInt8Property.GetInfo();
                }
                else if (await IsA <UEInt16Property>())
                {
                    InfoChanged = true;
                    CurInfo     = UEInt16Property.GetInfo();
                }
                else if (await IsA <UEIntProperty>())
                {
                    InfoChanged = true;
                    CurInfo     = UEIntProperty.GetInfo();
                }
                else if (await IsA <UEInt64Property>())
                {
                    InfoChanged = true;
                    CurInfo     = UEInt64Property.GetInfo();
                }
                else if (await IsA <UEFloatProperty>())
                {
                    InfoChanged = true;
                    CurInfo     = UEFloatProperty.GetInfo();
                }
                else if (await IsA <UEDoubleProperty>())
                {
                    InfoChanged = true;
                    CurInfo     = UEDoubleProperty.GetInfo();
                }
                else if (await IsA <UEBoolProperty>())
                {
                    InfoChanged = true;
                    CurInfo     = await this.Cast <UEBoolProperty>().GetInfo();
                }
                else if (await IsA <UEObjectProperty>())
                {
                    InfoChanged = true;
                    CurInfo     = await this.Cast <UEObjectProperty>().GetInfo();
                }
                else if (await IsA <UEClassProperty>())
                {
                    InfoChanged = true;
                    CurInfo     = await this.Cast <UEClassProperty>().GetInfo();
                }
                else if (await IsA <UEInterfaceProperty>())
                {
                    InfoChanged = true;
                    CurInfo     = await this.Cast <UEInterfaceProperty>().GetInfo();
                }
                else if (await IsA <UEWeakObjectProperty>())
                {
                    InfoChanged = true;
                    CurInfo     = await this.Cast <UEWeakObjectProperty>().GetInfo();
                }
                else if (await IsA <UELazyObjectProperty>())
                {
                    InfoChanged = true;
                    CurInfo     = await this.Cast <UELazyObjectProperty>().GetInfo();
                }
                else if (await IsA <UEAssetObjectProperty>())
                {
                    InfoChanged = true;
                    CurInfo     = await this.Cast <UEAssetObjectProperty>().GetInfo();
                }
                else if (await IsA <UEAssetClassProperty>())
                {
                    InfoChanged = true;
                    CurInfo     = await UEAssetClassProperty.GetInfo();
                }
                else if (await IsA <UENameProperty>())
                {
                    InfoChanged = true;
                    CurInfo     = await UENameProperty.GetInfo();
                }
                else if (await IsA <UEStructProperty>())
                {
                    InfoChanged = true;
                    CurInfo     = await this.Cast <UEStructProperty>().GetInfo();
                }
                else if (await IsA <UEStrProperty>())
                {
                    InfoChanged = true;
                    CurInfo     = await UEStrProperty.GetInfo();
                }
                else if (await IsA <UETextProperty>())
                {
                    InfoChanged = true;
                    CurInfo     = await UETextProperty.GetInfo();
                }
                else if (await IsA <UEArrayProperty>())
                {
                    InfoChanged = true;
                    CurInfo     = await this.Cast <UEArrayProperty>().GetInfo();
                }
                else if (await IsA <UEMapProperty>())
                {
                    InfoChanged = true;
                    CurInfo     = await this.Cast <UEMapProperty>().GetInfo();
                }
                else if (await IsA <UEDelegateProperty>())
                {
                    InfoChanged = true;
                    CurInfo     = await UEDelegateProperty.GetInfo();
                }
                else if (await IsA <UEMulticastDelegateProperty>())
                {
                    InfoChanged = true;
                    CurInfo     = await UEMulticastDelegateProperty.GetInfo();
                }
                else if (await IsA <UEEnumProperty>())
                {
                    InfoChanged = true;
                    CurInfo     = await this.Cast <UEEnumProperty>().GetInfo();
                }

                return(CurInfo);
            }
        }