public DGRP3DMesh(DGRP dgrp, Stream source, GraphicsDevice gd) { using (var cstream = new GZipStream(source, CompressionMode.Decompress)) { using (var io = IoBuffer.FromStream(cstream, ByteOrder.LITTLE_ENDIAN)) { var fsom = io.ReadCString(4); Version = io.ReadInt32(); ReconstructVersion = io.ReadInt32(); Name = io.ReadPascalString(); var geomCount = io.ReadInt32(); Geoms = new List <Dictionary <Texture2D, DGRP3DGeometry> >(); for (int i = 0; i < geomCount; i++) { var d = new Dictionary <Texture2D, DGRP3DGeometry>(); var subCount = io.ReadInt32(); for (int j = 0; j < subCount; j++) { var geom = new DGRP3DGeometry(io, dgrp, gd); d.Add(geom.Pixel, geom); } Geoms.Add(d); } var x = io.ReadFloat(); var y = io.ReadFloat(); var z = io.ReadFloat(); var x2 = io.ReadFloat(); var y2 = io.ReadFloat(); var z2 = io.ReadFloat(); Bounds = new BoundingBox(new Vector3(x, y, z), new Vector3(x2, y2, z2)); } } }
/* * public DIREntry GetEntryByID(EntryRef ID) * { * if (m_EntryByID.ContainsKey(ID)) * return m_EntryByID[ID]; * else * return null; * }*/ public static void Read(DBPFFile package, byte[] file) { var gGroupID = Hash.GroupHash(Path.GetFileNameWithoutExtension(package.fname)); var stream = new MemoryStream(file); var reader = IoBuffer.FromStream(stream, ByteOrder.LITTLE_ENDIAN); //var count = 0; while (stream.Position < file.Length) { var TypeID = reader.ReadUInt32(); var GroupID = reader.ReadUInt32(); if (GroupID == 0xFFFFFFFF && package.fname != "") { GroupID = gGroupID; } var InstanceID = reader.ReadUInt32(); uint InstanceID2 = 0x00000000; if (package.IndexMinorVersion >= 2) { InstanceID2 = reader.ReadUInt32(); } var idEntry2 = Hash.TGIRHash(InstanceID, InstanceID2, TypeID, GroupID); package.GetEntryByFullID(idEntry2).uncompressedSize = reader.ReadUInt32(); /* * if (!m_EntryByFullID.ContainsKey(idEntry2)) * m_EntryByFullID.Add(idEntry2, entry); * entry.UncompressedFileSize = reader.ReadUInt32(); * count += 1;*/ } reader.Dispose(); stream.Dispose(); }
/// <summary> /// Reads a skeleton from a stream. /// </summary> /// <param name="stream">A Stream instance holding a skeleton.</param> public void Read(Stream stream, bool bcf) { using (var io = IoBuffer.FromStream(stream)) { if (!bcf) { var version = io.ReadUInt32(); } Name = io.ReadPascalString(); var boneCount = io.ReadInt16(); Bones = new Bone[boneCount]; for (var i = 0; i < boneCount; i++) { Bone bone = ReadBone(io, bcf); bone.Index = i; Bones[i] = bone; } /** Construct tree **/ foreach (var bone in Bones) { bone.Children = Bones.Where(x => x.ParentName == bone.Name).ToArray(); } RootBone = Bones.FirstOrDefault(x => x.ParentName == "NULL"); ComputeBonePositions(RootBone, Matrix.Identity); } }
/// <summary> /// Reads a NBRS chunk from a stream. /// </summary> /// <param name="iff">An Iff instance.</param> /// <param name="stream">A Stream object holding a OBJf chunk.</param> public override void Read(IffFile iff, Stream stream) { using (var io = IoBuffer.FromStream(stream, ByteOrder.LITTLE_ENDIAN)) { io.ReadUInt32(); //pad Version = io.ReadUInt32(); //0x49 for latest game string magic = io.ReadCString(4); //SRBN var count = io.ReadUInt32(); for (int i = 0; i < count; i++) { if (!io.HasMore) { return; } var neigh = new Neighbour(io); Entries.Add(neigh); if (neigh.Unknown1 > 0) { NeighbourByID.Add(neigh.NeighbourID, neigh); DefaultNeighbourByGUID[neigh.GUID] = neigh.NeighbourID; } } } Entries = Entries.OrderBy(x => x.NeighbourID).ToList(); }
public BCF(Stream stream, bool cmx) { using (var io = (cmx) ? new BCFReadString(stream, true) : (BCFReadProxy)IoBuffer.FromStream(stream, ByteOrder.LITTLE_ENDIAN)) { Skeletons = new Skeleton[io.ReadInt32()]; for (int i = 0; i < Skeletons.Length; i++) { Skeletons[i] = new Skeleton(); Skeletons[i].Read(io, true); Skeletons[i].ParentBCF = this; } Appearances = new Appearance[io.ReadInt32()]; for (int i = 0; i < Appearances.Length; i++) { Appearances[i] = new Appearance(); Appearances[i].ReadBCF(io); Appearances[i].ParentBCF = this; } Animations = new Animation[io.ReadInt32()]; for (int i = 0; i < Animations.Length; i++) { Animations[i] = new Animation(); Animations[i].Read(io, true); Animations[i].ParentBCF = this; } } }
public static void Read(DBPFFile package, byte[] file) { var gGroupID = package.groupID; var stream = new MemoryStream(file); var reader = IoBuffer.FromStream(stream, ByteOrder.LITTLE_ENDIAN); while (stream.Position < file.Length) { var TypeID = reader.ReadUInt32(); var GroupID = reader.ReadUInt32(); if (GroupID == 0xFFFFFFFF && package.fname != "") { GroupID = gGroupID; } var InstanceID = reader.ReadUInt32(); uint InstanceID2 = 0x00000000; if (package.IndexMinorVersion >= 2) { InstanceID2 = reader.ReadUInt32(); } var idEntry2 = Hash.TGIRHash(InstanceID, InstanceID2, TypeID, GroupID); package.GetEntryByFullID(idEntry2).uncompressedSize = reader.ReadUInt32(); } reader.Dispose(); stream.Dispose(); }
public override void Read(IffFile iff, Stream stream) { using (var io = IoBuffer.FromStream(stream, ByteOrder.LITTLE_ENDIAN)) { var zero = io.ReadInt32(); var version = io.ReadInt32(); if (version > 1) { throw new Exception("Unexpected TREE version: " + version); } string magic = io.ReadCString(4); //HBGN if (magic != "EERT") { throw new Exception("Magic number should be 'EERT', got " + magic); } var entryCount = io.ReadInt32(); Entries.Clear(); for (int i = 0; i < entryCount; i++) { var box = new TREEBox(this); box.Read(io, version); box.InternalID = (short)i; Entries.Add(box); } } }
public override void Read(Iff iff, Stream stream) { using (var io = IoBuffer.FromStream(stream, ByteOrder.LITTLE_ENDIAN)) { Name = io.ReadNullTerminatedString(); } }
/// <summary> /// Reads a NGBH chunk from a stream. /// </summary> /// <param name="iff">An Iff instance.</param> /// <param name="stream">A Stream object holding a OBJf chunk.</param> public override void Read(IffFile iff, Stream stream) { using (var io = IoBuffer.FromStream(stream, ByteOrder.LITTLE_ENDIAN)) { io.ReadUInt32(); //pad Version = io.ReadUInt32(); //0x49 for latest game string magic = io.ReadCString(4); //HBGN for (int i = 0; i < 16; i++) { NeighborhoodData[i] = io.ReadInt16(); } var count = io.ReadInt32(); for (int i = 0; i < count; i++) { if (io.ReadInt32() != 1) { } var neighID = io.ReadInt16(); var inventoryCount = io.ReadInt32(); var inventory = new List <InventoryItem>(); for (int j = 0; j < inventoryCount; j++) { inventory.Add(new InventoryItem(io)); } InventoryByID[neighID] = inventory; } } }
/// <summary> /// Reads a binding from a stream. /// </summary> /// <param name="stream">A Stream instance holding a binding.</param> public void Read(Stream stream) { using (var io = IoBuffer.FromStream(stream)) { var version = io.ReadUInt32(); if (version != 1) { throw new Exception("Unknown binding version"); } Bone = io.ReadPascalString(); var meshType = io.ReadUInt32(); if (meshType == 8) { this.MeshGroupID = io.ReadUInt32(); this.MeshFileID = io.ReadUInt32(); this.MeshTypeID = io.ReadUInt32(); } var textureType = io.ReadUInt32(); if (textureType == 8) { this.TextureGroupID = io.ReadUInt32(); this.TextureFileID = io.ReadUInt32(); this.TextureTypeID = io.ReadUInt32(); } } }
/// <summary> /// Reads a FAMI chunk from a stream. /// </summary> /// <param name="iff">An Iff instance.</param> /// <param name="stream">A Stream object holding a OBJf chunk.</param> public override void Read(IffFile iff, Stream stream) { using (var io = IoBuffer.FromStream(stream, ByteOrder.LITTLE_ENDIAN)) { io.ReadUInt32(); //pad Version = io.ReadUInt32(); //0x9 for latest game string magic = io.ReadCString(4); //IMAF HouseNumber = io.ReadInt32(); FamilyNumber = io.ReadInt32(); Budget = io.ReadInt32(); ValueInArch = io.ReadInt32(); FamilyFriends = io.ReadInt32(); Unknown = io.ReadInt32(); FamilyGUIDs = new uint[io.ReadInt32()]; for (int i = 0; i < FamilyGUIDs.Length; i++) { FamilyGUIDs[i] = io.ReadUInt32(); } try { for (int i = 0; i < 4; i++) { io.ReadInt32(); } } catch { //for some reason FAMI "Default" only has 3 zeroes after it, but only if saved by base game. } } }
//(deltax, deltay, deltaz, gravity) //(deltavar, rotdeltavar, size, sizevel) //(duration, fadein, fadeout, sizevar) //(targetColor.rgb, variation) public override void Read(IffFile iff, Stream stream) { using (var io = IoBuffer.FromStream(stream, ByteOrder.LITTLE_ENDIAN)) { Version = io.ReadInt32(); Type = io.ReadInt32(); Frequency = io.ReadFloat(); TexID = io.ReadUInt16(); Particles = io.ReadInt32(); if (Type == 1) { Bounds = new BoundingBox( new Vector3(io.ReadFloat(), io.ReadFloat(), io.ReadFloat()), new Vector3(io.ReadFloat(), io.ReadFloat(), io.ReadFloat())); } Velocity = new Vector3(io.ReadFloat(), io.ReadFloat(), io.ReadFloat()); Gravity = io.ReadFloat(); RandomVel = io.ReadFloat(); RandomRotVel = io.ReadFloat(); Size = io.ReadFloat(); SizeVel = io.ReadFloat(); Duration = io.ReadFloat(); FadeIn = io.ReadFloat(); FadeOut = io.ReadFloat(); SizeVariation = io.ReadFloat(); TargetColor.PackedValue = io.ReadUInt32(); TargetColorVar = io.ReadFloat(); } }
public override void Read(IffFile iff, Stream stream) { using (var io = IoBuffer.FromStream(stream, ByteOrder.LITTLE_ENDIAN)) { io.ReadUInt32(); //pad var version = io.ReadUInt32(); //zero var TTAT = io.ReadUInt32(); var compressionCode = io.ReadByte(); if (compressionCode != 1) { throw new Exception("hey what!!"); } var iop = new IffFieldEncode(io); var total = iop.ReadInt32(); for (int i = 0; i < total; i++) { var guid = (uint)iop.ReadInt32(); var count = iop.ReadInt32(); var tatts = new short[count]; for (int j = 0; j < count; j++) { tatts[j] = iop.ReadInt16(); } TypeAttributesByGUID[guid] = tatts; } } }
public override void Read(Iff iff, Stream stream) { using (var io = IoBuffer.FromStream(stream, ByteOrder.LITTLE_ENDIAN)) { StringBuilder temp = new StringBuilder(); var num = io.ReadByte(); if (num < 48) { //less than smallest ASCII value for valid filename character, so assume this is a pascal string temp.Append(io.ReadCString(num)); } else { //we're actually a null terminated string! temp.Append((char)num); while (stream.Position < stream.Length) { char read = (char)io.ReadByte(); if (read == 0) { break; } else { temp.Append(read); } } } Name = temp.ToString(); } }
public override void Read(IffFile iff, Stream stream) { using (var io = IoBuffer.FromStream(stream, ByteOrder.LITTLE_ENDIAN)) { Version = io.ReadUInt16(); SourceIff = io.ReadVariableLengthPascalString(); if (Version > 1) { Comment = io.ReadVariableLengthPascalString(); } Entries = new PIFFEntry[io.ReadUInt16()]; for (int i = 0; i < Entries.Length; i++) { var e = new PIFFEntry(); e.Type = io.ReadCString(4); e.ChunkID = io.ReadUInt16(); if (Version > 1) { e.Comment = io.ReadVariableLengthPascalString(); } e.EntryType = (PIFFEntryType)io.ReadByte(); if (e.EntryType == PIFFEntryType.Patch) { e.ChunkLabel = io.ReadVariableLengthPascalString(); e.ChunkFlags = io.ReadUInt16(); if (Version > 0) { e.NewChunkID = io.ReadUInt16(); } else { e.NewChunkID = e.ChunkID; } e.NewDataSize = io.ReadUInt32(); var size = io.ReadUInt32(); e.Patches = new PIFFPatch[size]; uint lastOff = 0; for (int j = 0; j < e.Patches.Length; j++) { var p = new PIFFPatch(); p.Offset = lastOff + io.ReadVarLen(); lastOff = p.Offset; p.Size = io.ReadVarLen(); p.Mode = (PIFFPatchMode)io.ReadByte(); if (p.Mode == PIFFPatchMode.Add) { p.Data = io.ReadBytes(p.Size); } e.Patches[j] = p; } } Entries[i] = e; } } }
public void Load(Stream stream) { using (var io = IoBuffer.FromStream(stream, ByteOrder.LITTLE_ENDIAN)) { var magic = io.ReadCString(4); if (magic != "NBHm") { throw new Exception("Not a valid neighbourhood model!"); } Version = io.ReadInt32(); var houseC = io.ReadInt32(); for (int i = 0; i < houseC; i++) { var house = new NBHmHouse() { HouseNum = io.ReadInt16(), Position = new Vector3() { X = io.ReadFloat(), Y = io.ReadFloat(), Z = io.ReadFloat() } }; Houses[house.HouseNum] = house; } io.ReadByte(); //has model. right now there is no model. } }
public void ReadBCF(Stream stream) { using (var io = IoBuffer.FromStream(stream, ByteOrder.LITTLE_ENDIAN)) { Name = io.ReadPascalString(); var type = io.ReadInt32(); var zero = io.ReadInt32(); var numBindings = io.ReadUInt32(); Bindings = new AppearanceBinding[numBindings]; for (var i = 0; i < numBindings; i++) { //bindings are included verbatim here. var bnd = new Binding(); bnd.Bone = io.ReadPascalString(); bnd.MeshName = io.ReadPascalString(); io.ReadInt32(); io.ReadInt32(); Bindings[i] = new AppearanceBinding { RealBinding = bnd }; } } }
public override void Read(IffFile iff, Stream stream) { using (var io = IoBuffer.FromStream(stream, ByteOrder.LITTLE_ENDIAN)) { Version = io.ReadInt32(); Params = new DGRPRCParams(io, Version); } }
public override void Read(IffFile iff, Stream stream) { using (var io = IoBuffer.FromStream(stream, ByteOrder.LITTLE_ENDIAN)) { Version = io.ReadInt32(); var length = io.ReadInt32(); Data = io.ReadBytes(length); } }
public void Read(Stream stream) { ByChunkId = new Dictionary <Type, Dictionary <ushort, object> >(); ByChunkType = new Dictionary <Type,List <object> >(); using (var io = IoBuffer.FromStream(stream,ByteOrder.BIG_ENDIAN)) { var identifier = io.ReadChars(60,false).Replace("\0",""); if (identifier != "IFF FILE 2.5:TYPE FOLLOWED BY SIZE JAMIE DOORNBOS & MAXIS 1") { throw new Exception("Invalid iff file!"); } var rsmpOffset = io.ReadUInt32(); while (io.HasMore) { var chunkType = io.ReadChars(4); var chunkSize = io.ReadUInt32(); var chunkID = io.ReadUInt16(); var chunkFlags = io.ReadUInt16(); var chunkLabel = io.ReadChars(64); var chunkDataSize = chunkSize - 76; /** Do we understand this chunk type? **/ if (!CHUNK_TYPES.ContainsKey(chunkType)) { /** Skip it! **/ io.Skip(chunkDataSize); } else { Type chunkClass = CHUNK_TYPES[chunkType]; AbstractIffChunk newChunk = (AbstractIffChunk)Activator.CreateInstance(chunkClass); newChunk.ChunkID = chunkID; newChunk.ChunkFlags = chunkFlags; newChunk.ChunkLabel = chunkLabel; newChunk.ChunkData = io.ReadBytes(chunkDataSize); newChunk.ChunkParent = this; if (!ByChunkType.ContainsKey(chunkClass)) { ByChunkType.Add(chunkClass,new List <object>()); } if (!ByChunkId.ContainsKey(chunkClass)) { ByChunkId.Add(chunkClass,new Dictionary <ushort,object>()); } ByChunkType[chunkClass].Add(newChunk); //if (chunkID != 0){ ByChunkId[chunkClass].Add(chunkID,newChunk); //} } } } }
/// <summary> /// Reads a DBPF archive from a stream. /// </summary> /// <param name="stream">The stream to read from.</param> public void Read(Stream stream) { var io = IoBuffer.FromStream(stream, ByteOrder.LITTLE_ENDIAN); this.Io = io; var magic = io.ReadCString(4); if (magic != "DBPF") { throw new Exception("Not a DBPF file"); } var majorVersion = io.ReadUInt32(); var minorVersion = io.ReadUInt32(); var version = majorVersion + (((double)minorVersion) / 10.0); /** Unknown, set to 0 **/ io.Skip(12); if (version == 1.0) { this.DateCreated = io.ReadInt32(); this.DateModified = io.ReadInt32(); } if (version < 2.0) { IndexMajorVersion = io.ReadUInt32(); } NumEntries = io.ReadUInt32(); if (version < 2.0) { var indexOffset = io.ReadUInt32(); } var indexSize = io.ReadUInt32(); if (version < 2.0) { var trashEntryCount = io.ReadUInt32(); var trashIndexOffset = io.ReadUInt32(); var trashIndexSize = io.ReadUInt32(); var indexMinor = io.ReadUInt32(); } else if (version == 2.0) { var indexMinor = io.ReadUInt32(); var indexOffset = io.ReadUInt32(); io.Skip(4); } /** Padding **/ io.Skip(32); }
public override object GenDecode(System.IO.Stream stream) { var ani = new Animation(); using (var io = IoBuffer.FromStream(stream, ByteOrder.BIG_ENDIAN)) { ani.Read((BCFReadProxy)io, false); } return(ani); }
public override object GenDecode(System.IO.Stream stream) { var result = new Skeleton(); using (var io = IoBuffer.FromStream(stream, ByteOrder.BIG_ENDIAN)) { result.Read((BCFReadProxy)io, false); } return(result); }
public override object GenDecode(System.IO.Stream stream) { var mesh = new Mesh(); using (var io = IoBuffer.FromStream(stream, ByteOrder.LITTLE_ENDIAN)) { mesh.Read((BCFReadProxy)io, true); } return(mesh); }
public int AddYOff; //accounts for difference between roofed and unroofed. relative to the base. public override void Read(IffFile iff, Stream stream) { using (var io = IoBuffer.FromStream(stream, ByteOrder.LITTLE_ENDIAN)) { Width = io.ReadInt32(); Height = io.ReadInt32(); BaseYOff = io.ReadInt32(); XOff = io.ReadInt32(); //0 in all cases i've found, pretty much? AddYOff = io.ReadInt32(); } }
public void DecodeIfRequired() { if (ToDecode != null) { using (IoBuffer buf = IoBuffer.FromStream(new MemoryStream(ToDecode), Parent.ByteOrd)) { ReadDeferred(Version, buf); } ToDecode = null; } }
public override void Read(Iff iff, Stream stream) { using (var io = IoBuffer.FromStream(stream, ByteOrder.LITTLE_ENDIAN)) { Interactions = new TTABInteraction[io.ReadUInt16()]; var version = io.ReadUInt16(); IOProxy iop; if (version != 9 && version != 10) { iop = new TTABNormal(io); } else { iop = new TTABFieldEncode(io); //haven't guaranteed that this works, since none of the objects in the test lot use it. } for (int i = 0; i < Interactions.Length; i++) { var result = new TTABInteraction(); result.ActionFunction = iop.ReadUInt16(); result.TestFunction = iop.ReadUInt16(); result.MotiveEntries = new TTABMotiveEntry[iop.ReadUInt32()]; result.Flags = iop.ReadUInt32(); result.TTAIndex = iop.ReadUInt32(); if (version > 6) { result.AttenuationCode = iop.ReadUInt32(); } result.AttenuationValue = iop.ReadFloat(); result.AutonomyThreshold = iop.ReadUInt32(); result.JoiningIndex = iop.ReadInt32(); for (int j = 0; j < result.MotiveEntries.Length; j++) { var motive = new TTABMotiveEntry(); if (version > 6) { motive.EffectRangeMinimum = iop.ReadInt16(); } motive.EffectRangeMaximum = iop.ReadInt16(); if (version > 6) { motive.PersonalityModifier = iop.ReadUInt16(); } result.MotiveEntries[j] = motive; } if (version > 9) { result.Unknown = iop.ReadUInt32(); } Interactions[i] = result; } } }
public DGRP3DMesh(DGRP dgrp, Stream source, GraphicsDevice gd) { using (var cstream = new GZipStream(source, CompressionMode.Decompress)) { using (var io = IoBuffer.FromStream(cstream, ByteOrder.LITTLE_ENDIAN)) { var fsom = io.ReadCString(4); Version = io.ReadInt32(); ReconstructVersion = io.ReadInt32(); if (ReconstructVersion != 0 && ReconstructVersion < CURRENT_RECONSTRUCT) { throw new Exception("Reconstruction outdated, must be rerun!"); } Name = io.ReadPascalString(); var geomCount = io.ReadInt32(); Geoms = new List <Dictionary <Texture2D, DGRP3DGeometry> >(); for (int i = 0; i < geomCount; i++) { var d = new Dictionary <Texture2D, DGRP3DGeometry>(); var subCount = io.ReadInt32(); for (int j = 0; j < subCount; j++) { var geom = new DGRP3DGeometry(io, dgrp, gd, Version); if (geom.Pixel == null && geom.PrimCount > 0) { throw new Exception("Invalid Mesh! (old format)"); } d.Add(geom.Pixel, geom); } Geoms.Add(d); } if (Version > 2) { MaskType = (DGRP3DMaskType)io.ReadInt32(); if (MaskType > DGRP3DMaskType.None) { DepthMask = new DGRP3DGeometry(io, dgrp, gd, Version); } } var x = io.ReadFloat(); var y = io.ReadFloat(); var z = io.ReadFloat(); var x2 = io.ReadFloat(); var y2 = io.ReadFloat(); var z2 = io.ReadFloat(); Bounds = new BoundingBox(new Vector3(x, y, z), new Vector3(x2, y2, z2)); } } }
public override void Read(Iff iff, Stream stream) { using (var io = IoBuffer.FromStream(stream, ByteOrder.LITTLE_ENDIAN)){ var num = io.ReadByte(); Flags = io.ReadByte(); Constants = new ushort[num]; for (var i = 0; i < num; i++) { Constants[i] = io.ReadUInt16(); } } }
/// <summary> /// Reads a SPR chunk from a stream. /// </summary> /// <param name="iff">An Iff instance.</param> /// <param name="stream">A Stream object holding a SPR chunk.</param> public override void Read(IffFile iff, Stream stream) { using (var io = IoBuffer.FromStream(stream, ByteOrder.LITTLE_ENDIAN)) { var version1 = io.ReadUInt16(); var version2 = io.ReadUInt16(); uint version = 0; if (version1 == 0) { io.ByteOrder = ByteOrder.BIG_ENDIAN; version = (uint)(((version2 | 0xFF00) >> 8) | ((version2 & 0xFF) << 8)); } else { version = version1; } ByteOrd = io.ByteOrder; var spriteCount = io.ReadUInt32(); PaletteID = (ushort)io.ReadUInt32(); Frames = new List <SPRFrame>(); if (version != 1001) { var offsetTable = new List <uint>(); for (var i = 0; i < spriteCount; i++) { offsetTable.Add(io.ReadUInt32()); } Offsets = offsetTable; for (var i = 0; i < spriteCount; i++) { var frame = new SPRFrame(this); io.Seek(SeekOrigin.Begin, offsetTable[i]); var guessedSize = ((i + 1 < offsetTable.Count) ? offsetTable[i + 1] : (uint)stream.Length) - offsetTable[i]; frame.Read(version, io, guessedSize); Frames.Add(frame); } } else { while (io.HasMore) { var frame = new SPRFrame(this); frame.Read(version, io, 0); Frames.Add(frame); } } } }