Esempio n. 1
0
        // Token: 0x06001132 RID: 4402 RVA: 0x000642D8 File Offset: 0x000624D8
        private ADEntry LoadADEntry(XmlReader entryReader, NameNormalizer nameNormalizer, GrammarGenerationLog generationLog)
        {
            base.Logger.TraceDebug(this, "Entering GrammarGenerator.LoadADEntry", new object[0]);
            ADEntry       result        = null;
            string        text          = entryReader.GetAttribute(GrammarRecipientHelper.LookupProperties[2].Name);
            string        attribute     = entryReader.GetAttribute(GrammarRecipientHelper.LookupProperties[0].Name);
            string        attribute2    = entryReader.GetAttribute(GrammarRecipientHelper.LookupProperties[1].Name);
            Guid          guid          = new Guid(entryReader.GetAttribute(GrammarRecipientHelper.LookupProperties[3].Name));
            RecipientType recipientType = (RecipientType)Enum.Parse(typeof(RecipientType), entryReader.GetAttribute(GrammarRecipientHelper.LookupProperties[4].Name));
            string        attribute3    = entryReader.GetAttribute(GrammarRecipientHelper.LookupProperties[6].Name);
            string        attribute4    = entryReader.GetAttribute(GrammarRecipientHelper.LookupProperties[9].Name);

            base.Logger.TraceDebug(this, "GrammarGenerator.LoadADEntry - displayName='{0}', phoneticDisplayName='{1}', smtpAddress='{2}', objectGuid='{3}', recipientType='{4}', dialPlanGuid='{5}', AddressListMembership='{6}'", new object[]
            {
                attribute,
                attribute2,
                text,
                guid,
                recipientType,
                attribute3,
                attribute4
            });
            if (RecipientType.DynamicDistributionGroup != recipientType)
            {
                List <string> list = new List <string>(2);
                if (!string.IsNullOrEmpty(attribute))
                {
                    list.Add(attribute);
                }
                if (!string.IsNullOrEmpty(attribute2))
                {
                    list.Add(attribute2);
                }
                list = NormalizationHelper.GetNormalizedNames(list, nameNormalizer, recipientType, generationLog);
                if (list != null)
                {
                    base.Logger.TraceDebug(this, "GrammarGenerator.LoadADEntry - Valid names found for entry", new object[0]);
                    text = GrammarRecipientHelper.GetNormalizedEmailAddress(text);
                    Guid        dialPlanGuid = string.IsNullOrEmpty(attribute3) ? Guid.Empty : new Guid(attribute3);
                    List <Guid> list2        = new List <Guid>();
                    if (!string.IsNullOrEmpty(attribute4))
                    {
                        char[] separator = new char[]
                        {
                            ','
                        };
                        string[] array = attribute4.Split(separator);
                        foreach (string g in array)
                        {
                            list2.Add(new Guid(g));
                        }
                    }
                    result = new ADEntry(list, text, guid, recipientType, dialPlanGuid, list2);
                }
            }
            return(result);
        }
Esempio n. 2
0
        // Token: 0x06001133 RID: 4403 RVA: 0x000644D4 File Offset: 0x000626D4
        private bool WriteADEntryToGrammars(ADEntry entry, List <DirectoryGrammar> grammarList)
        {
            base.Logger.TraceDebug(this, "Entering GrammarGenerator.WriteADEntryToGrammars", new object[0]);
            bool result = false;

            foreach (DirectoryGrammar directoryGrammar in grammarList)
            {
                directoryGrammar.WriteADEntry(entry);
                if (!directoryGrammar.MaxEntriesExceeded)
                {
                    base.Logger.TraceDebug(this, "Entering GrammarGenerator.WriteADEntryToGrammars - {0} can accept more entries", new object[]
                    {
                        directoryGrammar.FilePath
                    });
                    result = true;
                }
            }
            return(result);
        }
Esempio n. 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);
        }