internal MessageQueuePermissionEntryCollection(MessageQueuePermission owner)
 {
     this.owner = owner;
 }
 public override IPermission Union(IPermission target)
 {
     if (target == null)
         return this.Copy();
     else if (!(target is MessageQueuePermission))
     {
         throw new ArgumentException(Res.GetString("InvalidParameter", (object)"target", (object)target.ToString()));
     }
     else
     {
         MessageQueuePermission messageQueuePermission1 = (MessageQueuePermission)target;
         MessageQueuePermission messageQueuePermission2 = new MessageQueuePermission();
         if (this.IsUnrestricted() || messageQueuePermission1.IsUnrestricted())
         {
             messageQueuePermission2.isUnrestricted = true;
             return (IPermission)messageQueuePermission2;
         }
         else
         {
             Hashtable hashtable = new Hashtable(MessageQueuePermission.GetComparer());
             this.ResolveFormatNames();
             messageQueuePermission1.ResolveFormatNames();
             IDictionaryEnumerator enumerator1 = this.resolvedFormatNames.GetEnumerator();
             IDictionaryEnumerator enumerator2 = messageQueuePermission1.resolvedFormatNames.GetEnumerator();
             while (enumerator1.MoveNext())
                 hashtable[(object)(string)enumerator1.Key] = enumerator1.Value;
             while (enumerator2.MoveNext())
             {
                 if (!hashtable.ContainsKey(enumerator2.Key))
                 {
                     hashtable[enumerator2.Key] = enumerator2.Value;
                 }
                 else
                 {
                     MessageQueuePermissionAccess permissionAccess = (MessageQueuePermissionAccess)hashtable[enumerator2.Key];
                     hashtable[enumerator2.Key] = (object)(permissionAccess | (MessageQueuePermissionAccess)enumerator2.Value);
                 }
             }
             messageQueuePermission2.resolvedFormatNames = hashtable;
             return (IPermission)messageQueuePermission2;
         }
     }
 }
 public override IPermission Copy()
 {
     MessageQueuePermission messageQueuePermission = new MessageQueuePermission();
     messageQueuePermission.isUnrestricted = this.isUnrestricted;
     foreach (MessageQueuePermissionEntry queuePermissionEntry in (CollectionBase)this.PermissionEntries)
         messageQueuePermission.PermissionEntries.Add(queuePermissionEntry);
     messageQueuePermission.resolvedFormatNames = this.resolvedFormatNames;
     return (IPermission)messageQueuePermission;
 }
        public override IPermission Intersect(IPermission target)
        {
            if (target == null)
                return (IPermission)null;
            if (!(target is MessageQueuePermission))
            {
                throw new ArgumentException( "InvalidParameter: target" + target);
            }

            MessageQueuePermission messageQueuePermission1 = (MessageQueuePermission)target;
            if (this.IsUnrestricted())
                return messageQueuePermission1.Copy();
            if (messageQueuePermission1.IsUnrestricted())
            {
                return this.Copy();
            }
            this.ResolveFormatNames();
            messageQueuePermission1.ResolveFormatNames();
            MessageQueuePermission messageQueuePermission2 = new MessageQueuePermission();
            Hashtable hashtable1 = new Hashtable(MessageQueuePermission.GetComparer());
            messageQueuePermission2.resolvedFormatNames = hashtable1;
            IDictionaryEnumerator enumerator;
            Hashtable hashtable2;
            if (this.resolvedFormatNames.Count < messageQueuePermission1.resolvedFormatNames.Count)
            {
                enumerator = this.resolvedFormatNames.GetEnumerator();
                hashtable2 = messageQueuePermission1.resolvedFormatNames;
            }
            else
            {
                enumerator = messageQueuePermission1.resolvedFormatNames.GetEnumerator();
                hashtable2 = this.resolvedFormatNames;
            }
            while (enumerator.MoveNext())
            {
                if (hashtable2.ContainsKey(enumerator.Key))
                {
                    string str = (string)enumerator.Key;
                    MessageQueuePermissionAccess permissionAccess1 = (MessageQueuePermissionAccess)enumerator.Value;
                    MessageQueuePermissionAccess permissionAccess2 = (MessageQueuePermissionAccess)hashtable2[(object)str];
                    hashtable1.Add((object)str, (object)(permissionAccess1 & permissionAccess2));
                }
            }
            return (IPermission)messageQueuePermission2;
        }