private void ReadChunkHeader(Bitstream stream) { header = new ChunkedHeader(); header.IsFile = stream.ReadBool(); if (header.IsFile) { var filenameLength = stream.ReadUInt32(); var filename = new byte[filenameLength + 1]; // semantically wrong. should be // 0x104 stream.Read(filename, 0, (int) filenameLength); // and then read to end of string filename[filenameLength] = 0; // whatever header.Filename = Encoding.UTF8.GetString(filename); throw new NotImplementedException(); } header.IsCompressed = stream.ReadBool(); if (header.IsCompressed) { header.DecompressedLength = stream.ReadBits(26); } header.ByteLength = stream.ReadBits(26); header.ChunkCount = (header.ByteLength + DotaGameConnection.BYTES_PER_CHUNK - 1)/ DotaGameConnection.BYTES_PER_CHUNK; Receiving = true; dataIn = new byte[header.ByteLength]; dataReceived = new bool[header.ChunkCount]; countReceived = 0; }