private void ReadEnums(BinaryReader reader) { var entriesOffset = reader.ReadUInt32(); var entriesCount = reader.ReadUInt32(); if (entriesCount == 0) { return; } reader.BaseStream.Position += entriesOffset - 8; // offset minus 2 ints we just read for (var i = 0; i < entriesCount; i++) { var diskEnum = new ResourceDiskEnum { IntrospectionVersion = reader.ReadUInt32(), Id = reader.ReadUInt32(), Name = reader.ReadOffsetString(Encoding.UTF8), DiskCrc = reader.ReadUInt32(), UserVersion = reader.ReadInt32() }; var fieldsOffset = reader.ReadUInt32(); var fieldsSize = reader.ReadUInt32(); // jump to fields if (fieldsSize > 0) { var prev = reader.BaseStream.Position; reader.BaseStream.Position += fieldsOffset - 8; // offset minus 2 ints we just read for (var y = 0; y < fieldsSize; y++) { var field = new ResourceDiskEnum.Value { EnumValueName = reader.ReadOffsetString(Encoding.UTF8), EnumValue = reader.ReadInt32() }; diskEnum.EnumValueIntrospection.Add(field); } reader.BaseStream.Position = prev; } ReferencedEnums.Add(diskEnum); } }
private void ReadEnums(BinaryReader reader) { var entriesOffset = reader.ReadUInt32(); var entriesCount = reader.ReadUInt32(); if (entriesCount == 0) { return; } reader.BaseStream.Position += entriesOffset - 8; // offset minus 2 ints we just read for (var i = 0; i < entriesCount; i++) { var diskEnum = new ResourceDiskEnum(); diskEnum.IntrospectionVersion = reader.ReadUInt32(); diskEnum.Id = reader.ReadUInt32(); diskEnum.Name = reader.ReadOffsetString(Encoding.UTF8); diskEnum.DiskCrc = reader.ReadUInt32(); diskEnum.UserVersion = reader.ReadInt32(); var fieldsOffset = reader.ReadUInt32(); var fieldsSize = reader.ReadUInt32(); // jump to fields if (fieldsSize > 0) { var prev = reader.BaseStream.Position; reader.BaseStream.Position += fieldsOffset - 8; // offset minus 2 ints we just read for (var y = 0; y < fieldsSize; y++) { var field = new ResourceDiskEnum.Value(); field.EnumValueName = reader.ReadOffsetString(Encoding.UTF8); field.EnumValue = reader.ReadInt32(); diskEnum.EnumValueIntrospection.Add(field); } reader.BaseStream.Position = prev; } ReferencedEnums.Add(diskEnum); } }