Пример #1
0
        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.");
            }
        }
Пример #2
0
 protected byte[] ReadFixedChunk(ref int size)
 {
     byte[] chunk = new byte[size];
     size = InBuffer.Read(chunk, 0, size);
     return(chunk);
 }