private byte[] ReadIndexedChunk(byte?obfuscator) { int chunkSize = InReader.ReadInt32(); if (chunkSize > 0) { byte[] chunk = new byte[chunkSize]; InBuffer.Read(chunk, 0, chunkSize); if (obfuscator != null) { for (int i = 0; i < chunkSize; i++) { chunk[i] ^= obfuscator.Value; } } return(chunk); } else { throw new NullFileChunkException("Failed to load file chunk."); } }
protected byte[] ReadFixedChunk(ref int size) { byte[] chunk = new byte[size]; size = InBuffer.Read(chunk, 0, size); return(chunk); }