private byte[] ApplyCopyPatch(ref PatchInfoHeader patchInfoHeader, ref PatchHeader patchHeader, uint patchLength, byte[] originalData) { if (patchLength != patchHeader.PatchedFileSize) throw new InvalidDataException("CopyPatchInvalidSize"); var patchedData = patchLength == originalData.Length ? originalData : new byte[patchLength]; if (Read(patchedData, 0, patchedData.Length) != patchedData.Length) throw new EndOfStreamException(); return patchedData; }