예제 #1
0
        public override audDataBase[] ReadDataItems(RageDataFileReadReference file, int itemCount)
        {
            var items = new audDataBase[itemCount];

            for (int i = 0; i < itemCount; i++)
            {
                var hashKey = file.ReadUInt32();

                var offset = file.ReadInt32();

                var length = file.ReadInt32();

                byte[] data = new byte[length];

                Array.Copy(DataSection, offset, data, 0, length);

                items[i] = CreateDerivedDataType(data[0], hashKey);

                items[i].FileOffset = offset;

                items[i].Length = length;

                items[i].Deserialize(data);
            }
            return(items);
        }
예제 #2
0
        public override audDataBase[] ReadDataItems(RageDataFileReadReference file, int itemCount)
        {
            NametableLength = file.ReadInt32();

            var items = new audDataBase[itemCount];

            for (int i = 0; i < itemCount; i++)
            {
                var variableName = file.ReadString();

                var offset = file.ReadInt32();

                var length = file.ReadInt32();

                int dataType = DataSection[offset];

                byte[] data = new byte[length]; // read item data

                Buffer.BlockCopy(DataSection, offset, data, 0, length);

                switch (dataType)
                {
                    case 0:
                        items[i] = new audInteger(this, variableName);
                        break;
                    case 1:
                        items[i] = new audUInt(this, variableName);
                        break;
                    case 2:
                        items[i] = new audFloat(this, variableName);
                        break;
                    case 3:
                        items[i] = new audString(this, variableName);
                        break;
                    case 5:
                        items[i] = new audVector(this, variableName);
                        break;
                    case 7:
                        items[i] = new audVariableList(this, variableName);
                        break;
                    case 10:
                        items[i] = new audFloatArray(this, variableName);
                        break;
                    default:
                        items[i] = new audByteArray(this, variableName);
                        break;
                }

                items[i].FileOffset = offset;

                items[i].Length = length;

                items[i].Deserialize(data);
            }

            return items;
        }