ReadInt32Body() public method

public ReadInt32Body ( ) : int
return int
Example #1
0
        internal Module(AssetLoader loader)
            : base(loader)
        {
            loader.Progress = 0;
            Reader          = loader.Reader;
            var tes4Record = new RecordHeader(Reader);

            tes4Record.RequireType("TES4");
            using (RecordReader reader = tes4Record.OpenReader(Reader)) {
                while (reader.ReadField())
                {
                    switch (reader.Field.Type)
                    {
                    case "HEDR":
                        reader.RequireFieldSize(12);
                        Version               = reader.ReadSingle();
                        RecordCount           = reader.ReadInt32();
                        NextAvailableObjectId = reader.ReadFormId();
                        break;

                    case "CNAM": Author = reader.ReadStringBody(); break;

                    case "SNAM": Description = reader.ReadStringBody(); break;

                    case "MAST": MastersMutable.Add(reader.ReadStringBody()); break;

                    case "DATA":                             // File size of a MAST - always 0, probably vestigial.
                        long fileSize = reader.ReadInt64OrInt32Body();
                        if (fileSize != 0)
                        {
                            throw new InvalidDataException();
                        }
                        break;

                    case "ONAM":
                        OverridesMutable.Capacity = reader.Field.Size / 4;
                        for (int index = 0, count = reader.Field.Size / 4; index < count; index++)
                        {
                            OverridesMutable.Add(reader.ReadFormId());
                        }
                        break;

                    case "INTV": InternalVersion = reader.ReadInt32Body(); break;

                    case "INCC": InternalCC = reader.ReadInt32Body(); break;

                    default:
                        throw reader.UnknownFieldException();
                    }
                }
            }

            while (!loader.AtEnd)
            {
                loader.SetProgressToPosition();
                AddChild(Group.ReadGroup(this));
            }
        }