internal void UpdateForVersion(ApiVersion version, AuthorizationRules existingAuthorizationRules = null)
 {
     if (version < ApiVersion.Three)
     {
         foreach (SharedAccessAuthorizationRule value in this.nameToSharedAccessAuthorizationRuleMap.Values)
         {
             this.innerCollection.Remove(value);
         }
         this.nameToSharedAccessAuthorizationRuleMap.Clear();
         if (existingAuthorizationRules != null)
         {
             foreach (SharedAccessAuthorizationRule sharedAccessAuthorizationRule in existingAuthorizationRules.nameToSharedAccessAuthorizationRuleMap.Values)
             {
                 this.Add(sharedAccessAuthorizationRule);
             }
         }
     }
 }
        public bool HasEqualRuntimeBehavior(AuthorizationRules comparand)
        {
            bool flag;

            if (comparand == null)
            {
                return(false);
            }
            AuthorizationRuleEqualityComparer authorizationRuleEqualityComparer = new AuthorizationRuleEqualityComparer();
            HashSet <AuthorizationRule>       authorizationRules  = new HashSet <AuthorizationRule>(this.innerCollection, authorizationRuleEqualityComparer);
            HashSet <AuthorizationRule>       authorizationRules1 = new HashSet <AuthorizationRule>(comparand.innerCollection, authorizationRuleEqualityComparer);

            if (authorizationRules.Count != authorizationRules1.Count)
            {
                return(false);
            }
            HashSet <AuthorizationRule> .Enumerator enumerator = authorizationRules.GetEnumerator();
            try
            {
                while (enumerator.MoveNext())
                {
                    if (authorizationRules1.Contains(enumerator.Current))
                    {
                        continue;
                    }
                    flag = false;
                    return(flag);
                }
                return(true);
            }
            finally
            {
                ((IDisposable)enumerator).Dispose();
            }
            return(flag);
        }
        internal override void UpdateForVersion(ApiVersion version, EntityDescription existingDescription = null)
        {
            string internalForwardDeadLetteredMessagesTo;
            bool?  internalEnableExpress;
            bool?  internalEnablePartitioning;
            bool?  internalIsExpress;
            EntityAvailabilityStatus?internalAvailabilityStatus;
            TimeSpan?          internalAutoDeleteOnIdle;
            AuthorizationRules authorization;
            AuthorizationRules internalAuthorization;
            bool?        internalIsAnonymousAccessible;
            EntityStatus?internalStatus;
            string       internalForwardTo;
            DateTime?    internalCreatedAt;
            DateTime?    internalUpdatedAt;
            DateTime?    internalAccessedAt;
            string       internalUserMetadata;
            bool?        internalSupportOrdering;

            Microsoft.ServiceBus.Messaging.MessageCountDetails internalMessageCountDetails;
            QueueDescription queueDescription = existingDescription as QueueDescription;

            base.UpdateForVersion(version, existingDescription);
            bool flag = false;

            if (version < ApiVersion.Two)
            {
                if (queueDescription == null)
                {
                    internalAuthorization = null;
                }
                else
                {
                    internalAuthorization = queueDescription.InternalAuthorization;
                }
                this.InternalAuthorization = internalAuthorization;
                flag = true;
                if (queueDescription == null)
                {
                    internalIsAnonymousAccessible = null;
                }
                else
                {
                    internalIsAnonymousAccessible = queueDescription.InternalIsAnonymousAccessible;
                }
                this.InternalIsAnonymousAccessible = internalIsAnonymousAccessible;
                if (queueDescription == null)
                {
                    internalStatus = null;
                }
                else
                {
                    internalStatus = queueDescription.InternalStatus;
                }
                this.InternalStatus = internalStatus;
                if (queueDescription == null)
                {
                    internalForwardTo = null;
                }
                else
                {
                    internalForwardTo = queueDescription.InternalForwardTo;
                }
                this.InternalForwardTo = internalForwardTo;
                if (queueDescription == null)
                {
                    internalCreatedAt = null;
                }
                else
                {
                    internalCreatedAt = queueDescription.InternalCreatedAt;
                }
                this.InternalCreatedAt = internalCreatedAt;
                if (queueDescription == null)
                {
                    internalUpdatedAt = null;
                }
                else
                {
                    internalUpdatedAt = queueDescription.InternalUpdatedAt;
                }
                this.InternalUpdatedAt = internalUpdatedAt;
                if (queueDescription == null)
                {
                    internalAccessedAt = null;
                }
                else
                {
                    internalAccessedAt = queueDescription.InternalAccessedAt;
                }
                this.InternalAccessedAt = internalAccessedAt;
                if (queueDescription == null)
                {
                    internalUserMetadata = null;
                }
                else
                {
                    internalUserMetadata = queueDescription.InternalUserMetadata;
                }
                this.InternalUserMetadata = internalUserMetadata;
                if (queueDescription == null)
                {
                    internalSupportOrdering = null;
                }
                else
                {
                    internalSupportOrdering = queueDescription.InternalSupportOrdering;
                }
                this.InternalSupportOrdering = internalSupportOrdering;
                if (queueDescription == null)
                {
                    internalMessageCountDetails = null;
                }
                else
                {
                    internalMessageCountDetails = queueDescription.InternalMessageCountDetails;
                }
                this.InternalMessageCountDetails = internalMessageCountDetails;
            }
            if (version < ApiVersion.Three)
            {
                if (this.InternalAuthorization != null && !flag)
                {
                    AuthorizationRules authorizationRules = this.InternalAuthorization;
                    ApiVersion         apiVersion         = version;
                    if (queueDescription == null)
                    {
                        authorization = null;
                    }
                    else
                    {
                        authorization = queueDescription.Authorization;
                    }
                    authorizationRules.UpdateForVersion(apiVersion, authorization);
                }
                if (this.Status == EntityStatus.ReceiveDisabled || this.Status == EntityStatus.SendDisabled)
                {
                    this.Status = EntityStatus.Active;
                }
                if (queueDescription == null)
                {
                    internalAutoDeleteOnIdle = null;
                }
                else
                {
                    internalAutoDeleteOnIdle = queueDescription.InternalAutoDeleteOnIdle;
                }
                this.InternalAutoDeleteOnIdle = internalAutoDeleteOnIdle;
            }
            if (version < ApiVersion.Four)
            {
                if (queueDescription == null)
                {
                    internalAvailabilityStatus = null;
                }
                else
                {
                    internalAvailabilityStatus = queueDescription.InternalAvailabilityStatus;
                }
                this.InternalAvailabilityStatus = internalAvailabilityStatus;
            }
            if (version < ApiVersion.Six)
            {
                if (queueDescription == null)
                {
                    internalEnablePartitioning = null;
                }
                else
                {
                    internalEnablePartitioning = queueDescription.InternalEnablePartitioning;
                }
                this.InternalEnablePartitioning = internalEnablePartitioning;
                if (queueDescription == null)
                {
                    internalIsExpress = null;
                }
                else
                {
                    internalIsExpress = queueDescription.InternalIsExpress;
                }
                this.InternalIsExpress = internalIsExpress;
            }
            if (version < ApiVersion.Eight)
            {
                if (queueDescription == null)
                {
                    internalForwardDeadLetteredMessagesTo = null;
                }
                else
                {
                    internalForwardDeadLetteredMessagesTo = queueDescription.InternalForwardDeadLetteredMessagesTo;
                }
                this.InternalForwardDeadLetteredMessagesTo = internalForwardDeadLetteredMessagesTo;
                if (queueDescription == null)
                {
                    internalEnableExpress = null;
                }
                else
                {
                    internalEnableExpress = queueDescription.InternalEnableExpress;
                }
                this.InternalEnableExpress = internalEnableExpress;
            }
        }