Esempio n. 1
0
        internal static void MultiValuedStringKeySetter(object value, IPropertyBag propertyBag, ADPropertyDefinition rawProperty, int offset)
        {
            if (offset < 0 || offset > 2)
            {
                throw new ArgumentOutOfRangeException("offset");
            }
            MultiValuedProperty <string> multiValuedProperty = propertyBag[rawProperty] as MultiValuedProperty <string>;
            string text = value as string;

            if (multiValuedProperty.Count == 1 && !multiValuedProperty[0].StartsWith("0" + AuthConfigSchema.NameValueSeparator, StringComparison.OrdinalIgnoreCase))
            {
                multiValuedProperty[0] = "0" + AuthConfigSchema.NameValueSeparator + multiValuedProperty[0];
            }
            string text2 = offset.ToString("d1") + AuthConfigSchema.NameValueSeparator;
            int    num   = 0;

            while (num < multiValuedProperty.Count && (string.IsNullOrEmpty(multiValuedProperty[num]) || !multiValuedProperty[num].StartsWith(text2)))
            {
                num++;
            }
            if (num >= multiValuedProperty.Count)
            {
                if (!string.IsNullOrEmpty(text))
                {
                    multiValuedProperty.Add(text2 + text);
                    return;
                }
            }
            else
            {
                int i = num + 1;
                while (i < multiValuedProperty.Count)
                {
                    if (string.IsNullOrEmpty(multiValuedProperty[i]) || multiValuedProperty[i].StartsWith(text2))
                    {
                        multiValuedProperty.RemoveAt(i);
                    }
                    else
                    {
                        i++;
                    }
                }
                if (string.IsNullOrEmpty(text))
                {
                    multiValuedProperty.RemoveAt(num);
                    return;
                }
                multiValuedProperty[num] = text2 + text;
            }
        }
        // Token: 0x06001D48 RID: 7496 RVA: 0x00079EF8 File Offset: 0x000780F8
        private static void InternalStringValuesSetter(object value, IPropertyBag propertyBag, ADPropertyDefinition filterMeatadata, string filterPrefix)
        {
            MultiValuedProperty <string> multiValuedProperty = (MultiValuedProperty <string>)propertyBag[filterMeatadata];

            RecipientFilterHelper.ClearNonExchange12RecipientFilterMetadata(multiValuedProperty);
            int num = multiValuedProperty.Count - 1;

            while (0 <= num)
            {
                if (multiValuedProperty[num].StartsWith(filterPrefix, StringComparison.OrdinalIgnoreCase))
                {
                    multiValuedProperty.RemoveAt(num);
                }
                num--;
            }
            MultiValuedProperty <string> multiValuedProperty2 = (MultiValuedProperty <string>)value;

            if (multiValuedProperty2 != null && multiValuedProperty2.Count != 0)
            {
                foreach (string text in multiValuedProperty2)
                {
                    if (!string.IsNullOrEmpty(text))
                    {
                        multiValuedProperty.Add(filterPrefix + text);
                    }
                }
            }
        }
Esempio n. 3
0
        internal static void MultiValuedBytesKeySetter(object value, IPropertyBag propertyBag, ADPropertyDefinition rawProperty, int offset)
        {
            MultiValuedProperty <byte[]> multiValuedProperty = propertyBag[rawProperty] as MultiValuedProperty <byte[]>;
            string text = value as string;

            if (string.IsNullOrEmpty(text))
            {
                if (offset > multiValuedProperty.Count - 1)
                {
                    return;
                }
                if (offset == multiValuedProperty.Count - 1)
                {
                    multiValuedProperty.RemoveAt(offset);
                    return;
                }
            }
            while (multiValuedProperty.Count < offset + 1)
            {
                MultiValuedProperty <byte[]> multiValuedProperty2 = multiValuedProperty;
                byte[] item = new byte[1];
                multiValuedProperty2.Add(item);
            }
            if (!string.IsNullOrEmpty(text))
            {
                multiValuedProperty[offset] = Convert.FromBase64String(text);
                return;
            }
            MultiValuedProperty <byte[]> multiValuedProperty3 = multiValuedProperty;

            byte[] value2 = new byte[1];
            multiValuedProperty3[offset] = value2;
        }
Esempio n. 4
0
        private void RollbackCookies(MultiValuedProperty <byte[]> cookies, bool isCompanyStream)
        {
            DateTime?dateTime = null;

            for (int i = cookies.Count - 1; i >= 0; i--)
            {
                MsoMainStreamCookie msoMainStreamCookie = null;
                Exception           ex = null;
                if (MsoMainStreamCookie.TryFromStorageCookie(cookies[i], out msoMainStreamCookie, out ex) && string.Equals(this.ServiceInstanceId.ToString(), msoMainStreamCookie.ServiceInstanceName, StringComparison.OrdinalIgnoreCase))
                {
                    if (this.dateTimeNow < new DateTime(msoMainStreamCookie.TimeStamp.Ticks + this.rollbackTimeSpan.Ticks, DateTimeKind.Utc))
                    {
                        cookies.RemoveAt(i);
                        this.cookiesUpdated = true;
                    }
                    else if (dateTime == null || msoMainStreamCookie.TimeStamp > dateTime.Value)
                    {
                        dateTime = new DateTime?(msoMainStreamCookie.TimeStamp);
                    }
                }
            }
            if (dateTime != null)
            {
                this.RollBackDivergences(isCompanyStream, dateTime.Value);
            }
        }
        internal static void QuotaSettingSetter(ADPropertyDefinition adPropertyDefinition, object quota, IPropertyBag propertyBag)
        {
            if (adPropertyDefinition == null)
            {
                throw new ArgumentNullException("adPropertyDefinition");
            }
            MultiValuedProperty <string> multiValuedProperty = (MultiValuedProperty <string>)propertyBag[DataClassificationConfigSchema.DataClassificationConfigQuotaSettings];
            string text = adPropertyDefinition.Name + ':';

            if (multiValuedProperty != null && multiValuedProperty.Count != 0)
            {
                for (int i = multiValuedProperty.Count - 1; i >= 0; i--)
                {
                    if (string.IsNullOrEmpty(multiValuedProperty[i]) || multiValuedProperty[i].StartsWith(text, StringComparison.Ordinal))
                    {
                        multiValuedProperty.RemoveAt(i);
                    }
                }
            }
            if (!object.Equals(quota, adPropertyDefinition.DefaultValue))
            {
                string arg  = ValueConvertor.ConvertValueToString(quota, null);
                string item = string.Format("{0}{1}", text, arg);
                multiValuedProperty.Add(item);
            }
            propertyBag[DataClassificationConfigSchema.DataClassificationConfigQuotaSettings] = multiValuedProperty;
        }
Esempio n. 6
0
        public override void WriteCookie(byte[] cookie, IEnumerable <string> filteredContextIds, DateTime timestamp, bool isUpgradingCookie, ServerVersion version, bool more)
        {
            if (cookie == null || cookie.Length == 0)
            {
                throw new ArgumentNullException("cookie");
            }
            MsoMainStreamCookieContainer        msoMainStreamCookieContainer = this.cookieSession.GetMsoMainStreamCookieContainer(base.ServiceInstanceName);
            MultiValuedProperty <byte[]>        multiValuedProperty          = this.RetrievePersistedCookies(msoMainStreamCookieContainer);
            List <MsoMainStreamCookieWithIndex> list = new List <MsoMainStreamCookieWithIndex>();

            for (int i = multiValuedProperty.Count - 1; i >= 0; i--)
            {
                MsoMainStreamCookie msoMainStreamCookie = null;
                Exception           ex = null;
                if (MsoMainStreamCookie.TryFromStorageCookie(multiValuedProperty[i], out msoMainStreamCookie, out ex) && string.Equals(base.ServiceInstanceName, msoMainStreamCookie.ServiceInstanceName, StringComparison.OrdinalIgnoreCase))
                {
                    list.Add(new MsoMainStreamCookieWithIndex(msoMainStreamCookie, i));
                }
            }
            List <MsoMainStreamCookieWithIndex> list2 = this.SortMainStreamCookieList(list);

            if (list2.Count >= 2)
            {
                MsoMainStreamCookieWithIndex msoMainStreamCookieWithIndex  = list2[list2.Count - 1];
                MsoMainStreamCookieWithIndex msoMainStreamCookieWithIndex2 = list2[list2.Count - 2];
                if (msoMainStreamCookieWithIndex.Cookie.TimeStamp < new DateTime(msoMainStreamCookieWithIndex2.Cookie.TimeStamp.Ticks + this.cookieHistoryInterval.Ticks, DateTimeKind.Utc))
                {
                    multiValuedProperty.RemoveAt(msoMainStreamCookieWithIndex.Index);
                }
                else if (list2.Count >= this.maxCookieHistoryCount)
                {
                    multiValuedProperty.RemoveAt(list2[0].Index);
                }
            }
            base.UpdateSyncPropertySetVersion(isUpgradingCookie, version, more);
            MsoMainStreamCookie msoMainStreamCookie2 = new MsoMainStreamCookie(base.ServiceInstanceName, cookie, timestamp, base.SyncPropertySetVersion, base.IsSyncPropertySetUpgrading);

            multiValuedProperty.Add(msoMainStreamCookie2.ToStorageCookie());
            this.cookieSession.Save(msoMainStreamCookieContainer);
            this.LogPersistCookieEvent();
        }
        // Token: 0x06001D53 RID: 7507 RVA: 0x0007A1A8 File Offset: 0x000783A8
        private static void ClearNonExchange12RecipientFilterMetadata(MultiValuedProperty <string> purportedSearchUI)
        {
            int num = purportedSearchUI.Count - 1;

            while (0 <= num)
            {
                if (!purportedSearchUI[num].StartsWith("Microsoft.Exchange12.8f91d340bc0c47e4b4058a479602f94c:", StringComparison.OrdinalIgnoreCase))
                {
                    purportedSearchUI.RemoveAt(num);
                }
                num--;
            }
        }
Esempio n. 8
0
        private static void SetSettingsString(IPropertyBag propertyBag, string protocolName, int position, string value, int totalNumberOfFields)
        {
            MultiValuedProperty <string> multiValuedProperty = (MultiValuedProperty <string>)propertyBag[ADRecipientSchema.ProtocolSettings];

            string[] array = null;
            foreach (string text in multiValuedProperty)
            {
                if (text.StartsWith(protocolName, StringComparison.OrdinalIgnoreCase))
                {
                    multiValuedProperty.Remove(text);
                    array = text.Split(new char[]
                    {
                        '§'
                    });
                    break;
                }
            }
            for (int i = 0; i < multiValuedProperty.Count; i++)
            {
                if (multiValuedProperty[i].StartsWith(protocolName, StringComparison.OrdinalIgnoreCase))
                {
                    multiValuedProperty.RemoveAt(i);
                    i--;
                }
            }
            if (array == null)
            {
                array    = new string[totalNumberOfFields];
                array[0] = protocolName;
            }
            else if (array.Length < totalNumberOfFields)
            {
                Array.Resize <string>(ref array, totalNumberOfFields);
            }
            array[position] = value;
            StringBuilder stringBuilder = new StringBuilder();

            for (int j = 0; j < array.Length; j++)
            {
                if (j > 0)
                {
                    stringBuilder.Append('§');
                }
                if (!string.IsNullOrEmpty(array[j]))
                {
                    stringBuilder.Append(array[j]);
                }
            }
            multiValuedProperty.Add(stringBuilder.ToString());
        }