コード例 #1
0
        // ---- METHODS ------------------------------------------------------------------------------------------------

        void IResData.Load(ResFileLoader loader)
        {
            if (loader.IsSwitch)
            {
                Name = loader.LoadString();
                long   DataOffset = loader.ReadOffset();
                ushort count      = loader.ReadUInt16();
                Type = loader.ReadEnum <RenderInfoType>(true);
                loader.Seek(5);

                switch (Type)
                {
                case RenderInfoType.Int32:
                    _value = loader.LoadCustom(() => loader.ReadInt32s(count), (uint)DataOffset);
                    break;

                case RenderInfoType.Single:
                    _value = loader.LoadCustom(() => loader.ReadSingles(count), (uint)DataOffset);
                    break;

                case RenderInfoType.String:
                    if (DataOffset == 0)     //Some games have empty data offset and no strings
                    {
                        _value = new string[0];
                    }
                    else
                    {
                        _value = loader.LoadCustom(() => loader.LoadStrings(count), (uint)DataOffset);
                    }
                    break;
                }
            }
            else
            {
                ushort count = loader.ReadUInt16();
                Type = loader.ReadEnum <RenderInfoType>(true);
                loader.Seek(1);
                Name = loader.LoadString();
                switch (Type)
                {
                case RenderInfoType.Int32:
                    _value = loader.ReadInt32s(count);
                    break;

                case RenderInfoType.Single:
                    _value = loader.ReadSingles(count);
                    break;

                case RenderInfoType.String:
                    _value = loader.LoadStrings(count);
                    break;
                }
            }
        }
コード例 #2
0
        // ---- METHODS ------------------------------------------------------------------------------------------------

        void IResData.Load(ResFileLoader loader)
        {
            Name = loader.LoadString();
            ushort count = loader.ReadUInt16();

            Type = loader.ReadEnum <UserDataType>(true);
            loader.Seek(1);
            switch (Type)
            {
            case UserDataType.Int32:
                _value = loader.ReadInt32s(count);
                break;

            case UserDataType.Single:
                _value = loader.ReadSingles(count);
                break;

            case UserDataType.String:
                _value = loader.LoadStrings(count, Encoding.ASCII);
                break;

            case UserDataType.WString:
                _value = loader.LoadStrings(count, Encoding.Unicode);
                break;

            case UserDataType.Byte:
                _value = loader.ReadBytes(count);
                break;
            }
        }
コード例 #3
0
        // ---- METHODS ------------------------------------------------------------------------------------------------

        void IResData.Load(ResFileLoader loader, UserDataType Type, int count)
        {
            switch (Type)
            {
            case UserDataType.Int32:
                _value = loader.ReadInt32s(count);
                break;

            case UserDataType.Single:
                _value = loader.ReadSingles(count);
                break;

            case UserDataType.String:
                _value = loader.LoadStrings(count, Encoding.ASCII);
                break;

            case UserDataType.WString:
                _value = loader.LoadStrings(count, Encoding.Unicode);
                break;

            case UserDataType.Byte:
                _value = loader.ReadBytes(count);
                break;
            }
        }
コード例 #4
0
        // ---- METHODS ------------------------------------------------------------------------------------------------

        void IResData.Load(ResFileLoader loader)
        {
            if (loader.IsSwitch)
            {
                Name = loader.LoadString();
                uint   CurveOffset             = loader.ReadOffset();
                uint   BaseDataOffset          = loader.ReadOffset();
                uint   KeyShapeAnimInfosOffset = loader.ReadOffset();
                ushort numCurve        = loader.ReadUInt16();
                ushort numKeyShapeAnim = loader.ReadUInt16();
                BeginCurve        = loader.ReadInt32();
                BeginKeyShapeAnim = loader.ReadInt32();
                loader.Seek(4); //Padding

                KeyShapeAnimInfos = loader.LoadList <KeyShapeAnimInfo>(numKeyShapeAnim, KeyShapeAnimInfosOffset);
                Curves            = loader.LoadList <AnimCurve>(numCurve, CurveOffset);
                BaseDataList      = loader.LoadCustom(() => loader.ReadSingles(numKeyShapeAnim - 1), BaseDataOffset); // Without base shape.
            }
            else
            {
                ushort numCurve;
                ushort numKeyShapeAnim;
                if (loader.ResFile.Version >= 0x03040000)
                {
                    numCurve        = loader.ReadUInt16();
                    numKeyShapeAnim = loader.ReadUInt16();
                }
                else
                {
                    numCurve        = loader.ReadByte();
                    numKeyShapeAnim = loader.ReadByte();
                    unk             = loader.ReadUInt16();
                }

                BeginCurve        = loader.ReadInt32();
                BeginKeyShapeAnim = loader.ReadInt32();
                Name = loader.LoadString();
                KeyShapeAnimInfos = loader.LoadList <KeyShapeAnimInfo>(numKeyShapeAnim);
                Curves            = loader.LoadList <AnimCurve>(numCurve);
                BaseDataList      = loader.LoadCustom(() => loader.ReadSingles(numKeyShapeAnim - 1)); // Without base shape.
            }
        }
コード例 #5
0
        // ---- METHODS ------------------------------------------------------------------------------------------------

        void IResData.Load(ResFileLoader loader)
        {
            ushort numCurve        = loader.ReadUInt16();
            ushort numKeyShapeAnim = loader.ReadUInt16();

            BeginCurve        = loader.ReadInt32();
            BeginKeyShapeAnim = loader.ReadInt32();
            Name = loader.LoadString();
            KeyShapeAnimInfos = loader.LoadList <KeyShapeAnimInfo>(numKeyShapeAnim);
            Curves            = loader.LoadList <AnimCurve>(numCurve);
            BaseDataList      = loader.LoadCustom(() => loader.ReadSingles(numKeyShapeAnim - 1)); // Without base shape.
        }
コード例 #6
0
        // ---- METHODS ------------------------------------------------------------------------------------------------

        void IResData.Load(ResFileLoader loader)
        {
            ushort count = loader.ReadUInt16();

            Type = loader.ReadEnum <RenderInfoType>(true);
            loader.Seek(1);
            Name = loader.LoadString();
            switch (Type)
            {
            case RenderInfoType.Int32:
                _value = loader.ReadInt32s(count);
                break;

            case RenderInfoType.Single:
                _value = loader.ReadSingles(count);
                break;

            case RenderInfoType.String:
                _value = loader.LoadStrings(count);
                break;
            }
        }
コード例 #7
0
        // ---- METHODS ------------------------------------------------------------------------------------------------

        void IResData.Load(ResFileLoader loader)
        {
            ushort numCurve;
            ushort numKeyShapeAnim;

            if (loader.ResFile.Version >= 0x03040000)
            {
                numCurve        = loader.ReadUInt16();
                numKeyShapeAnim = loader.ReadUInt16();
            }
            else
            {
                numCurve        = loader.ReadByte();
                numKeyShapeAnim = loader.ReadByte();
                unk             = loader.ReadUInt16();
            }

            BeginCurve        = loader.ReadInt32();
            BeginKeyShapeAnim = loader.ReadInt32();
            Name = loader.LoadString();
            KeyShapeAnimInfos = loader.LoadList <KeyShapeAnimInfo>(numKeyShapeAnim);
            Curves            = loader.LoadList <AnimCurve>(numCurve);
            BaseDataList      = loader.LoadCustom(() => loader.ReadSingles(numKeyShapeAnim - 1)); // Without base shape.
        }
コード例 #8
0
        // ---- METHODS ------------------------------------------------------------------------------------------------

        void IResData.Load(ResFileLoader loader)
        {
            _flags = loader.ReadUInt16();
            ushort numKey = loader.ReadUInt16();

            AnimDataOffset = loader.ReadUInt32();
            StartFrame     = loader.ReadSingle();
            EndFrame       = loader.ReadSingle();
            Scale          = loader.ReadSingle();
            Offset         = loader.ReadSingle();
            if (loader.ResFile.Version >= 0x03040000)
            {
                Delta = loader.ReadSingle();
            }
            Frames = loader.LoadCustom(() =>
            {
                switch (FrameType)
                {
                case AnimCurveFrameType.Single:
                    return(loader.ReadSingles(numKey));

                case AnimCurveFrameType.Decimal10x5:
                    float[] dec10x5Frames = new float[numKey];
                    for (int i = 0; i < numKey; i++)
                    {
                        dec10x5Frames[i] = (float)loader.ReadDecimal10x5();
                    }
                    return(dec10x5Frames);

                case AnimCurveFrameType.Byte:
                    float[] byteFrames = new float[numKey];
                    for (int i = 0; i < numKey; i++)
                    {
                        byteFrames[i] = loader.ReadByte();
                    }
                    return(byteFrames);

                default:
                    throw new ResException($"Invalid {nameof(FrameType)}.");
                }
            });
            Keys = loader.LoadCustom(() =>
            {
                int elementsPerKey = ElementsPerKey;
                float[,] keys      = new float[numKey, elementsPerKey];
                switch (KeyType)
                {
                case AnimCurveKeyType.Single:
                    for (int i = 0; i < numKey; i++)
                    {
                        keys[i, 0] = loader.ReadSingle();
                    }
                    break;

                case AnimCurveKeyType.Int16:
                    for (int i = 0; i < numKey; i++)
                    {
                        for (int j = 0; j < elementsPerKey; j++)
                        {
                            keys[i, j] = loader.ReadUInt16();
                        }
                    }
                    break;

                case AnimCurveKeyType.SByte:
                    for (int i = 0; i < numKey; i++)
                    {
                        for (int j = 0; j < elementsPerKey; j++)
                        {
                            keys[i, j] = loader.ReadSByte();
                        }
                    }
                    break;

                default:
                    throw new ResException($"Invalid {nameof(KeyType)}.");
                }
                return(keys);
            });
        }
コード例 #9
0
        void IResData.Load(ResFileLoader loader)
        {
            loader.CheckSignature(_signature);
            Name  = loader.LoadString();
            Flags = loader.ReadEnum <ShapeFlags>(true);
            ushort idx = loader.ReadUInt16();

            MaterialIndex     = loader.ReadUInt16();
            BoneIndex         = loader.ReadUInt16();
            VertexBufferIndex = loader.ReadUInt16();
            ushort numSkinBoneIndex = loader.ReadUInt16();

            VertexSkinCount = loader.ReadByte();
            byte numMesh     = loader.ReadByte();
            byte numKeyShape = loader.ReadByte();

            TargetAttribCount = loader.ReadByte();
            ushort numSubMeshBoundingNodes = loader.ReadUInt16(); // Padding in engine.

            if (loader.ResFile.Version >= 0x04050000)
            {
                RadiusArray = loader.LoadCustom(() => loader.ReadSingles(numMesh));
            }
            else
            {
                RadiusArray = loader.ReadSingles(1);
            }
            VertexBuffer    = loader.Load <VertexBuffer>();
            Meshes          = loader.LoadList <Mesh>(numMesh);
            SkinBoneIndices = loader.LoadCustom(() => loader.ReadUInt16s(numSkinBoneIndex));
            KeyShapes       = loader.LoadDict <KeyShape>();



            // TODO: At least BotW has more data following the Boundings, or that are no boundings at all.
            if (numSubMeshBoundingNodes == 0 && loader.ResFile.Version >= 0x04050000)
            {
                // Compute the count differently if the node count was padding.
                if (numMesh == 1)
                {
                    SubMeshBoundings = loader.LoadCustom(() => loader.ReadBoundings(Meshes[0].SubMeshes.Count + numMesh));
                }
                if (numMesh == 2)
                {
                    SubMeshBoundings = loader.LoadCustom(() => loader.ReadBoundings(Meshes[0].SubMeshes.Count + Meshes[1].SubMeshes.Count + numMesh));
                }
                if (numMesh == 3)
                {
                    SubMeshBoundings = loader.LoadCustom(() => loader.ReadBoundings(Meshes[0].SubMeshes.Count + Meshes[1].SubMeshes.Count + Meshes[2].SubMeshes.Count + numMesh));
                }
                if (numMesh == 4)
                {
                    SubMeshBoundings = loader.LoadCustom(() => loader.ReadBoundings(Meshes[0].SubMeshes.Count + Meshes[1].SubMeshes.Count + Meshes[2].SubMeshes.Count + Meshes[3].SubMeshes.Count + numMesh));
                }

                SubMeshBoundingNodes = new List <BoundingNode>();
            }
            else if (numSubMeshBoundingNodes == 0)
            {
                // Compute the count differently if the node count was padding.
                SubMeshBoundings     = loader.LoadCustom(() => loader.ReadBoundings(Meshes[0].SubMeshes.Count + 1));
                SubMeshBoundingNodes = new List <BoundingNode>();
            }
            else
            {
                SubMeshBoundingNodes   = loader.LoadList <BoundingNode>(numSubMeshBoundingNodes);
                SubMeshBoundings       = loader.LoadCustom(() => loader.ReadBoundings(numSubMeshBoundingNodes));
                SubMeshBoundingIndices = loader.LoadCustom(() => loader.ReadUInt16s(numSubMeshBoundingNodes));
            }
            uint userPointer = loader.ReadUInt32();
        }
コード例 #10
0
        // ---- METHODS ------------------------------------------------------------------------------------------------

        void IResData.Load(ResFileLoader loader)
        {
            loader.CheckSignature(_signature);
            if (loader.IsSwitch)
            {
                Switch.ShapeParser.Read((Switch.Core.ResFileSwitchLoader)loader, this);
            }
            else
            {
                Name  = loader.LoadString();
                Flags = loader.ReadEnum <ShapeFlags>(true);
                ushort idx = loader.ReadUInt16();
                MaterialIndex     = loader.ReadUInt16();
                BoneIndex         = loader.ReadUInt16();
                VertexBufferIndex = loader.ReadUInt16();
                ushort numSkinBoneIndex = loader.ReadUInt16();
                VertexSkinCount = loader.ReadByte();
                byte numMesh     = loader.ReadByte();
                byte numKeyShape = loader.ReadByte();
                TargetAttribCount = loader.ReadByte();
                ushort numSubMeshBoundingNodes = loader.ReadUInt16(); // Padding in engine.

                if (loader.ResFile.Version >= 0x04050000)
                {
                    RadiusArray = loader.LoadCustom(() => loader.ReadSingles(numMesh))?.ToList();
                }
                else
                {
                    RadiusArray = loader.ReadSingles(1).ToList();
                }
                VertexBuffer    = loader.Load <VertexBuffer>();
                Meshes          = loader.LoadList <Mesh>(numMesh).ToList();
                SkinBoneIndices = loader.LoadCustom(() => loader.ReadUInt16s(numSkinBoneIndex))?.ToList();
                KeyShapes       = loader.LoadDict <KeyShape>();

                // TODO: At least BotW has more data following the Boundings, or that are no boundings at all.
                if (numSubMeshBoundingNodes == 0)
                {
                    if (loader.ResFile.Version >= 0x04050000)
                    {
                        numSubMeshBoundingNodes = (ushort)(Meshes.Count + Meshes.Sum(x => x.SubMeshes.Count));
                    }
                    else
                    {
                        numSubMeshBoundingNodes = (ushort)(1 + Meshes[0].SubMeshes.Count + 1);
                    }
                    SubMeshBoundings = loader.LoadCustom(() => loader.ReadBoundings(numSubMeshBoundingNodes))?.ToList();
                }
                else
                {
                    SubMeshBoundingNodes   = loader.LoadList <BoundingNode>(numSubMeshBoundingNodes)?.ToList();
                    SubMeshBoundings       = loader.LoadCustom(() => loader.ReadBoundings(numSubMeshBoundingNodes))?.ToList();
                    SubMeshBoundingIndices = loader.LoadCustom(() => loader.ReadUInt16s(numSubMeshBoundingNodes))?.ToList();
                }

                if (SubMeshBoundingNodes == null)
                {
                    SubMeshBoundingNodes = new List <BoundingNode>();
                }
                if (SubMeshBoundings == null)
                {
                    SubMeshBoundings = new List <Bounding>();
                }
                if (SubMeshBoundingIndices == null)
                {
                    SubMeshBoundingIndices = new List <ushort>();
                }

                uint userPointer = loader.ReadUInt32();
            }
        }
コード例 #11
0
        // ---- METHODS ------------------------------------------------------------------------------------------------

        void IResData.Load(ResFileLoader loader)
        {
            _flags = loader.ReadUInt16();
            ushort numKey = loader.ReadUInt16();

            AnimDataOffset = loader.ReadUInt32();
            StartFrame     = loader.ReadSingle();
            EndFrame       = loader.ReadSingle();
            Scale          = loader.ReadSingle();
            Offset         = loader.ReadSingle();
            if (loader.ResFile.Version >= 0x03040000)
            {
                Delta = loader.ReadSingle();
            }

            Frames = loader.LoadCustom(() =>
            {
                switch (FrameType)
                {
                case AnimCurveFrameType.Single:
                    if (CurveType == AnimCurveType.StepInt)
                    {
                        float[] dec10x5Frame = new float[numKey];
                        for (int i = 0; i < numKey; i++)
                        {
                            dec10x5Frame[i] = loader.ReadUInt32();
                        }
                        return(dec10x5Frame);
                    }
                    else
                    {
                        return(loader.ReadSingles(numKey));
                    }

                case AnimCurveFrameType.Decimal10x5:
                    float[] dec10x5Frames = new float[numKey];
                    for (int i = 0; i < numKey; i++)
                    {
                        dec10x5Frames[i] = (float)loader.ReadDecimal10x5();
                    }
                    return(dec10x5Frames);

                case AnimCurveFrameType.Byte:
                    float[] byteFrames = new float[numKey];
                    for (int i = 0; i < numKey; i++)
                    {
                        byteFrames[i] = loader.ReadByte();
                    }
                    return(byteFrames);

                default:
                    throw new ResException($"Invalid {nameof(FrameType)}.");
                }
            });

            //Bools use bits to store values.
            if (CurveType == AnimCurveType.StepBool)
            {
                int KeyBool = 0;

                if (KeyType == AnimCurveKeyType.Single) //Read them as a int instead of a float
                {
                    KeyBool = loader.LoadCustom(() => loader.ReadInt32());
                }
                else if (KeyType == AnimCurveKeyType.Int16)
                {
                    KeyBool = loader.LoadCustom(() => loader.ReadInt16());
                }
                else if (KeyType == AnimCurveKeyType.SByte)
                {
                    KeyBool = loader.LoadCustom(() => loader.ReadSByte());
                }

                KeyStepBoolData = new bool[numKey];

                for (int i = 0; i < numKey; i++)
                {
                    bool set = (KeyBool & 0x1) != 0;
                    KeyBool >>= 1;

                    KeyStepBoolData[i] = set;
                }
            }
            else
            {
                Keys = loader.LoadCustom(() =>
                {
                    int elementsPerKey = ElementsPerKey;
                    float[,] keys      = new float[numKey, elementsPerKey];
                    switch (KeyType)
                    {
                    case AnimCurveKeyType.Single:
                        for (int i = 0; i < numKey; i++)
                        {
                            for (int j = 0; j < elementsPerKey; j++)
                            {
                                if (CurveType == AnimCurveType.StepInt)
                                {
                                    keys[i, j] = loader.ReadUInt32();
                                }
                                else
                                {
                                    keys[i, j] = loader.ReadSingle();
                                }
                            }
                        }
                        break;

                    case AnimCurveKeyType.Int16:
                        for (int i = 0; i < numKey; i++)
                        {
                            for (int j = 0; j < elementsPerKey; j++)
                            {
                                keys[i, j] = loader.ReadInt16();
                            }
                        }
                        break;

                    case AnimCurveKeyType.SByte:
                        for (int i = 0; i < numKey; i++)
                        {
                            for (int j = 0; j < elementsPerKey; j++)
                            {
                                keys[i, j] = loader.ReadSByte();
                            }
                        }
                        break;

                    default:
                        throw new ResException($"Invalid {nameof(KeyType)}.");
                    }
                    return(keys);
                });
            }
        }
コード例 #12
0
        void IResData.Load(ResFileLoader loader)
        {
            long   FrameArrayOffset = 0;
            long   KeyArrayOffset   = 0;
            ushort numKey           = 0;

            if (loader.IsSwitch)
            {
                FrameArrayOffset = loader.ReadOffset();
                KeyArrayOffset   = loader.ReadOffset();
                _flags           = loader.ReadUInt16();
                numKey           = loader.ReadUInt16();
                AnimDataOffset   = loader.ReadUInt32();
                StartFrame       = loader.ReadSingle();
                EndFrame         = loader.ReadSingle();
                Scale            = loader.ReadSingle();
                Offset           = loader.ReadSingle();
                Delta            = loader.ReadSingle();
                int padding = loader.ReadInt32();
            }
            else
            {
                _flags         = loader.ReadUInt16();
                numKey         = loader.ReadUInt16();
                AnimDataOffset = loader.ReadUInt32();
                StartFrame     = loader.ReadSingle();
                EndFrame       = loader.ReadSingle();
                Scale          = loader.ReadSingle();
                Offset         = loader.ReadSingle();
                if (loader.ResFile.Version >= 0x03040000)
                {
                    Delta = loader.ReadSingle();
                }
                FrameArrayOffset = loader.ReadOffset();
                KeyArrayOffset   = loader.ReadOffset();
            }

            Frames = loader.LoadCustom(() =>
            {
                switch (FrameType)
                {
                case AnimCurveFrameType.Single:
                    return(loader.ReadSingles(numKey));

                case AnimCurveFrameType.Decimal10x5:
                    float[] dec10x5Frames = new float[numKey];
                    for (int i = 0; i < numKey; i++)
                    {
                        dec10x5Frames[i] = (float)loader.ReadDecimal10x5();
                    }
                    return(dec10x5Frames);

                case AnimCurveFrameType.Byte:
                    float[] byteFrames = new float[numKey];
                    for (int i = 0; i < numKey; i++)
                    {
                        byteFrames[i] = loader.ReadByte();
                    }
                    return(byteFrames);

                default:
                    throw new ResException($"Invalid {nameof(FrameType)}.");
                }
            }, (uint)FrameArrayOffset);
            Keys = loader.LoadCustom(() =>
            {
                int elementsPerKey = ElementsPerKey;
                float[,] keys      = new float[numKey, elementsPerKey];
                switch (KeyType)
                {
                case AnimCurveKeyType.Single:
                    for (int i = 0; i < numKey; i++)
                    {
                        for (int j = 0; j < elementsPerKey; j++)
                        {
                            if (CurveType == AnimCurveType.StepInt || CurveType == AnimCurveType.StepBool)
                            {
                                keys[i, j] = loader.ReadUInt32();
                            }
                            else
                            {
                                keys[i, j] = loader.ReadSingle();
                            }
                        }
                    }
                    break;

                case AnimCurveKeyType.Int16:
                    for (int i = 0; i < numKey; i++)
                    {
                        for (int j = 0; j < elementsPerKey; j++)
                        {
                            keys[i, j] = loader.ReadInt16();
                        }
                    }
                    break;

                case AnimCurveKeyType.SByte:
                    for (int i = 0; i < numKey; i++)
                    {
                        for (int j = 0; j < elementsPerKey; j++)
                        {
                            keys[i, j] = loader.ReadSByte();
                        }
                    }
                    break;

                default:
                    throw new ResException($"Invalid {nameof(KeyType)}.");
                }
                return(keys);
            }, (uint)KeyArrayOffset);

            //Bools use bits to store values.
            if (CurveType == AnimCurveType.StepBool)
            {
                int keyIndex = 0;

                KeyStepBoolData = new bool[numKey];
                for (int i = 0; i < Keys.Length; i++)
                {
                    if (numKey <= keyIndex)
                    {
                        break;
                    }

                    int value = (int)Keys[i, 0];

                    //Bit shift each key value
                    for (int j = 0; j < 32; j++)
                    {
                        if (numKey <= keyIndex)
                        {
                            break;
                        }

                        bool set = (value & 0x1) != 0;
                        value >>= 1;

                        KeyStepBoolData[keyIndex] = set;
                        keyIndex++;
                    }
                }
            }
        }
コード例 #13
0
        // ---- METHODS ------------------------------------------------------------------------------------------------

        void IResData.Load(ResFileLoader loader)
        {
            if (loader.IsSwitch)
            {
                Name = loader.LoadString();
                uint DataOffset = loader.ReadOffset();
                uint count      = 0;
                if (loader.ResFile.VersionMajor2 <= 2 && loader.ResFile.VersionMajor == 0)
                {
                    char[] Reserved = loader.ReadChars(8);
                    count = loader.ReadUInt32();
                    Type  = (UserDataType)loader.ReadUInt32();
                }
                else
                {
                    count = loader.ReadUInt32();
                    Type  = loader.ReadEnum <UserDataType>(true);
                    char[] Reserved = loader.ReadChars(43);
                }

                switch (Type)
                {
                case UserDataType.Byte:
                    _value = loader.LoadCustom(() => loader.ReadSBytes((int)count), DataOffset);
                    break;

                case UserDataType.Int32:
                    _value = loader.LoadCustom(() => loader.ReadInt32s((int)count), DataOffset);
                    break;

                case UserDataType.Single:
                    _value = loader.LoadCustom(() => loader.ReadSingles((int)count), DataOffset);
                    break;

                case UserDataType.String:
                    _value = loader.LoadCustom(() => loader.LoadStrings((int)count, Encoding.UTF8), DataOffset);
                    break;

                case UserDataType.WString:
                    _value = loader.LoadCustom(() => loader.LoadStrings((int)count, Encoding.Unicode), DataOffset);
                    break;
                }
            }
            else
            {
                Name = loader.LoadString();
                ushort count = loader.ReadUInt16();
                Type = loader.ReadEnum <UserDataType>(true);
                loader.Seek(1);
                switch (Type)
                {
                case UserDataType.Int32:
                    _value = loader.ReadInt32s(count);
                    break;

                case UserDataType.Single:
                    _value = loader.ReadSingles(count);
                    break;

                case UserDataType.String:
                    _value = loader.LoadStrings(count, Encoding.UTF8);
                    break;

                case UserDataType.WString:
                    _value = loader.LoadStrings(count, Encoding.Unicode);
                    break;

                case UserDataType.Byte:
                    _value = loader.ReadBytes(count);
                    break;
                }
            }
        }