Esempio n. 1
0
        public override void Read(IOMemoryStream ms, UAssetFile f)
        {
            //Read the array type
            arrayType    = ms.ReadNameTableEntry(f);
            unknownArray = ms.ReadInt();
            props        = new List <UProperty>();

            //Skip if this is a ByteProperty
            if (arrayType == "ByteProperty")
            {
                f.Warn("ArrayProperty", "Warning: ArrayProperty is skipping array because ByteProperty arrays are not supported at this time.");
                ms.position += length;
                return;
            }

            long begin = ms.position;

            try
            {
                //Now, read the count. This cuts into the length
                int count = ms.ReadInt();

                //Read items
                f.Debug("Read Array", $"====READ ARRAY BEGIN @ {ms.position} ({arrayType}, {unknownArray})====", ConsoleColor.Yellow);
                for (int i = 0; i < count; i += 1)
                {
                    //Read value
                    props.Add(UProperty.ReadProp(ms, f, arrayType, false));
                }
                f.Debug("Read Array", $"====READ ARRAY END @ {ms.position}====", ConsoleColor.Yellow);
            } catch (Exception ex)
            {
                f.Warn("ArrayProperty", $"Warning: Failed to read array '{name}' with type '{type}' in class '{f.classname}' for '{ex.Message}'. It will now be skipped.");
                ms.position = begin + length;
            }
        }
Esempio n. 2
0
        public override void Read(IOMemoryStream ms, UAssetFile f)
        {
            //Is we're in an array, this will **ALWAYS** be a prop list struct.
            UStruct st;

            if (isArray)
            {
                structType = "(array)";
                unknown    = 0;
                st         = new PropListStruct();
                f.Debug("Read Array", $"====READ STRUCT BEGIN @ {ms.position} ({structType}, {unknown})====", ConsoleColor.Yellow);
            }
            else
            {
                structType = ms.ReadNameTableEntry(f);
                unknown    = ms.ReadInt();
                f.Debug("Read Array", $"====READ STRUCT BEGIN @ {ms.position} ({structType}, {unknown})====", ConsoleColor.Yellow);

                //Find the struct type. Unknown if real: ItemStatInfo
                if (structType == "ItemStatInfo" || structType == "ItemNetID" || structType == "ItemNetInfo" || structType == "Transform" || structType == "PrimalPlayerDataStruct" || structType == "PrimalPlayerCharacterConfigStruct" || structType == "PrimalPersistentCharacterStatsStruct" || structType == "TribeData" || structType == "TribeGovernment" || structType == "TerrainInfo" || structType == "ArkInventoryData" || structType == "DinoOrderGroup" || structType == "ARKDinoData")
                {
                    //Open this as a struct property list.
                    st = new PropListStruct();
                }
                else if (structType == "Vector" || structType == "Rotator")
                {
                    //3d vector or rotor
                    st = new Vector3Struct();
                }
                else if (structType == "Vector2D")
                {
                    //2d vector
                    st = new Vector2Struct();
                }
                else if (structType == "Quat")
                {
                    //Quat
                    st = new QuatStruct();
                }
                else if (structType == "Color")
                {
                    //Color
                    st = new ColorStruct();
                }
                else if (structType == "LinearColor")
                {
                    //Linear color
                    st = new LinearColorStruct();
                }
                else if (structType == "UniqueNetIdRepl")
                {
                    //Some net stuff
                    st = new UniqueNetIdStruct();
                }
                else if (structType == "Guid")
                {
                    //Some net stuff
                    st = new GuidStruct();
                }
                else if (structType == "IntPoint")
                {
                    //Some net stuff
                    st = new IntPointStruct();
                }
                else if (structType == "StringAssetReference")
                {
                    st = new StringAssetReferenceStruct();
                }
                else
                {
                    //Interpet this as a struct property list. Maybe raise a warning later?
                    f.Warn("Struct Warning", $"Unknown type '{structType}'. Interpeting as a struct property list...");
                    st = new PropListStruct();
                }
            }

            //Read
            st.ReadStruct(ms, f, this);
            data = st;

            f.Debug("Read Struct", $"====READ STRUCT END @ {ms.position}====", ConsoleColor.Yellow);
        }