Exemplo n.º 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;
                 }
             }
         }
     }
 }
Exemplo n.º 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;
                 }
             }
         }
     }
 }
Exemplo n.º 3
0
 protected override void InternalProcessRecord()
 {
     TaskLogger.LogEnter();
     using (FileStream fileStream = new FileStream(this.Path, FileMode.Open, FileAccess.Read))
     {
         using (BinaryReader reader = this.GetReader(fileStream))
         {
             OABFileHeader     oabfileHeader     = OABFileHeader.ReadFrom(reader);
             OABFileProperties oabfileProperties = OABFileProperties.ReadFrom(reader, "Properties");
             PropTag[]         properties        = Array.ConvertAll <OABPropertyDescriptor, PropTag>(oabfileProperties.HeaderProperties, (OABPropertyDescriptor propertyDescriptor) => propertyDescriptor.PropTag);
             OABFileRecord     record            = OABFileRecord.ReadFrom(reader, properties, "AddressListRecord");
             PropTag[]         properties2       = Array.ConvertAll <OABPropertyDescriptor, PropTag>(oabfileProperties.DetailProperties, (OABPropertyDescriptor propertyDescriptor) => propertyDescriptor.PropTag);
             if (this.Metadata)
             {
                 GetOABFile.FileMetadata fileMetadata = new GetOABFile.FileMetadata();
                 fileMetadata.Version               = oabfileHeader.Version;
                 fileMetadata.RecordCount           = oabfileHeader.RecordCount;
                 fileMetadata.CRC                   = oabfileHeader.CRC;
                 fileMetadata.AddressListProperties = Array.ConvertAll <OABPropertyDescriptor, GetOABFile.PropertyDescriptor>(oabfileProperties.HeaderProperties, (OABPropertyDescriptor propertyDescriptor) => new GetOABFile.PropertyDescriptor(propertyDescriptor));
                 fileMetadata.RecordProperties      = Array.ConvertAll <OABPropertyDescriptor, GetOABFile.PropertyDescriptor>(oabfileProperties.DetailProperties, (OABPropertyDescriptor propertyDescriptor) => new GetOABFile.PropertyDescriptor(propertyDescriptor));
                 fileMetadata.AddressList           = new GetOABFile.Record(record);
                 GetOABFile.FileMetadata sendToPipeline = fileMetadata;
                 base.WriteObject(sendToPipeline);
             }
             if (this.Data)
             {
                 for (int i = 0; i < oabfileHeader.RecordCount; i++)
                 {
                     OABFileRecord record2 = OABFileRecord.ReadFrom(reader, properties2, "Record[" + i + "]");
                     base.WriteObject(new GetOABFile.Record(record2));
                 }
             }
         }
     }
     TaskLogger.LogExit();
 }