示例#1
0
 public int Compare(RoleEntryInfo a, RoleEntryInfo b)
 {
     return(RoleEntry.CompareRoleEntriesByName(a.RoleEntry, b.RoleEntry));
 }
示例#2
0
        internal void ApplyChangesToDownlevelData(ExchangeRole parentRole)
        {
            if (parentRole == null)
            {
                throw new ArgumentNullException("parentRole");
            }
            if (!this.HasDownlevelData)
            {
                return;
            }
            MultiValuedProperty <RoleEntry> multiValuedProperty = (MultiValuedProperty <RoleEntry>) this[ExchangeRoleSchema.InternalDownlevelRoleEntries];

            object[] removed = this.RoleEntries.Removed;
            for (int i = 0; i < removed.Length; i++)
            {
                RoleEntry roleEntry            = (RoleEntry)removed[i];
                RoleEntry downlevelEntryToFind = roleEntry.MapToPreviousVersion();
                RoleEntry roleEntry2           = multiValuedProperty.Find((RoleEntry dre) => 0 == RoleEntry.CompareRoleEntriesByName(dre, downlevelEntryToFind));
                if (roleEntry2 != null)
                {
                    multiValuedProperty.Remove(roleEntry2);
                }
            }
            object[] added = this.RoleEntries.Added;
            for (int j = 0; j < added.Length; j++)
            {
                RoleEntry roleEntry3           = (RoleEntry)added[j];
                RoleEntry downlevelEntryToFind = roleEntry3.MapToPreviousVersion();
                MultiValuedProperty <RoleEntry> multiValuedProperty2 = (MultiValuedProperty <RoleEntry>)parentRole[ExchangeRoleSchema.InternalDownlevelRoleEntries];
                RoleEntry roleEntry4 = multiValuedProperty2.Find((RoleEntry dre) => 0 == RoleEntry.CompareRoleEntriesByName(dre, downlevelEntryToFind));
                if (!(roleEntry4 == null))
                {
                    List <string> list = new List <string>();
                    foreach (string newParameter in roleEntry3.Parameters)
                    {
                        string text = roleEntry3.MapParameterToPreviousVersion(newParameter);
                        if (roleEntry4.ContainsParameter(text))
                        {
                            list.Add(text);
                        }
                    }
                    RoleEntry item = downlevelEntryToFind.Clone(list);
                    multiValuedProperty.Add(item);
                }
            }
        }