示例#1
0
 // Token: 0x0600133B RID: 4923 RVA: 0x00070070 File Offset: 0x0006E270
 private void CreateFlatFileFromSinglePageOfResults(Stream sortedFlatFileStream, ADRawEntry[] sortedEntries)
 {
     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 defaultSeed = 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 defaultSeed);
                     OABFileRecord data2 = this.CreateHeaderRecord();
                     crcscratchPad.ComputeCRCAndWrite(data2, binaryWriter, ref defaultSeed);
                     using (new StopwatchPerformanceTracker("ProduceSortedFlatFile", this.stats))
                     {
                         using (new CpuPerformanceTracker("ProduceSortedFlatFile", this.stats))
                         {
                             using (new ADPerformanceTracker("ProduceSortedFlatFile", this.stats))
                             {
                                 using (new ActiveManagerPerformanceTracker("ProduceSortedFlatFile", this.stats))
                                 {
                                     this.propertyManager.ResolveLinks(sortedEntries);
                                 }
                             }
                         }
                     }
                     foreach (ADRawEntry adRawEntry in sortedEntries)
                     {
                         this.abortProcessingOnShutdown();
                         OABFileRecord data3 = this.CreateDetailsRecord(adRawEntry);
                         crcscratchPad.ComputeCRCAndWrite(data3, binaryWriter, ref defaultSeed);
                     }
                     iocostStream.Seek(0L, SeekOrigin.Begin);
                     oabfileHeader.Version     = 32;
                     oabfileHeader.CRC         = defaultSeed;
                     oabfileHeader.RecordCount = sortedEntries.Length;
                     oabfileHeader.WriteTo(binaryWriter);
                     this.stats.IODuration           += iocostStream.Writing;
                     this.stats.TotalNumberOfRecords += sortedEntries.Length;
                 }
             }
         }
     }
 }
示例#2
0
 // 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;
                 }
             }
         }
     }
 }