// Token: 0x06001111 RID: 4369 RVA: 0x000634E0 File Offset: 0x000616E0
        private List <ADUser> GetAllSystemMailboxes(Guid databaseGuid)
        {
            UMTracer.DebugTrace("UMGrammarTenantCache.GetAllSystemMailboxes for database '{0}'", new object[]
            {
                databaseGuid
            });
            List <ADUser> systemMailboxes = new List <ADUser>();
            Exception     ex = Utilities.RunSafeADOperation(ExTraceGlobals.UMGrammarGeneratorTracer, delegate
            {
                systemMailboxes.AddRange(OrganizationMailbox.FindByDatabaseId(OrganizationCapability.UMGrammar, new ADObjectId(databaseGuid)));
            }, "GetAllSystemMailboxes: Getting all system mailboxes in a given database");

            if (ex != null)
            {
                UMTracer.ErrorTrace("GetAllSystemMailboxes: Failed in AD operation for database '{0}'. Error='{1}'", new object[]
                {
                    databaseGuid.ToString(),
                    ex
                });
                UmGlobals.ExEvent.LogEvent(UMEventLogConstants.Tuple_GrammarGenerationCouldntFindSystemMailbox, null, new object[]
                {
                    databaseGuid.ToString(),
                    CommonUtil.ToEventLogString(ex)
                });
            }
            return(systemMailboxes);
        }
 // Token: 0x06001163 RID: 4451 RVA: 0x00065DDC File Offset: 0x00063FDC
 private static void InitializeInstalledRecognizers()
 {
     if (SpeechRecognizerInfo.installedSpeechRecognizers == null)
     {
         lock (SpeechRecognizerInfo.staticLock)
         {
             if (SpeechRecognizerInfo.installedSpeechRecognizers == null)
             {
                 ICollection <RecognizerInfo> collection = SpeechRecognitionEngine.InstalledRecognizers();
                 SpeechRecognizerInfo.installedSpeechRecognizers = new Dictionary <CultureInfo, string>(collection.Count);
                 foreach (RecognizerInfo recognizerInfo in collection)
                 {
                     if (recognizerInfo.AdditionalInfo.Keys.Contains("Telephony") && !recognizerInfo.AdditionalInfo.Keys.Contains("Transcription"))
                     {
                         UMTracer.DebugTrace("SpeechRecognizerInfo - Adding recognizer culture='{0}', id='{1}'", new object[]
                         {
                             recognizerInfo.Culture,
                             recognizerInfo.Id
                         });
                         SpeechRecognizerInfo.installedSpeechRecognizers.Add(recognizerInfo.Culture, recognizerInfo.Id);
                     }
                 }
             }
         }
     }
 }
        // Token: 0x0600110C RID: 4364 RVA: 0x00063308 File Offset: 0x00061508
        public int GetGrammarCultureCount()
        {
            UMTracer.DebugTrace("UMGrammarTenantCache.GetGrammarCultureCount", new object[0]);
            int count;

            lock (this.instanceLock)
            {
                count = this.syncGrammarCultures.Count;
            }
            return(count);
        }
 // Token: 0x0600110B RID: 4363 RVA: 0x000632A0 File Offset: 0x000614A0
 public CultureInfo[] GetGrammarCultures()
 {
     UMTracer.DebugTrace("UMGrammarTenantCache.GetGrammarCultures", new object[0]);
     CultureInfo[] array;
     lock (this.instanceLock)
     {
         array = new CultureInfo[this.syncGrammarCultures.Count];
         this.syncGrammarCultures.CopyTo(array);
     }
     return(array);
 }
Exemple #5
0
        // Token: 0x06001113 RID: 4371 RVA: 0x000635C4 File Offset: 0x000617C4
        protected override Dictionary <Guid, OrganizationId> GetTenantsNeedingGrammars(List <ADUser> systemMailboxes)
        {
            UMTracer.DebugTrace("DatacenterUMGrammarTenantCache.GetTenantsNeedingGrammars", new object[0]);
            Dictionary <Guid, OrganizationId> dictionary = new Dictionary <Guid, OrganizationId>();

            foreach (ADUser aduser in systemMailboxes)
            {
                if (aduser.OrganizationId != null && aduser.OrganizationId.ConfigurationUnit != null && aduser.OrganizationId.OrganizationalUnit != null)
                {
                    if (SharedConfiguration.IsSharedConfiguration(aduser.OrganizationId))
                    {
                        UMTracer.DebugTrace("Skipping Mbox='{0}', Organization='{1}' because it is a shared configuration", new object[]
                        {
                            aduser.ExchangeGuid,
                            aduser.OrganizationId
                        });
                    }
                    else
                    {
                        IADRecipientLookup iadrecipientLookup = ADRecipientLookupFactory.CreateFromOrganizationId(aduser.OrganizationId, null);
                        if (iadrecipientLookup.TenantSizeExceedsThreshold(GrammarRecipientHelper.GetUserFilter(), 10))
                        {
                            if (!dictionary.ContainsKey(aduser.ExchangeGuid))
                            {
                                UMTracer.DebugTrace("Adding Mbox='{0}', Organization='{1}'", new object[]
                                {
                                    aduser.ExchangeGuid,
                                    aduser.OrganizationId
                                });
                                dictionary.Add(aduser.ExchangeGuid, aduser.OrganizationId);
                            }
                            else
                            {
                                UMTracer.DebugTrace("Skipping Mbox='{0}', Organization='{1}' because Mbox is already included. ", new object[]
                                {
                                    aduser.ExchangeGuid,
                                    aduser.OrganizationId
                                });
                            }
                        }
                        else
                        {
                            UMTracer.DebugTrace("Skipping Mbox='{0}', Organization='{1}' because it does not exceed size threshold", new object[]
                            {
                                aduser.ExchangeGuid,
                                aduser.OrganizationId
                            });
                        }
                    }
                }
            }
            return(dictionary);
        }
Exemple #6
0
        // Token: 0x06001120 RID: 4384 RVA: 0x00063964 File Offset: 0x00061B64
        private HashSet <CultureInfo> GetInstalledUMLanguages()
        {
            UMTracer.DebugTrace("EnterpriseUMGrammarTenantCache.GetInstalledUMLanguages", new object[0]);
            HashSet <CultureInfo> hashSet = new HashSet <CultureInfo>();

            foreach (UMLanguage umlanguage in Utils.ComputeUnionOfUmServerLanguages())
            {
                UMTracer.DebugTrace("Adding culture='{0}'", new object[]
                {
                    umlanguage.Culture
                });
                hashSet.Add(umlanguage.Culture);
            }
            return(hashSet);
        }
Exemple #7
0
        // Token: 0x06001115 RID: 4373 RVA: 0x00063784 File Offset: 0x00061984
        private HashSet <CultureInfo> GetUmServerLanguages()
        {
            UMTracer.DebugTrace("DatacenterUMGrammarTenantCache.GetUmServerLanguages", new object[0]);
            HashSet <CultureInfo> hashSet = new HashSet <CultureInfo>();

            foreach (UMLanguage umlanguage in UMLanguage.Datacenterlanguages)
            {
                UMTracer.DebugTrace("Adding culture='{0}'", new object[]
                {
                    umlanguage.Culture
                });
                hashSet.Add(umlanguage.Culture);
            }
            return(hashSet);
        }
        // Token: 0x0600110E RID: 4366 RVA: 0x00063430 File Offset: 0x00061630
        public void Update(Guid databaseGuid)
        {
            UMTracer.DebugTrace("UMGrammarTenantCache.Update for database {0}", new object[]
            {
                databaseGuid
            });
            List <ADUser> allSystemMailboxes = this.GetAllSystemMailboxes(databaseGuid);
            Dictionary <Guid, OrganizationId> tenantsNeedingGrammars = this.GetTenantsNeedingGrammars(allSystemMailboxes);
            HashSet <CultureInfo>             hashSet = this.InternalGetGrammarCultures();

            lock (this.instanceLock)
            {
                this.syncTenantsNeedingGrammars[databaseGuid] = tenantsNeedingGrammars;
                this.syncGrammarCultures = hashSet;
            }
        }
Exemple #9
0
        // Token: 0x0600111E RID: 4382 RVA: 0x00063880 File Offset: 0x00061A80
        protected override Dictionary <Guid, OrganizationId> GetTenantsNeedingGrammars(List <ADUser> systemMailboxes)
        {
            UMTracer.DebugTrace("EnterpriseUMGrammarTenantCache.GetTenantsNeedingGrammars", new object[0]);
            ExAssert.RetailAssert(systemMailboxes.Count <= 1, "For an Enterprise, there should be no more than one arbitration mailbox for speech grammar generation. Current count={0}", new object[]
            {
                systemMailboxes.Count
            });
            Dictionary <Guid, OrganizationId> dictionary = new Dictionary <Guid, OrganizationId>();

            foreach (ADUser aduser in systemMailboxes)
            {
                UMTracer.DebugTrace("Adding Mbox='{0}', Organization='{1}'", new object[]
                {
                    aduser.ExchangeGuid,
                    aduser.OrganizationId
                });
                dictionary.Add(aduser.ExchangeGuid, aduser.OrganizationId);
            }
            return(dictionary);
        }
        // Token: 0x0600110D RID: 4365 RVA: 0x00063360 File Offset: 0x00061560
        public List <DirectoryProcessorMailboxData> GetMailboxesNeedingGrammars(Guid databaseGuid)
        {
            UMTracer.DebugTrace("UMGrammarTenantCache.GetMailboxesNeedingGrammars for database {0}", new object[]
            {
                databaseGuid
            });
            List <DirectoryProcessorMailboxData> list = new List <DirectoryProcessorMailboxData>(10);

            lock (this.instanceLock)
            {
                if (this.syncTenantsNeedingGrammars.ContainsKey(databaseGuid))
                {
                    Dictionary <Guid, OrganizationId> dictionary = this.syncTenantsNeedingGrammars[databaseGuid];
                    foreach (KeyValuePair <Guid, OrganizationId> keyValuePair in dictionary)
                    {
                        list.Add(new DirectoryProcessorMailboxData(keyValuePair.Value, databaseGuid, keyValuePair.Key));
                    }
                }
            }
            return(list);
        }
        // Token: 0x06001162 RID: 4450 RVA: 0x00065D28 File Offset: 0x00063F28
        public static IList <string> GetNormalizedForms(SpeechRecognitionEngine engine, string word)
        {
            UMTracer.DebugTrace("Entering SpeechRecognizerInfo.GetNormalizedForms - word='{0}'", new object[]
            {
                word
            });
            FaultInjectionUtils.FaultInjectException(2502307133U);
            NormalizedResult normalizedResult = engine.NormalizerCollection.Normalize(word);
            ReadOnlyCollection <NormalizedResultAlternate> alternates = normalizedResult.GetAlternates();
            List <string> list = new List <string>(5);

            foreach (NormalizedResultAlternate normalizedResultAlternate in alternates)
            {
                UMTracer.DebugTrace("SpeechRecognizerInfo.GetNormalizedForms - word='{0}', alternate='{1}'", new object[]
                {
                    word,
                    normalizedResultAlternate.NormalizedString
                });
                list.Add(normalizedResultAlternate.NormalizedString);
            }
            return(list);
        }
        // Token: 0x06001160 RID: 4448 RVA: 0x00065CAC File Offset: 0x00063EAC
        public static string GetRecognizerId(CultureInfo culture)
        {
            ValidateArgument.NotNull(culture, "culture");
            UMTracer.DebugTrace("Entering SpeechRecognizerInfo.GetRecognizerId - Culture='{0}'", new object[]
            {
                culture
            });
            string result;

            try
            {
                result = SpeechRecognizerInfo.installedSpeechRecognizers[culture];
            }
            catch (KeyNotFoundException)
            {
                UMTracer.DebugTrace("SpeechRecognizerInfo.GetRecognizerId - Culture='{0}' was not found", new object[]
                {
                    culture
                });
                result = null;
            }
            return(result);
        }
Exemple #13
0
 // Token: 0x0600111F RID: 4383 RVA: 0x0006394C File Offset: 0x00061B4C
 protected override HashSet <CultureInfo> InternalGetGrammarCultures()
 {
     UMTracer.DebugTrace("EnterpriseUMGrammarTenantCache.InternalGetGrammarCultures", new object[0]);
     return(this.GetInstalledUMLanguages());
 }
        // Token: 0x06001159 RID: 4441 RVA: 0x00065A68 File Offset: 0x00063C68
        public static List <string> GetNormalizedNames(List <string> inputNames, NameNormalizer nameNormalizer, RecipientType recipientType, GrammarGenerationLog generationLog)
        {
            UMTracer.DebugTrace("NormalizationHelper.GetNormalizedNames", new object[0]);
            List <string> list = new List <string>();
            int           i    = 0;

            while (i < inputNames.Count)
            {
                string text = inputNames[i];
                UMTracer.DebugTrace("NormalizationHelper.GetNormalizedName inputName='{0}', recipientType={1}", new object[]
                {
                    text,
                    recipientType
                });
                string input = GrammarRecipientHelper.CharacterMapReplaceString(text);
                Dictionary <string, bool> dictionary = GrammarRecipientHelper.ApplyExclusionList(input, recipientType);
                if (dictionary.Count != 0)
                {
                    using (Dictionary <string, bool> .KeyCollection.Enumerator enumerator = dictionary.Keys.GetEnumerator())
                    {
                        while (enumerator.MoveNext())
                        {
                            string text2 = enumerator.Current;
                            if (!string.IsNullOrEmpty(text2) && NormalizationHelper.IsGrammarEntryFormatValid(text2))
                            {
                                bool   flag  = false;
                                string text3 = SpeechUtils.SrgsEncode(text2);
                                if (dictionary[text2])
                                {
                                    if (nameNormalizer.IsNameAcceptable(text3))
                                    {
                                        flag = true;
                                    }
                                    else
                                    {
                                        generationLog.WriteLine(Strings.NormalizationFailedError(text));
                                    }
                                }
                                else
                                {
                                    flag = true;
                                }
                                if (flag && !string.IsNullOrEmpty(text3))
                                {
                                    UMTracer.DebugTrace("Adding name '{0}'", new object[]
                                    {
                                        text3
                                    });
                                    list.Add(text3);
                                }
                            }
                        }
                        goto IL_12D;
                    }
                    goto IL_11C;
                }
                goto IL_11C;
IL_12D:
                i++;
                continue;
IL_11C:
                generationLog.WriteLine(Strings.EntryExcludedFromGrammar(text));
                goto IL_12D;
            }
            if (list.Count != 0)
            {
                return(list);
            }
            return(null);
        }
 // Token: 0x0600115D RID: 4445 RVA: 0x00065C1F File Offset: 0x00063E1F
 protected override HashSet <CultureInfo> InternalGetGrammarCultures()
 {
     UMTracer.DebugTrace("PartnerHostedUMGrammarTenantCache.InternalGetGrammarCultures", new object[0]);
     return(new HashSet <CultureInfo>());
 }
 // Token: 0x0600115C RID: 4444 RVA: 0x00065C08 File Offset: 0x00063E08
 protected override Dictionary <Guid, OrganizationId> GetTenantsNeedingGrammars(List <ADUser> systemMailboxes)
 {
     UMTracer.DebugTrace("PartnerHostedUMGrammarTenantCache.GetTenantsNeedingGrammars", new object[0]);
     return(new Dictionary <Guid, OrganizationId>());
 }
Exemple #17
0
 // Token: 0x06001114 RID: 4372 RVA: 0x0006376C File Offset: 0x0006196C
 protected override HashSet <CultureInfo> InternalGetGrammarCultures()
 {
     UMTracer.DebugTrace("DatacenterUMGrammarTenantCache.InternalGetGrammarCultures", new object[0]);
     return(this.GetUmServerLanguages());
 }