Пример #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;
                 }
             }
         }
     }
 }
Пример #3
0
        // Token: 0x0600133A RID: 4922 RVA: 0x00070008 File Offset: 0x0006E208
        private OABFileRecord CreateDetailsRecord(ADRawEntry adRawEntry)
        {
            PropRow       props         = this.propertyManager.GetProps(adRawEntry);
            OABFileRecord oabfileRecord = new OABFileRecord
            {
                PropertyValues = new OABPropertyValue[props.Properties.Count]
            };

            for (int i = 0; i < props.Properties.Count; i++)
            {
                this.propertyManager.OABProperties[i].AddPropertyValue(adRawEntry, props, oabfileRecord, i);
            }
            return(oabfileRecord);
        }
Пример #4
0
 internal Record(OABFileRecord record)
 {
     foreach (OABPropertyValue oabpropertyValue in record.PropertyValues)
     {
         if (oabpropertyValue != null)
         {
             if (oabpropertyValue.PropTag == PropTag.DisplayName)
             {
                 this.DisplayName = (string)oabpropertyValue.Value;
             }
             if (oabpropertyValue.PropTag == (PropTag)2355953922U)
             {
                 this.Identity = new Guid((byte[])oabpropertyValue.Value).ToString();
             }
         }
     }
     this.Properties = new GetOABFile.PropertyValueCollection(record.PropertyValues);
 }
Пример #5
0
            // Token: 0x0600135C RID: 4956 RVA: 0x00070CCC File Offset: 0x0006EECC
            protected void AddPropTagToTruncatedPropertiesProperty(OABFileRecord oabFileRecord)
            {
                List <int> list;

                if (oabFileRecord.PropertyValues[oabFileRecord.PropertyValues.Length - 1] == null || oabFileRecord.PropertyValues[oabFileRecord.PropertyValues.Length - 1].Value == null || ((int[])oabFileRecord.PropertyValues[oabFileRecord.PropertyValues.Length - 1].Value).Length == 0)
                {
                    list = new List <int>();
                }
                else
                {
                    list = new List <int>(oabFileRecord.PropertyValues[oabFileRecord.PropertyValues.Length - 1].Value as int[]);
                }
                list.Add((int)this.propTag);
                oabFileRecord.PropertyValues[oabFileRecord.PropertyValues.Length - 1] = new OABPropertyValue
                {
                    PropTag = OABFilePropTags.TruncatedProperties,
                    Value   = list.ToArray()
                };
            }
Пример #6
0
        // Token: 0x06001351 RID: 4945 RVA: 0x00070AF0 File Offset: 0x0006ECF0
        public virtual void AddPropertyValue(ADRawEntry adRawEntry, PropRow propRow, OABFileRecord oabFileRecord, int index)
        {
            PropValue propValue = propRow.Properties[index];

            if (propValue.IsError())
            {
                return;
            }
            if (propValue.PropType == PropType.String)
            {
                string value = this.ValidString((string)propValue.Value, adRawEntry.Id.ToString(), propValue.PropTag.ToString());
                oabFileRecord.PropertyValues[index] = new OABPropertyValue
                {
                    PropTag = this.propTag,
                    Value   = value
                };
                return;
            }
            oabFileRecord.PropertyValues[index] = new OABPropertyValue
            {
                PropTag = this.propTag,
                Value   = propValue.Value
            };
        }
Пример #7
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();
 }
Пример #8
0
        // Token: 0x06001337 RID: 4919 RVA: 0x0006F84C File Offset: 0x0006DA4C
        public AssistantTaskContext ProcessOnePageOfADResults(AssistantTaskContext assistantTaskContext)
        {
            OABGeneratorTaskContext oabgeneratorTaskContext = assistantTaskContext as OABGeneratorTaskContext;
            AssistantStep           oabstep = new AssistantStep(this.ProduceSortedFlatFile);

            OABLogger.LogRecord(TraceType.FunctionTrace, "AddressListFileGenerator.ProcessOnePageOfADResults: start", new object[0]);
            try
            {
                using (new StopwatchPerformanceTracker("Total", this.stats))
                {
                    using (new CpuPerformanceTracker("Total", this.stats))
                    {
                        using (new StopwatchPerformanceTracker("ProcessOnePageOfADResults", this.stats))
                        {
                            using (new CpuPerformanceTracker("ProcessOnePageOfADResults", this.stats))
                            {
                                if (this.adAddressListEnumerator.RetrievedAllData == null || !this.adAddressListEnumerator.RetrievedAllData.Value)
                                {
                                    this.sortedEntries          = this.adAddressListEnumerator.GetNextPageSorted();
                                    this.allResultsInSinglePage = (this.firstPage && this.adAddressListEnumerator.RetrievedAllData != null && this.adAddressListEnumerator.RetrievedAllData.Value);
                                    this.firstPage = false;
                                    if (!this.allResultsInSinglePage)
                                    {
                                        using (new StopwatchPerformanceTracker("ProcessOnePageOfADResults.ResolveLinks", this.stats))
                                        {
                                            using (new CpuPerformanceTracker("ProcessOnePageOfADResults.ResolveLinks", this.stats))
                                            {
                                                using (new ADPerformanceTracker("ProcessOnePageOfADResults.ResolveLinks", this.stats))
                                                {
                                                    using (new ActiveManagerPerformanceTracker("ProcessOnePageOfADResults.ResolveLinks", this.stats))
                                                    {
                                                        this.propertyManager.ResolveLinks(this.sortedEntries);
                                                    }
                                                }
                                            }
                                        }
                                        FileStream fileStream = this.fileSet.Create("TMP");
                                        this.tempFiles.Add(fileStream);
                                        this.stats.TotalNumberOfTempFiles++;
                                        using (new StopwatchPerformanceTracker("ProcessOnePageOfADResults.WriteTempFiles", this.stats))
                                        {
                                            using (new CpuPerformanceTracker("ProcessOnePageOfADResults.WriteTempFiles", this.stats))
                                            {
                                                using (IOCostStream iocostStream = new IOCostStream(new NoCloseStream(fileStream)))
                                                {
                                                    using (new FileSystemPerformanceTracker("ProcessOnePageOfADResults.WriteTempFiles", iocostStream, this.stats))
                                                    {
                                                        using (BinaryWriter binaryWriter = new BinaryWriter(iocostStream))
                                                        {
                                                            foreach (ADRawEntry adrawEntry in this.sortedEntries)
                                                            {
                                                                this.abortProcessingOnShutdown();
                                                                OABFileRecord oabfileRecord = this.CreateDetailsRecord(adrawEntry);
                                                                binaryWriter.Write(((Guid)adrawEntry[ADObjectSchema.ExchangeObjectId]).ToByteArray());
                                                                oabfileRecord.WriteTo(binaryWriter);
                                                            }
                                                            this.stats.IODuration += iocostStream.Writing;
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                                if (this.adAddressListEnumerator.RetrievedAllData == null || !this.adAddressListEnumerator.RetrievedAllData.Value)
                                {
                                    oabstep = new AssistantStep(this.ProcessOnePageOfADResults);
                                }
                            }
                        }
                    }
                }
            }
            finally
            {
                OABLogger.LogRecord(TraceType.FunctionTrace, "AddressListFileGenerator.ProcessOnePageOfADResults: finish", new object[0]);
                oabgeneratorTaskContext.OABStep = oabstep;
            }
            return(OABGeneratorTaskContext.FromOABGeneratorTaskContext(oabgeneratorTaskContext));
        }
Пример #9
0
            // Token: 0x0600136A RID: 4970 RVA: 0x00071524 File Offset: 0x0006F724
            public override void AddPropertyValue(ADRawEntry adRawEntry, PropRow propRow, OABFileRecord oabFileRecord, int index)
            {
                if (!(bool)adRawEntry[this.isOrganizationalProperty])
                {
                    if ((bool)adRawEntry[this.placeholderProperty])
                    {
                        base.AddPropTagToTruncatedPropertiesProperty(oabFileRecord);
                    }
                    return;
                }
                PropValue propValue = propRow.Properties[index];

                if (propValue.IsError())
                {
                    return;
                }
                oabFileRecord.PropertyValues[index] = new OABPropertyValue
                {
                    PropTag = this.propTag,
                    Value   = propValue.Value
                };
            }
Пример #10
0
 // Token: 0x06001366 RID: 4966 RVA: 0x0007144C File Offset: 0x0006F64C
 public override void AddPropertyValue(ADRawEntry adRawEntry, PropRow propRow, OABFileRecord oabFileRecord, int index)
 {
     if ((bool)adRawEntry[this.placeholderProperty])
     {
         base.AddPropTagToTruncatedPropertiesProperty(oabFileRecord);
     }
 }
Пример #11
0
            // Token: 0x06001362 RID: 4962 RVA: 0x000711B8 File Offset: 0x0006F3B8
            public override void AddPropertyValue(ADRawEntry adRawEntry, PropRow propRow, OABFileRecord oabFileRecord, int index)
            {
                PropValue propValue = propRow.Properties[index];

                if (propValue.IsError())
                {
                    return;
                }
                object obj = base.SortValues(propValue);

                if (obj == null || !(obj is byte[][]))
                {
                    return;
                }
                byte[][] array = this.FilterX509Certificates((byte[][])obj);
                if (array != null)
                {
                    oabFileRecord.PropertyValues[index] = new OABPropertyValue
                    {
                        PropTag = this.propTag,
                        Value   = array
                    };
                }
            }
Пример #12
0
            // Token: 0x0600135E RID: 4958 RVA: 0x00070DE0 File Offset: 0x0006EFE0
            public override void AddPropertyValue(ADRawEntry adRawEntry, PropRow propRow, OABFileRecord oabFileRecord, int index)
            {
                PropValue propValue = propRow.Properties[index];

                if (propValue.IsError())
                {
                    return;
                }
                try
                {
                    if (propValue.PropType == PropType.StringArray)
                    {
                        string[] stringArray = propValue.GetStringArray();
                        if (stringArray != null)
                        {
                            string[] value = (from s in stringArray
                                              select this.ValidString(s, adRawEntry.Id.ToString(), propValue.PropTag.ToString()) into v
                                              orderby v
                                              select v).ToArray <string>();
                            oabFileRecord.PropertyValues[index] = new OABPropertyValue
                            {
                                PropTag = this.propTag,
                                Value   = value
                            };
                            return;
                        }
                    }
                }
                catch (Exception ex)
                {
                    OABLogger.LogRecord(TraceType.DebugTrace, "MultivaluedProperty.AddPropertyValue: Informational only: Unable to validate strings in object {0}, property {1}. Reason: {2}", new object[]
                    {
                        adRawEntry.Id.ToString(),
                        propValue.PropTag.ToString(),
                        ex.Message
                    });
                }
                object obj = this.SortValues(propValue);

                if (obj != null)
                {
                    oabFileRecord.PropertyValues[index] = new OABPropertyValue
                    {
                        PropTag = this.propTag,
                        Value   = obj
                    };
                }
            }
Пример #13
0
            // Token: 0x0600135B RID: 4955 RVA: 0x00070C94 File Offset: 0x0006EE94
            public override void AddPropertyValue(ADRawEntry adRawEntry, PropRow propRow, OABFileRecord oabFileRecord, int index)
            {
                PropValue propValue = propRow.Properties[index];

                if (propValue.IsError() || propValue.Value == null)
                {
                    return;
                }
                this.AddPropTagToTruncatedPropertiesProperty(oabFileRecord);
            }
Пример #14
0
 // Token: 0x06001359 RID: 4953 RVA: 0x00070C87 File Offset: 0x0006EE87
 public override void AddPropertyValue(ADRawEntry adRawEntry, PropRow propRow, OABFileRecord oabFileRecord, int index)
 {
 }
Пример #15
0
            // Token: 0x06001357 RID: 4951 RVA: 0x00070C30 File Offset: 0x0006EE30
            public override void AddPropertyValue(ADRawEntry adRawEntry, PropRow propRow, OABFileRecord oabFileRecord, int index)
            {
                PropValue propValue = propRow.Properties[index];

                if (propValue.IsError())
                {
                    return;
                }
                oabFileRecord.PropertyValues[index] = new OABPropertyValue
                {
                    PropTag = (PropTag)2355953922U,
                    Value   = propValue.Value
                };
            }