Esempio n. 1
0
        // Token: 0x0600105D RID: 4189 RVA: 0x0005F918 File Offset: 0x0005DB18
        private void LogCompletion(DtmfMapGeneratorTaskContext taskContext, RecipientType recipientType)
        {
            base.Logger.TraceDebug(null, "Entering DtmfMapGenerator.LogCompletion recipientType='{0}'", new object[]
            {
                recipientType
            });
            UmGlobals.ExEvent.LogEvent(UMEventLogConstants.Tuple_DtmfMapGenerationSuccessful, null, new object[]
            {
                base.RunData.TenantId,
                base.RunData.RunId,
                recipientType
            });
            DateTime runStartTime              = base.RunStartTime;
            DateTime lastFullUpdateTimeUtc     = taskContext.IsFullUpdate ? base.RunStartTime : taskContext.Metadata.LastFullUpdateTimeUtc;
            DtmfMapGenerationMetadata metadata = new DtmfMapGenerationMetadata(1, base.TenantId, base.RunId, Utils.GetLocalHostFqdn(), "15.00.1497.010", runStartTime, lastFullUpdateTimeUtc);
            string metadataFileName            = this.GetMetadataFileName(recipientType);
            string dtmfMapFolderPath           = GrammarFileDistributionShare.GetDtmfMapFolderPath(base.RunData.OrgId, base.RunData.MailboxGuid);

            base.Logger.TraceDebug(this, "LogCompletion folderPath='{0}', fileName='{1}'", new object[]
            {
                dtmfMapFolderPath,
                metadataFileName
            });
            string text = DtmfMapGenerationMetadata.Serialize(metadata, metadataFileName, dtmfMapFolderPath);

            if (text != null)
            {
                this.UploadMetadata(text, metadataFileName);
            }
        }
Esempio n. 2
0
 // Token: 0x0600105F RID: 4191 RVA: 0x0005FADC File Offset: 0x0005DCDC
 private bool IsFullUpdateRequired(DtmfMapGenerationMetadata metadata)
 {
     base.Logger.TraceDebug(this, "Last full update time UTC='{0}'", new object[]
     {
         metadata.LastFullUpdateTimeUtc
     });
     return(DateTime.UtcNow - metadata.LastFullUpdateTimeUtc > this.FullUpdateInterval);
 }
Esempio n. 3
0
        // Token: 0x06001052 RID: 4178 RVA: 0x0005EF08 File Offset: 0x0005D108
        public static DtmfMapGenerationMetadata Deserialize(string filePath)
        {
            ValidateArgument.NotNullOrEmpty(filePath, "filePath");
            Utilities.DebugTrace(ExTraceGlobals.DtmfMapGeneratorTracer, "DtmfMapGenerationMetadata.Deserialize - filePath='{0}'", new object[]
            {
                filePath
            });
            DtmfMapGenerationMetadata result = null;

            try
            {
                using (Stream stream = new FileStream(filePath, FileMode.Open, FileAccess.Read))
                {
                    using (XmlTextReader xmlTextReader = new XmlTextReader(stream))
                    {
                        xmlTextReader.ReadToFollowing("DtmfMapGeneration");
                        xmlTextReader.MoveToAttribute("metadataVersion");
                        string attribute       = xmlTextReader.GetAttribute("metadataVersion");
                        int    metadataVersion = int.Parse(attribute);
                        xmlTextReader.MoveToAttribute("tenantId");
                        string attribute2 = xmlTextReader.GetAttribute("tenantId");
                        xmlTextReader.MoveToAttribute("runId");
                        string attribute3 = xmlTextReader.GetAttribute("runId");
                        Guid   runId      = Guid.Parse(attribute3);
                        xmlTextReader.MoveToAttribute("serverName");
                        string attribute4 = xmlTextReader.GetAttribute("serverName");
                        xmlTextReader.MoveToAttribute("serverVersion");
                        string attribute5 = xmlTextReader.GetAttribute("serverVersion");
                        xmlTextReader.MoveToAttribute("lastIncrementalUpdateTimeUtc");
                        string   attribute6 = xmlTextReader.GetAttribute("lastIncrementalUpdateTimeUtc");
                        DateTime lastIncrementalUpdateTimeUtc = DateTime.Parse(attribute6, DateTimeFormatInfo.InvariantInfo, DateTimeStyles.RoundtripKind);
                        xmlTextReader.MoveToAttribute("lastFullUpdateTimeUtc");
                        string   attribute7            = xmlTextReader.GetAttribute("lastFullUpdateTimeUtc");
                        DateTime lastFullUpdateTimeUtc = DateTime.Parse(attribute7, DateTimeFormatInfo.InvariantInfo, DateTimeStyles.RoundtripKind);
                        result = new DtmfMapGenerationMetadata(metadataVersion, attribute2, runId, attribute4, attribute5, lastIncrementalUpdateTimeUtc, lastFullUpdateTimeUtc);
                    }
                }
            }
            catch (Exception ex)
            {
                Utilities.DebugTrace(ExTraceGlobals.DtmfMapGeneratorTracer, "DtmfMapGenerationMetadata.Serialize - exception='{0}'", new object[]
                {
                    ex
                });
                UmGlobals.ExEvent.LogEvent(UMEventLogConstants.Tuple_LoadDtmfMapGenerationMetadataFailed, null, new object[]
                {
                    filePath,
                    CommonUtil.ToEventLogString(ex)
                });
                if (!DtmfMapGenerationMetadata.IsExpectedException(ex))
                {
                    throw;
                }
            }
            return(result);
        }
Esempio n. 4
0
        // Token: 0x06001051 RID: 4177 RVA: 0x0005ECFC File Offset: 0x0005CEFC
        public static string Serialize(DtmfMapGenerationMetadata metadata, string fileName, string folderPath)
        {
            ValidateArgument.NotNull(metadata, "metadata");
            ValidateArgument.NotNullOrEmpty(fileName, "fileName");
            ValidateArgument.NotNullOrEmpty(folderPath, "folderPath");
            Utilities.DebugTrace(ExTraceGlobals.DtmfMapGeneratorTracer, "DtmfMapGenerationMetadata.Serialize - fileName='{0}', folderPath='{1}'", new object[]
            {
                fileName,
                folderPath
            });
            string text = Path.Combine(folderPath, fileName);

            try
            {
                Directory.CreateDirectory(folderPath);
                using (Stream stream = new FileStream(text, FileMode.Create, FileAccess.ReadWrite))
                {
                    using (XmlTextWriter xmlTextWriter = new XmlTextWriter(stream, Encoding.UTF8))
                    {
                        xmlTextWriter.WriteStartDocument();
                        xmlTextWriter.WriteStartElement("DtmfMapGeneration");
                        xmlTextWriter.WriteAttributeString("metadataVersion", metadata.MetadataVersion.ToString("d"));
                        xmlTextWriter.WriteAttributeString("tenantId", metadata.TenantId);
                        xmlTextWriter.WriteAttributeString("runId", metadata.RunId.ToString());
                        xmlTextWriter.WriteAttributeString("serverName", metadata.ServerName);
                        xmlTextWriter.WriteAttributeString("serverVersion", metadata.ServerVersion);
                        xmlTextWriter.WriteAttributeString("lastIncrementalUpdateTimeUtc", metadata.LastIncrementalUpdateTimeUtc.ToString("u", DateTimeFormatInfo.InvariantInfo));
                        xmlTextWriter.WriteAttributeString("lastFullUpdateTimeUtc", metadata.LastFullUpdateTimeUtc.ToString("u", DateTimeFormatInfo.InvariantInfo));
                        xmlTextWriter.WriteEndElement();
                        xmlTextWriter.WriteEndDocument();
                    }
                }
            }
            catch (Exception ex)
            {
                Utilities.DebugTrace(ExTraceGlobals.DtmfMapGeneratorTracer, "DtmfMapGenerationMetadata.Serialize - exception='{0}'", new object[]
                {
                    ex
                });
                UmGlobals.ExEvent.LogEvent(UMEventLogConstants.Tuple_SaveDtmfMapGenerationMetadataFailed, null, new object[]
                {
                    text,
                    CommonUtil.ToEventLogString(ex)
                });
                if (!DtmfMapGenerationMetadata.IsExpectedException(ex))
                {
                    throw;
                }
                text = null;
            }
            return(text);
        }
Esempio n. 5
0
        // Token: 0x06001059 RID: 4185 RVA: 0x0005F390 File Offset: 0x0005D590
        private DtmfMapGeneratorTaskContext InitializeTask(RecipientType recipientType, DirectoryProcessorBaseTaskContext context)
        {
            base.Logger.TraceDebug(null, "Entering DtmfMapGenerator.InitializeTask recipientType='{0}'", new object[]
            {
                recipientType
            });
            string text = null;

            if (recipientType != RecipientType.User)
            {
                if (recipientType != RecipientType.Group)
                {
                    ExAssert.RetailAssert(false, "Unsupported recipient type");
                }
                else
                {
                    text = "DistributionList";
                }
            }
            else
            {
                text = "User";
            }
            string entriesFilePath = ADCrawler.GetEntriesFilePath(base.RunData.RunFolderPath, text);

            base.Logger.TraceDebug(null, "DtmfMapGenerator.InitializeTask adEntriesFileName='{0}', entriesFilePath='{1}'", new object[]
            {
                text,
                entriesFilePath
            });
            XmlReader adEntriesReader            = XmlReader.Create(entriesFilePath);
            DtmfMapGenerationMetadata   metadata = this.GetMetadata(recipientType);
            DtmfMapGeneratorTaskContext dtmfMapGeneratorTaskContext = new DtmfMapGeneratorTaskContext(context.MailboxData, context.Job, context.TaskQueue, context.Step, context.TaskStatus, adEntriesReader, metadata, this.IsFullUpdateRequired(metadata), context.RunData, context.DeferredFinalizeTasks);

            UmGlobals.ExEvent.LogEvent(UMEventLogConstants.Tuple_DtmfMapGenerationStarted, null, new object[]
            {
                base.TenantId,
                base.RunId,
                recipientType.ToString(),
                dtmfMapGeneratorTaskContext.IsFullUpdate
            });
            return(dtmfMapGeneratorTaskContext);
        }
Esempio n. 6
0
        // Token: 0x0600105E RID: 4190 RVA: 0x0005FA38 File Offset: 0x0005DC38
        private DtmfMapGenerationMetadata GetMetadata(RecipientType recipientType)
        {
            base.Logger.TraceDebug(this, "GetMetadata recipientType='{0}'", new object[]
            {
                recipientType
            });
            DtmfMapGenerationMetadata dtmfMapGenerationMetadata = null;
            string metadataFilePath = this.GetMetadataFilePath(recipientType);

            if (metadataFilePath != null)
            {
                base.Logger.TraceDebug(this, "Metadata found, metadataFilePath='{0}'", new object[]
                {
                    metadataFilePath
                });
                dtmfMapGenerationMetadata = DtmfMapGenerationMetadata.Deserialize(metadataFilePath);
            }
            if (dtmfMapGenerationMetadata == null)
            {
                base.Logger.TraceDebug(this, "GetMetadata could not retrieve metadata", new object[0]);
                dtmfMapGenerationMetadata = new DtmfMapGenerationMetadata(1, base.TenantId, base.RunId, Utils.GetLocalHostFqdn(), "15.00.1497.010", DateTime.MinValue, DateTime.MinValue);
            }
            return(dtmfMapGenerationMetadata);
        }
 // Token: 0x0600106A RID: 4202 RVA: 0x0005FCFC File Offset: 0x0005DEFC
 public DtmfMapGeneratorTaskContext(MailboxData mailboxData, TimeBasedDatabaseJob job, Queue <TaskQueueItem> taskQueue, AssistantStep step, TaskStatus taskStatus, XmlReader adEntriesReader, DtmfMapGenerationMetadata metadata, bool isFullUpdate, RunData runData, IList <DirectoryProcessorBaseTask> deferredFinalizeTasks) : base(mailboxData, job, taskQueue, step, taskStatus, runData, deferredFinalizeTasks)
 {
     ValidateArgument.NotNull(adEntriesReader, "adEntriesReader");
     ValidateArgument.NotNull(metadata, "metadata");
     this.AdEntriesReader = adEntriesReader;
     this.Metadata        = metadata;
     this.IsFullUpdate    = isFullUpdate;
 }