private void SetMultiValuedProperty <T, V>(MultiValuedProperty <T> inputValues, MultiValuedProperty <V> existingValues, SetOrganizationConfig.Resolver <T, V> resolver)
        {
            if (inputValues == null)
            {
                existingValues.Clear();
                return;
            }
            if (!inputValues.IsChangesOnlyCopy)
            {
                existingValues.Clear();
                using (IEnumerator <V> enumerator = resolver(inputValues).Distinct <V>().GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        V item = enumerator.Current;
                        existingValues.Add(item);
                    }
                    return;
                }
            }
            HashSet <V>     first   = new HashSet <V>(existingValues);
            IEnumerable <V> second  = resolver(inputValues.Added.Cast <T>());
            IEnumerable <V> second2 = resolver(inputValues.Removed.Cast <T>());

            existingValues.Clear();
            foreach (V item2 in first.Union(second).Except(second2))
            {
                existingValues.Add(item2);
            }
        }
        public override void WriteCookie(byte[] cookie, DateTime timestamp)
        {
            if (cookie == null || cookie.Length == 0)
            {
                throw new ArgumentException("cookie is empty");
            }
            MsoTenantCookieContainer msoTenantCookieContainer = this.configSession.GetMsoTenantCookieContainer(base.ContextId);

            if (msoTenantCookieContainer != null)
            {
                int cookieVersion = (base.LastCookie != null) ? base.LastCookie.Version : 1;
                MsoFullSyncCookie msoFullSyncCookie = new MsoFullSyncCookie(cookie, cookieVersion);
                msoFullSyncCookie.Timestamp = timestamp;
                if (base.LastCookie != null)
                {
                    msoFullSyncCookie.SyncType          = base.LastCookie.SyncType;
                    msoFullSyncCookie.SyncRequestor     = base.LastCookie.SyncRequestor;
                    msoFullSyncCookie.WhenSyncRequested = base.LastCookie.WhenSyncRequested;
                    msoFullSyncCookie.WhenSyncStarted   = ((base.LastCookie.WhenSyncStarted != DateTime.MinValue) ? base.LastCookie.WhenSyncStarted : timestamp);
                }
                byte[] item = msoFullSyncCookie.ToStorageCookie();
                MultiValuedProperty <byte[]> multiValuedProperty = this.RetrievePersistedPageTokens(msoTenantCookieContainer);
                multiValuedProperty.Clear();
                multiValuedProperty.Add(item);
                this.configSession.Save(msoTenantCookieContainer);
                this.LogPersistPageTokenEvent();
            }
        }
        // Token: 0x06001D58 RID: 7512 RVA: 0x0007A36C File Offset: 0x0007856C
        internal static bool StampE2003FilterMetadata(IPropertyBag propertyBag, string ldapRecipientFilter, ADPropertyDefinition purportedSearchUIDefinition)
        {
            MultiValuedProperty <string> multiValuedProperty = (MultiValuedProperty <string>)propertyBag[purportedSearchUIDefinition];
            bool flag;

            if (string.IsNullOrEmpty(ldapRecipientFilter))
            {
                flag = (0 != multiValuedProperty.Count);
                if (flag)
                {
                    multiValuedProperty.Clear();
                }
            }
            else
            {
                string[] array = new string[]
                {
                    "CommonQuery_Handler=5EE6238AC231D011891C00A024AB2DBB",
                    "CommonQuery_Form=E33FEE83D957D011B93200A024AB2DBB",
                    "DsQuery_ViewMode=4868",
                    "DsQuery_EnableFilter=0",
                    "Microsoft.PropertyWell_Items=0",
                    "Microsoft.PropertyWell_QueryString=" + ldapRecipientFilter
                };
                flag = (multiValuedProperty.Count != array.Length);
                if (!flag)
                {
                    foreach (string item in array)
                    {
                        if (!multiValuedProperty.Contains(item))
                        {
                            flag = true;
                            break;
                        }
                    }
                }
                if (flag)
                {
                    multiValuedProperty.Clear();
                    foreach (string item2 in array)
                    {
                        multiValuedProperty.Add(item2);
                    }
                }
            }
            return(flag);
        }
Пример #4
0
        internal void UpdateRawMapiAttributes(bool movingToPreE14Server)
        {
            MultiValuedProperty <OfflineAddressBookMapiProperty> multiValuedProperty  = (MultiValuedProperty <OfflineAddressBookMapiProperty>) this.propertyBag[OfflineAddressBookSchema.ConfiguredAttributes];
            MultiValuedProperty <OfflineAddressBookMapiProperty> multiValuedProperty2 = new MultiValuedProperty <OfflineAddressBookMapiProperty>();

            foreach (OfflineAddressBookMapiProperty offlineAddressBookMapiProperty in multiValuedProperty)
            {
                offlineAddressBookMapiProperty.ResolveMapiPropTag();
                if (multiValuedProperty2.Contains(offlineAddressBookMapiProperty))
                {
                    throw new ArgumentException(DirectoryStrings.ErrorDuplicateMapiIdsInConfiguredAttributes);
                }
                multiValuedProperty2.Add(offlineAddressBookMapiProperty);
            }
            MultiValuedProperty <int> multiValuedProperty3 = new MultiValuedProperty <int>();
            MultiValuedProperty <int> multiValuedProperty4 = new MultiValuedProperty <int>();
            MultiValuedProperty <int> multiValuedProperty5 = new MultiValuedProperty <int>();

            foreach (OfflineAddressBookMapiProperty offlineAddressBookMapiProperty2 in multiValuedProperty2)
            {
                switch (offlineAddressBookMapiProperty2.Type)
                {
                case OfflineAddressBookMapiPropertyOption.ANR:
                    multiValuedProperty3.Add((int)offlineAddressBookMapiProperty2.PropertyTag);
                    break;

                case OfflineAddressBookMapiPropertyOption.Value:
                    multiValuedProperty4.Add((int)offlineAddressBookMapiProperty2.PropertyTag);
                    break;

                case OfflineAddressBookMapiPropertyOption.Indicator:
                    multiValuedProperty5.Add((int)offlineAddressBookMapiProperty2.PropertyTag);
                    break;
                }
            }
            if (multiValuedProperty3.Count == 0 && !movingToPreE14Server)
            {
                multiValuedProperty3.Add(0);
            }
            if (multiValuedProperty4.Count == 0 && !movingToPreE14Server)
            {
                multiValuedProperty4.Add(0);
            }
            if (multiValuedProperty5.Count == 0 && !movingToPreE14Server)
            {
                multiValuedProperty5.Add(0);
            }
            this.propertyBag[OfflineAddressBookSchema.ANRProperties]       = multiValuedProperty3;
            this.propertyBag[OfflineAddressBookSchema.DetailsProperties]   = multiValuedProperty4;
            this.propertyBag[OfflineAddressBookSchema.TruncatedProperties] = multiValuedProperty5;
            if (multiValuedProperty.IsReadOnly)
            {
                this.propertyBag.SetField(OfflineAddressBookSchema.ConfiguredAttributes, new MultiValuedProperty <OfflineAddressBookMapiProperty>());
                return;
            }
            multiValuedProperty.Clear();
            multiValuedProperty.ResetChangeTracking();
        }
Пример #5
0
        private static void AuthSchemeSetter(object value, IPropertyBag propertyBag)
        {
            MultiValuedProperty <string> multiValuedProperty = (MultiValuedProperty <string>)propertyBag[AuthRedirectSchema.Keywords];

            multiValuedProperty.Clear();
            string item = value.ToString();

            multiValuedProperty.Add(AuthRedirect.AuthRedirectKeywords);
            multiValuedProperty.Add(item);
        }
        // Token: 0x06001D52 RID: 7506 RVA: 0x0007A160 File Offset: 0x00078360
        internal static void SetRecipientFilterType(WellKnownRecipientFilterType type, IPropertyBag propertyBag, ADPropertyDefinition filterMeatadata)
        {
            if (WellKnownRecipientFilterType.Custom == type)
            {
                MultiValuedProperty <string> multiValuedProperty = (MultiValuedProperty <string>)propertyBag[filterMeatadata];
                if (0 < multiValuedProperty.Count)
                {
                    multiValuedProperty.Clear();
                }
            }
            int num = (int)type;

            RecipientFilterHelper.InternalStringValuesSetter(new MultiValuedProperty <string>(num.ToString()), propertyBag, filterMeatadata, "Microsoft.Exchange12.8f91d340bc0c47e4b4058a479602f94c:RecipientFilterType=");
        }
        public override void ClearCookie()
        {
            MsoTenantCookieContainer msoTenantCookieContainer = this.configSession.GetMsoTenantCookieContainer(base.ContextId);

            if (msoTenantCookieContainer != null)
            {
                MultiValuedProperty <byte[]> multiValuedProperty = this.RetrievePersistedPageTokens(msoTenantCookieContainer);
                multiValuedProperty.Clear();
                if (multiValuedProperty.Changed)
                {
                    this.configSession.Save(msoTenantCookieContainer);
                }
                this.LogClearPageTokenEvent();
            }
        }
 internal static void ValidateAddedSharepointBinding(IEnumerable <string> addedBindings, IEnumerable <string> removedBindings, MultiValuedProperty <BindingMetadata> psObjectBindings, string subWorkloadName)
 {
     if (addedBindings.Any <string>())
     {
         addedBindings = NewCompliancePolicyBase.ValidateWideScopeBinding(addedBindings, "All", "All", new BindingCannotCombineAllWithIndividualBindingsException(subWorkloadName));
         if (NewCompliancePolicyBase.IsBindingEnabled(addedBindings, "All"))
         {
             psObjectBindings.Clear();
             return;
         }
         List <string> bindings = (from b in psObjectBindings
                                   select b.ImmutableIdentity).ToList <string>();
         if (NewCompliancePolicyBase.IsBindingEnabled(bindings, "All") && !NewCompliancePolicyBase.IsBindingEnabled(removedBindings, "All"))
         {
             throw new BindingCannotCombineAllWithIndividualBindingsException(subWorkloadName);
         }
     }
 }
Пример #9
0
 internal static void MergeBindings(MultiValuedProperty <BindingMetadata> bindings, MultiValuedProperty <BindingMetadata> addedBindings, MultiValuedProperty <BindingMetadata> removedBindings, bool forceClear)
 {
     ArgumentValidator.ThrowIfNull("bindings", bindings);
     ArgumentValidator.ThrowIfNull("addedBindings", addedBindings);
     ArgumentValidator.ThrowIfNull("removedBindings", removedBindings);
     if (forceClear && bindings.Any <BindingMetadata>())
     {
         bindings.Clear();
         return;
     }
     using (MultiValuedProperty <BindingMetadata> .Enumerator enumerator = removedBindings.GetEnumerator())
     {
         while (enumerator.MoveNext())
         {
             BindingMetadata item            = enumerator.Current;
             BindingMetadata bindingMetadata = bindings.FirstOrDefault((BindingMetadata p) => p.ImmutableIdentity == item.ImmutableIdentity);
             if (bindingMetadata != null)
             {
                 bindings.Remove(bindingMetadata);
             }
         }
     }
     using (MultiValuedProperty <BindingMetadata> .Enumerator enumerator2 = addedBindings.GetEnumerator())
     {
         while (enumerator2.MoveNext())
         {
             BindingMetadata item             = enumerator2.Current;
             BindingMetadata bindingMetadata2 = bindings.FirstOrDefault((BindingMetadata p) => p.ImmutableIdentity == item.ImmutableIdentity);
             if (bindingMetadata2 == null)
             {
                 bindings.Add(item);
             }
             else if (!string.Equals(bindingMetadata2.DisplayName, item.DisplayName, StringComparison.InvariantCulture) || !string.Equals(bindingMetadata2.Name, item.Name, StringComparison.InvariantCultureIgnoreCase))
             {
                 int index = bindings.IndexOf(bindingMetadata2);
                 bindings[index] = item;
             }
         }
     }
 }