예제 #1
0
        // Token: 0x06001061 RID: 4193 RVA: 0x0005FB80 File Offset: 0x0005DD80
        private DateTime ParseDateTime(string input)
        {
            DateTime maxValue = DateTime.MaxValue;

            if (!ADCrawler.TryParseWhenChangedUtc(input, out maxValue))
            {
                maxValue = DateTime.MaxValue;
            }
            return(maxValue);
        }
예제 #2
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);
        }
예제 #3
0
        // Token: 0x06001130 RID: 4400 RVA: 0x00063F64 File Offset: 0x00062164
        private List <string> GenerateGrammar(CultureInfo c, IGrammarGeneratorInterface generatorInstance)
        {
            base.Logger.TraceDebug(this, "Entering GrammarGenerator.GenerateGrammar culture='{0}'", new object[]
            {
                c
            });
            string        runFolderPath     = base.RunData.RunFolderPath;
            string        adentriesFileName = generatorInstance.ADEntriesFileName;
            List <string> list = null;

            try
            {
                string entriesFilePath = ADCrawler.GetEntriesFilePath(runFolderPath, adentriesFileName);
                List <DirectoryGrammar> grammarList = generatorInstance.GetGrammarList();
                list = new List <string>(grammarList.Count);
                UmGlobals.ExEvent.LogEvent(UMEventLogConstants.Tuple_GrammarGenerationWritingGrammarEntriesStarted, null, new object[]
                {
                    adentriesFileName,
                    c.Name,
                    base.TenantId,
                    base.RunId
                });
                string grammarFileFolderPath = GrammarFileDistributionShare.GetGrammarFileFolderPath(base.OrgId, base.MailboxGuid, base.RunId, c);
                Directory.CreateDirectory(grammarFileFolderPath);
                string recognizerId = SpeechRecognizerInfo.GetRecognizerId(c);
                if (recognizerId != null)
                {
                    string grammarFolderPath = GrammarFileDistributionShare.GetGrammarFolderPath(base.OrgId, base.MailboxGuid);
                    INormalizationCacheFileStore cacheFileStore = NormalizationCacheMailboxFileStore.FromMailboxGuid(base.OrgId, base.MailboxGuid);
                    using (SpeechRecognitionEngine speechRecognitionEngine = new SpeechRecognitionEngine(recognizerId))
                    {
                        using (XmlReader xmlReader = XmlReader.Create(entriesFilePath))
                        {
                            using (GrammarGenerationLog grammarGenerationLog = new GrammarGenerationLog(grammarFileFolderPath, base.Logger))
                            {
                                NameNormalizer nameNormalizer = new NameNormalizer(c, speechRecognitionEngine, adentriesFileName, grammarFolderPath, base.Logger, cacheFileStore);
                                this.InitializeGrammars(grammarFileFolderPath, c, grammarList);
                                if (xmlReader.ReadToFollowing("ADEntry"))
                                {
                                    for (;;)
                                    {
                                        ADEntry adentry = this.LoadADEntry(xmlReader, nameNormalizer, grammarGenerationLog);
                                        if (adentry != null && !this.WriteADEntryToGrammars(adentry, grammarList))
                                        {
                                            break;
                                        }
                                        base.RunData.ThrowIfShuttingDown();
                                        if (!xmlReader.ReadToFollowing("ADEntry"))
                                        {
                                            goto IL_18A;
                                        }
                                    }
                                    base.Logger.TraceError(this, "GrammarGenerator.Run - Cannot accept more entries in any of the grammar files", new object[0]);
                                }
IL_18A:
                                list.AddRange(this.CompleteGrammars(grammarList));
                                this.UploadResults(list, nameNormalizer, c);
                            }
                        }
                        goto IL_204;
                    }
                }
                UmGlobals.ExEvent.LogEvent(UMEventLogConstants.Tuple_GrammarGenerationMissingCulture, null, new object[]
                {
                    base.TenantId,
                    c.Name,
                    Utils.GetLocalHostFqdn()
                });
IL_204:
                UmGlobals.ExEvent.LogEvent(UMEventLogConstants.Tuple_GrammarGenerationWritingGrammarEntriesCompleted, null, new object[]
                {
                    adentriesFileName,
                    c.Name,
                    base.TenantId,
                    base.RunId
                });
            }
            catch (Exception ex)
            {
                base.Logger.TraceError(this, "GrammarGenerator.Run - Exception='{0}'", new object[]
                {
                    ex
                });
                this.exception = ex;
                throw;
            }
            return(list);
        }
        // Token: 0x06001093 RID: 4243 RVA: 0x00060F1C File Offset: 0x0005F11C
        private bool GenerateChangedGroupList(string domain, GroupMetricsCookie cookie, LazyWriter changedWriter, bool delta)
        {
            DateTime dateTime = delta ? cookie.LastDeltaSync : cookie.LastFullSync;

            if (default(DateTime) != dateTime)
            {
                dateTime = dateTime.AddHours(-1.0);
            }
            DateTime utcNow = DateTime.UtcNow;

            cookie.LastDeltaSync = utcNow;
            if (!delta)
            {
                cookie.LastFullSync = utcNow;
            }
            string entriesFilePath = ADCrawler.GetEntriesFilePath(base.RunData.RunFolderPath, "DistributionList");

            try
            {
                using (XmlReader xmlReader = XmlReader.Create(entriesFilePath))
                {
                    if (xmlReader.ReadToFollowing("ADEntry"))
                    {
                        do
                        {
                            string        attribute     = xmlReader.GetAttribute(GrammarRecipientHelper.LookupProperties[2].Name);
                            string        attribute2    = xmlReader.GetAttribute(GrammarRecipientHelper.LookupProperties[0].Name);
                            Guid          guid          = new Guid(xmlReader.GetAttribute(GrammarRecipientHelper.LookupProperties[3].Name));
                            RecipientType recipientType = (RecipientType)Enum.Parse(typeof(RecipientType), xmlReader.GetAttribute(GrammarRecipientHelper.LookupProperties[4].Name));
                            string        attribute3    = xmlReader.GetAttribute(GrammarRecipientHelper.LookupProperties[7].Name);
                            string        attribute4    = xmlReader.GetAttribute(GrammarRecipientHelper.LookupProperties[8].Name);
                            base.Logger.TraceDebug(this, "GroupMetricsGenerator.GenerateChangedGroupList read AD entry - displayName='{0}', distinguishedName='{1}', smtpAddress='{2}', objectGuid='{3}', recipientType='{4}', whenChangedUTCString='{5}'", new object[]
                            {
                                attribute2,
                                attribute4,
                                attribute,
                                guid,
                                recipientType,
                                attribute3
                            });
                            DateTime utcNow2 = DateTime.UtcNow;
                            bool     flag    = GroupMetricsCookie.TryParseDateTime(attribute3, out utcNow2);
                            if (!delta || !flag || utcNow2 > dateTime || RecipientType.DynamicDistributionGroup == recipientType)
                            {
                                this.changedGroups++;
                                changedWriter.WriteLine(attribute4);
                                base.Logger.TraceDebug(this, "GroupMetricsGenerator.GenerateChangedGroupList write AD entry to changed list- displayName='{0}', distinguishedName='{1}', smtpAddress='{2}', objectGuid='{3}', recipientType='{4}', whenChangedUTCString='{5}'", new object[]
                                {
                                    attribute2,
                                    attribute4,
                                    attribute,
                                    guid,
                                    recipientType,
                                    attribute3
                                });
                            }
                        }while (xmlReader.ReadToFollowing("ADEntry"));
                    }
                }
            }
            catch (Exception ex)
            {
                this.exception = ex;
                GroupMetricsGenerator.EventLogger.LogEvent(InfoWorkerEventLogConstants.Tuple_UnableToGetListOfChangedGroupsForDomain, null, new object[]
                {
                    domain,
                    this.GetOrganizationIdString(),
                    ex.GetType().FullName,
                    ex.Message
                });
                return(false);
            }
            return(true);
        }