// Token: 0x060012BE RID: 4798 RVA: 0x0006D6F8 File Offset: 0x0006B8F8 private void WriteLzxPatch(Stream stream, DataPatching patchGenerator, byte[] oldBuffer, int oldSize, byte[] newBuffer, int newSize) { if (oldBuffer.Length != oldSize) { oldBuffer = DiffFileGenerator.GetArraySegment(oldBuffer, 0, oldSize); } if (newBuffer.Length != newSize) { newBuffer = DiffFileGenerator.GetArraySegment(newBuffer, 0, newSize); } byte[] array; if (patchGenerator.TryGenerate(oldBuffer, newBuffer, out array)) { uint crc = OABCRC.ComputeCRC(OABCRC.DefaultSeed, newBuffer); this.WritePatchBlock(stream, oldBuffer.Length, newBuffer.Length, array, array.Length, crc); return; } byte[][] array2 = DiffFileGenerator.SplitByteArray(oldBuffer); byte[][] array3 = DiffFileGenerator.SplitByteArray(newBuffer); for (int i = 0; i < 2; i++) { if (patchGenerator.TryGenerate(array2[i], array3[i], out array)) { uint crc2 = OABCRC.ComputeCRC(OABCRC.DefaultSeed, array3[i]); this.WritePatchBlock(stream, array2[i].Length, array3[i].Length, array, array.Length, crc2); } } }
// Token: 0x06001380 RID: 4992 RVA: 0x00071BCC File Offset: 0x0006FDCC internal void ComputeCRCAndWrite(IWriteToBinaryWriter data, BinaryWriter writer, ref uint crc32) { this.memoryStream.Seek(0L, SeekOrigin.Begin); data.WriteTo(this.memoryWriter); int count = (int)this.memoryStream.Position; crc32 = OABCRC.ComputeCRC(crc32, this.memoryStream.GetBuffer(), 0, count); writer.Write(this.memoryStream.GetBuffer(), 0, count); }
// Token: 0x0600133C RID: 4924 RVA: 0x00070370 File Offset: 0x0006E570 private void CreateFlatFileFromMultiplePagesOfResults(Stream sortedFlatFileStream, List <FileStream> tempFiles) { this.abortProcessingOnShutdown(); using (IOCostStream iocostStream = new IOCostStream(new NoCloseStream(sortedFlatFileStream))) { using (new FileSystemPerformanceTracker("ProduceSortedFlatFile", iocostStream, this.stats)) { using (BinaryWriter binaryWriter = new BinaryWriter(iocostStream)) { using (CRCScratchPad crcscratchPad = new CRCScratchPad()) { OABFileHeader oabfileHeader = new OABFileHeader(); oabfileHeader.WriteTo(binaryWriter); uint num = OABCRC.DefaultSeed; OABPropertyDescriptor[] array = new OABPropertyDescriptor[this.propertyManager.OABProperties.Length]; for (int i = 0; i < array.Length; i++) { array[i] = this.propertyManager.OABProperties[i].PropertyDescriptor; } OABFileProperties data = new OABFileProperties { HeaderProperties = this.propertyManager.HeaderProperties, DetailProperties = array }; crcscratchPad.ComputeCRCAndWrite(data, binaryWriter, ref num); OABFileRecord data2 = this.CreateHeaderRecord(); crcscratchPad.ComputeCRCAndWrite(data2, binaryWriter, ref num); int num2 = 0; using (TempFileReaderCollection tempFileReaderCollection = new TempFileReaderCollection()) { tempFileReaderCollection.Initialize(this.stats, tempFiles); for (;;) { this.abortProcessingOnShutdown(); byte[] nextRecord = tempFileReaderCollection.GetNextRecord(); if (nextRecord == null) { break; } num = OABCRC.ComputeCRC(num, nextRecord, 0, nextRecord.Length); binaryWriter.Write(nextRecord); num2++; } } iocostStream.Seek(0L, SeekOrigin.Begin); oabfileHeader.Version = 32; oabfileHeader.CRC = num; oabfileHeader.RecordCount = num2; oabfileHeader.WriteTo(binaryWriter); this.stats.IODuration += iocostStream.Writing; this.stats.TotalNumberOfRecords += num2; } } } } }