/// <summary> /// Loads a data stream as a <see cref="FrontendPackage"/>. /// </summary> /// <param name="br">The <see cref="BinaryReader"/> for the data stream.</param> /// <returns>A new <see cref="FrontendPackage"/> instance.</returns> public FrontendPackage Load(BinaryReader br) { FrontendPackage package = new FrontendPackage(); FrontendChunkReader chunkReader = new FrontendChunkReader(package, br); foreach (var chunk in chunkReader.ReadMainChunks()) { switch (chunk) { case PackageHeaderChunk packageHeaderChunk: this.ProcessPackageHeaderChunk(package, packageHeaderChunk); break; case ObjectContainerChunk objectContainerChunk: ProcessObjectContainerChunk(package, objectContainerChunk); break; } } return(package); }
public FrontendChunkReader(FrontendPackage package, BinaryReader reader) { Package = package; Reader = reader; }
public abstract void Read(FrontendPackage package, FrontendChunkBlock chunkBlock, FrontendChunkReader chunkReader, BinaryReader reader);
public abstract FrontendObject Read(FrontendPackage package, ObjectReaderState readerState, BinaryReader reader);
public abstract void Read(BinaryReader br, FrontendChunkBlock chunkBlock, FrontendPackage package, ushort id, ushort length);
private void ProcessPackageHeaderChunk(FrontendPackage package, PackageHeaderChunk packageHeaderChunk) { package.Filename = packageHeaderChunk.Filename; package.Name = packageHeaderChunk.Name; }
private void ProcessObjectContainerChunk(FrontendPackage package, ObjectContainerChunk objectContainerChunk) { package.Objects.AddRange(objectContainerChunk.Objects); }
public FrontendMessagesTagStream(BinaryReader reader, FrontendPackage package, FrontendChunkBlock frontendChunkBlock, long length) : base(reader, frontendChunkBlock, length) { Package = package; }