Ejemplo 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);
        }
Ejemplo n.º 2
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);
        }
Ejemplo n.º 3
0
        // Token: 0x0600100A RID: 4106 RVA: 0x0005DCD0 File Offset: 0x0005BED0
        private void WriteADEntry(XmlWriter entryWriter, ADRawEntry entry)
        {
            base.Logger.TraceDebug(this, "Entering ADCrawler.WriteADEntry", new object[0]);
            object[]             properties           = entry.GetProperties(GrammarRecipientHelper.LookupProperties);
            RecipientTypeDetails recipientTypeDetails = (RecipientTypeDetails)properties[5];
            bool flag = this.ShouldAcceptADEntry(recipientTypeDetails);

            if (flag)
            {
                entryWriter.WriteStartElement("ADEntry");
                int i = 0;
                while (i < properties.Length)
                {
                    string text = string.Empty;
                    if (properties[i] == null)
                    {
                        base.Logger.TraceDebug(this, "ADEntry - Property='{0}', Value is null", new object[]
                        {
                            GrammarRecipientHelper.LookupProperties[i].Name
                        });
                        goto IL_22D;
                    }
                    if (GrammarRecipientHelper.LookupProperties[i] == ADRecipientSchema.UMRecipientDialPlanId)
                    {
                        ADObjectId adobjectId = properties[i] as ADObjectId;
                        text = adobjectId.ObjectGuid.ToString();
                        goto IL_22D;
                    }
                    if (GrammarRecipientHelper.LookupProperties[i] == ADRecipientSchema.AddressListMembership)
                    {
                        ADMultiValuedProperty <ADObjectId> admultiValuedProperty = properties[i] as ADMultiValuedProperty <ADObjectId>;
                        List <string> list = new List <string>(admultiValuedProperty.Count);
                        foreach (ADObjectId adobjectId2 in admultiValuedProperty)
                        {
                            list.Add(adobjectId2.ObjectGuid.ToString());
                        }
                        text = string.Join(",", list.ToArray());
                        goto IL_22D;
                    }
                    if (GrammarRecipientHelper.LookupProperties[i] == ADRecipientSchema.DisplayName || GrammarRecipientHelper.LookupProperties[i] == ADRecipientSchema.PhoneticDisplayName || GrammarRecipientHelper.LookupProperties[i] == ADObjectSchema.DistinguishedName)
                    {
                        text = GrammarRecipientHelper.GetSanitizedDisplayNameForXMLEntry(properties[i].ToString());
                        goto IL_22D;
                    }
                    if (GrammarRecipientHelper.LookupProperties[i] == ADRecipientSchema.PrimarySmtpAddress || GrammarRecipientHelper.LookupProperties[i] == ADObjectSchema.Guid || GrammarRecipientHelper.LookupProperties[i] == ADRecipientSchema.RecipientType || GrammarRecipientHelper.LookupProperties[i] == ADObjectSchema.WhenChangedUTC)
                    {
                        text = properties[i].ToString();
                        goto IL_22D;
                    }
                    if (GrammarRecipientHelper.LookupProperties[i] != ADRecipientSchema.RecipientTypeDetails)
                    {
                        ExAssert.RetailAssert(false, "Invalid lookup property '{0}'", new object[]
                        {
                            GrammarRecipientHelper.LookupProperties[i].Name
                        });
                        goto IL_22D;
                    }
                    base.Logger.TraceDebug(this, "Skipping property='{0}'", new object[]
                    {
                        GrammarRecipientHelper.LookupProperties[i].Name
                    });
IL_27E:
                    i++;
                    continue;
IL_22D:
                    base.Logger.TraceDebug(this, "ADEntry -  Property='{0}', Value='{1}'", new object[]
                    {
                        GrammarRecipientHelper.LookupProperties[i].Name,
                        text
                    });
                    entryWriter.WriteStartAttribute(GrammarRecipientHelper.LookupProperties[i].Name);
                    entryWriter.WriteString(text);
                    entryWriter.WriteEndAttribute();
                    goto IL_27E;
                }
                entryWriter.WriteEndElement();
            }
        }
        // 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);
        }