Ejemplo n.º 1
0
        // Token: 0x060050C8 RID: 20680 RVA: 0x0012BB10 File Offset: 0x00129D10
        internal static object[] MarshalObject(PropertyDefinition[] propDefs, ADRawEntry recipient)
        {
            ArrayList arrayList = new ArrayList();
            int       i         = 0;

            while (i < propDefs.Length)
            {
                object obj = null;
                ADPropertyDefinition adpropertyDefinition = (ADPropertyDefinition)propDefs[i];
                if (adpropertyDefinition.GetterDelegate == null)
                {
                    if (recipient.propertyBag.TryGetField(adpropertyDefinition, ref obj))
                    {
                        goto IL_3F;
                    }
                }
                else
                {
                    obj = recipient.propertyBag[adpropertyDefinition];
                    if (obj != null)
                    {
                        goto IL_3F;
                    }
                }
IL_55:
                i++;
                continue;
IL_3F:
                object obj2 = RUSMarshal.MarshalAttribute(adpropertyDefinition, obj);
                if (obj2 != null)
                {
                    arrayList.Add(obj2);
                    goto IL_55;
                }
                goto IL_55;
            }
            object[] array = new object[arrayList.Count];
            arrayList.CopyTo(array);
            return(array);
        }
Ejemplo n.º 2
0
        // Token: 0x060050C9 RID: 20681 RVA: 0x0012BB94 File Offset: 0x00129D94
        internal static ADRecipient UnMarshalObject(object rusResult, ADObject originalRecipient)
        {
            if (rusResult == null || !(rusResult is object[]))
            {
                return(null);
            }
            SortedList sortedList = new SortedList(new CaseInsensitiveComparer(CultureInfo.InvariantCulture));

            foreach (object[] array2 in (object[])rusResult)
            {
                string[] array3 = new string[array2.Length - 1];
                Array.Copy(array2, 1, array3, 0, array2.Length - 1);
                sortedList.Add(array2[0], array3);
            }
            string[] array4 = new string[sortedList.Count];
            sortedList.Keys.CopyTo(array4, 0);
            ADRecipient adrecipient          = new ADRecipient();
            List <ADPropertyDefinition> list = new List <ADPropertyDefinition>((ADPropertyDefinition[])RUSMarshal.LdapAttributesToPropertyDefinitions(RUSMarshal.SchemaInstance, array4));
            List <object> list2 = new List <object>(list.Count);

            for (int j = 0; j < list.Count; j++)
            {
                list2.Add(RUSMarshal.UnMarshalAttribute(list[j], (object[])sortedList[list[j].LdapDisplayName]));
            }
            int k = list.Count - 1;

            while (k >= 0)
            {
                if (list[k] != ADRecipientSchema.WindowsEmailAddress)
                {
                    goto IL_171;
                }
                SmtpAddress smtpAddress = (SmtpAddress)list2[k];
                if (((SmtpAddress)list2[k]).Length <= 256)
                {
                    goto IL_171;
                }
                list.RemoveAt(k);
                list2.RemoveAt(k);
                ExTraceGlobals.RecipientUpdateServiceTracer.TraceDebug <string>((long)adrecipient.GetHashCode(), "RecipientUpdateService:: A Windows Email Address exceeding 256 characters for recipient \"{0}\" is generated and discarded", adrecipient.ToString());
IL_286:
                k--;
                continue;
IL_171:
                if (!list[k].IsMultivalued)
                {
                    goto IL_286;
                }
                int  num  = (list2[k] == null) ? 0 : ((MultiValuedPropertyBase)list2[k]).Count;
                int  num2 = (originalRecipient[list[k]] == null) ? 0 : ((MultiValuedPropertyBase)originalRecipient[list[k]]).Count;
                bool flag = num != num2;
                if (!flag && num != 0)
                {
                    object[] array5 = (object[])RUSMarshal.MarshalAttribute(list[k], list2[k]);
                    object[] array6 = (object[])RUSMarshal.MarshalAttribute(list[k], originalRecipient[list[k]]);
                    for (int l = 1; l < array6.Length; l++)
                    {
                        if (-1 == Array.IndexOf <object>(array5, array6[l]))
                        {
                            flag = true;
                            break;
                        }
                    }
                }
                if (!flag)
                {
                    list.RemoveAt(k);
                    list2.RemoveAt(k);
                    ExTraceGlobals.RecipientUpdateServiceTracer.TraceDebug <string>((long)adrecipient.GetHashCode(), "RecipientUpdateService:: the value of 'msExchPoliciesIncluded' property of recipient \"{0}\" does NOT change at all.", adrecipient.ToString());
                    goto IL_286;
                }
                goto IL_286;
            }
            adrecipient.SetProperties(list.ToArray(), list2.ToArray());
            return(adrecipient);
        }