Esempio n. 1
0
        private void UpdateEntry(RecipientInfoCacheEntry newEntry, int oldEntryIndex)
        {
            RecipientInfoCacheEntry recipientInfoCacheEntry = this.cacheEntries[oldEntryIndex];

            recipientInfoCacheEntry.IncrementUsage();
            recipientInfoCacheEntry.SetSessionFlag();
            if (!string.Equals(newEntry.DisplayName, newEntry.RoutingAddress))
            {
                recipientInfoCacheEntry.DisplayName = newEntry.DisplayName;
            }
            if (newEntry.Alias.Length > 0)
            {
                recipientInfoCacheEntry.Alias = newEntry.Alias;
            }
            recipientInfoCacheEntry.RoutingType       = newEntry.RoutingType;
            recipientInfoCacheEntry.ItemId            = newEntry.ItemId;
            recipientInfoCacheEntry.EmailAddressIndex = newEntry.EmailAddressIndex;
            recipientInfoCacheEntry.AddressOrigin     = newEntry.AddressOrigin;
            recipientInfoCacheEntry.SipUri            = newEntry.SipUri;
            recipientInfoCacheEntry.MobilePhoneNumber = newEntry.MobilePhoneNumber;
        }
Esempio n. 2
0
        public virtual void AddEntry(RecipientInfoCacheEntry newEntry)
        {
            if (newEntry == null)
            {
                throw new ArgumentNullException("newEntry");
            }
            int num;

            if (Utilities.IsMapiPDL(newEntry.RoutingType))
            {
                num = this.GetEntryIndexByItemId(newEntry.ItemId);
            }
            else
            {
                num = this.GetEntryIndexByEmail(newEntry.RoutingAddress);
            }
            int num2;

            if (num == -1)
            {
                if (this.cacheEntries.Count >= (int)this.cacheSize)
                {
                    num2 = this.GetLeastPriorityEntryIndex();
                    this.cacheEntries[num2] = newEntry;
                }
                else
                {
                    num2 = this.cacheEntries.Count;
                    this.cacheEntries.Add(newEntry);
                }
                newEntry.SetSessionFlag();
            }
            else
            {
                num2 = num;
                this.UpdateEntry(newEntry, num2);
            }
            this.cacheEntries[num2].UpdateTimeStamp();
            this.isDirty = true;
        }