Example #1
0
 private void OnSerialized(StreamingContext ctx)
 {
     if ((ctx.State & ~(StreamingContextStates.CrossAppDomain | StreamingContextStates.Clone)) != 0)
     {
         this.m_serializedPermission = null;
         this.m_site = null;
     }
 }
 public SiteMembershipCondition( String site )
 {
     if (site == null)
         throw new ArgumentNullException( "site" );
     Contract.EndContractBlock();
 
     m_site = new SiteString( site );
 }
 public SiteMembershipCondition(string site)
 {
     if (site == null)
     {
         throw new ArgumentNullException("site");
     }
     this.m_site = new SiteString(site);
 }
Example #4
0
 public Site(string name)
 {
     if (name == null)
     {
         throw new ArgumentNullException("name");
     }
     this.m_name = new SiteString(name);
 }
 private void OnSerialized(StreamingContext ctx)
 {
     if ((ctx.State & ~(StreamingContextStates.Clone | StreamingContextStates.CrossAppDomain)) == (StreamingContextStates)0)
     {
         return;
     }
     this.m_serializedPermission = (string)null;
     this.m_site = (SiteString)null;
 }
        /// <summary>Creates and returns a permission that is the intersection of the current permission and the specified permission.</summary>
        /// <param name="target">A permission to intersect with the current permission. It must be of the same type as the current permission. </param>
        /// <returns>A new permission that represents the intersection of the current permission and the specified permission. This new permission is <see langword="null" /> if the intersection is empty.</returns>
        /// <exception cref="T:System.ArgumentException">The <paramref name="target" /> parameter is not <see langword="null" /> and is not of the same type as the current permission. </exception>
        // Token: 0x0600262D RID: 9773 RVA: 0x00089BFC File Offset: 0x00087DFC
        public override IPermission Intersect(IPermission target)
        {
            if (target == null)
            {
                return(null);
            }
            SiteIdentityPermission siteIdentityPermission = target as SiteIdentityPermission;

            if (siteIdentityPermission == null)
            {
                throw new ArgumentException(Environment.GetResourceString("Argument_WrongType", new object[]
                {
                    base.GetType().FullName
                }));
            }
            if (this.m_unrestricted && siteIdentityPermission.m_unrestricted)
            {
                return(new SiteIdentityPermission(PermissionState.None)
                {
                    m_unrestricted = true
                });
            }
            if (this.m_unrestricted)
            {
                return(siteIdentityPermission.Copy());
            }
            if (siteIdentityPermission.m_unrestricted)
            {
                return(this.Copy());
            }
            if (this.m_sites == null || siteIdentityPermission.m_sites == null || this.m_sites.Length == 0 || siteIdentityPermission.m_sites.Length == 0)
            {
                return(null);
            }
            List <SiteString> list = new List <SiteString>();

            foreach (SiteString siteString in this.m_sites)
            {
                foreach (SiteString operand in siteIdentityPermission.m_sites)
                {
                    SiteString siteString2 = siteString.Intersect(operand);
                    if (siteString2 != null)
                    {
                        list.Add(siteString2);
                    }
                }
            }
            if (list.Count == 0)
            {
                return(null);
            }
            return(new SiteIdentityPermission(PermissionState.None)
            {
                m_sites = list.ToArray()
            });
        }
Example #7
0
        /// <internalonly/>
        int IBuiltInEvidence.InitFromBuffer(char[] buffer, int position)
        {
            int length = BuiltInEvidenceHelper.GetIntFromCharArray(buffer, position);

            position += 2;

            m_name = new SiteString(new String(buffer, position, length));

            return(position + length);
        }
        public SiteMembershipCondition(String site)
        {
            if (site == null)
            {
                throw new ArgumentNullException("site");
            }
            Contract.EndContractBlock();

            m_site = new SiteString(site);
        }
Example #9
0
        public Site(String name)
        {
            if (name == null)
            {
                throw new ArgumentNullException("name");
            }
            Contract.EndContractBlock();

            m_name = new SiteString(name);
        }
Example #10
0
 private void OnSerializing(StreamingContext ctx)
 {
     if ((ctx.State & ~(StreamingContextStates.CrossAppDomain | StreamingContextStates.Clone)) != 0)
     {
         this.m_serializedPermission = this.ToXml().ToString();
         if ((this.m_sites != null) && (this.m_sites.Length == 1))
         {
             this.m_site = this.m_sites[0];
         }
     }
 }
        /// <summary>创建并返回一个权限,该权限是当前权限和指定权限的交集。</summary>
        /// <returns>一个新权限,它表示当前权限与指定权限的交集。如果交集为空,则此新权限为 null。</returns>
        /// <param name="target">要与当前权限相交的权限。它必须与当前权限属于同一类型。</param>
        /// <exception cref="T:System.ArgumentException">
        /// <paramref name="target" /> 参数不是 null,而且与当前权限不是同一类型。</exception>
        public override IPermission Intersect(IPermission target)
        {
            if (target == null)
            {
                return((IPermission)null);
            }
            SiteIdentityPermission identityPermission = target as SiteIdentityPermission;

            if (identityPermission == null)
            {
                throw new ArgumentException(Environment.GetResourceString("Argument_WrongType", (object)this.GetType().FullName));
            }
            if (this.m_unrestricted && identityPermission.m_unrestricted)
            {
                return (IPermission) new SiteIdentityPermission(PermissionState.None)
                       {
                           m_unrestricted = true
                       }
            }
            ;
            if (this.m_unrestricted)
            {
                return(identityPermission.Copy());
            }
            if (identityPermission.m_unrestricted)
            {
                return(this.Copy());
            }
            if (this.m_sites == null || identityPermission.m_sites == null || (this.m_sites.Length == 0 || identityPermission.m_sites.Length == 0))
            {
                return((IPermission)null);
            }
            List <SiteString> siteStringList = new List <SiteString>();

            foreach (SiteString mSite1 in this.m_sites)
            {
                foreach (SiteString mSite2 in identityPermission.m_sites)
                {
                    SiteString siteString = mSite1.Intersect(mSite2);
                    if (siteString != null)
                    {
                        siteStringList.Add(siteString);
                    }
                }
            }
            if (siteStringList.Count == 0)
            {
                return((IPermission)null);
            }
            return((IPermission) new SiteIdentityPermission(PermissionState.None)
            {
                m_sites = siteStringList.ToArray()
            });
        }
 private void OnSerializing(StreamingContext ctx)
 {
     if ((ctx.State & ~(StreamingContextStates.Clone | StreamingContextStates.CrossAppDomain)) == (StreamingContextStates)0)
     {
         return;
     }
     this.m_serializedPermission = this.ToXml().ToString();
     if (this.m_sites == null || this.m_sites.Length != 1)
     {
         return;
     }
     this.m_site = this.m_sites[0];
 }
Example #13
0
 private void OnDeserialized(StreamingContext ctx)
 {
     if (this.m_serializedPermission != null)
     {
         this.FromXml(SecurityElement.FromString(this.m_serializedPermission));
         this.m_serializedPermission = null;
     }
     else if (this.m_site != null)
     {
         this.m_unrestricted = false;
         this.m_sites        = new SiteString[] { this.m_site };
         this.m_site         = null;
     }
 }
 private void ParseSite()
 {
     lock (this)
     {
         if (this.m_element != null)
         {
             string site = this.m_element.Attribute("Site");
             if (site == null)
             {
                 throw new ArgumentException(Environment.GetResourceString("Argument_SiteCannotBeNull"));
             }
             this.m_site    = new SiteString(site);
             this.m_element = null;
         }
     }
 }
 public void FromXml(SecurityElement e, PolicyLevel level)
 {
     if (e == null)
     {
         throw new ArgumentNullException("e");
     }
     if (!e.Tag.Equals("IMembershipCondition"))
     {
         throw new ArgumentException(Environment.GetResourceString("Argument_MembershipConditionElement"));
     }
     lock (this)
     {
         this.m_site    = null;
         this.m_element = e;
     }
 }
 private void ParseSite()
 {
     lock (this)
     {
         if (this.m_element == null)
         {
             return;
         }
         string local_2 = this.m_element.Attribute("Site");
         if (local_2 == null)
         {
             throw new ArgumentException(Environment.GetResourceString("Argument_SiteCannotBeNull"));
         }
         this.m_site    = new SiteString(local_2);
         this.m_element = (SecurityElement)null;
     }
 }
 private void OnDeserialized(StreamingContext ctx)
 {
     if (this.m_serializedPermission != null)
     {
         this.FromXml(SecurityElement.FromString(this.m_serializedPermission));
         this.m_serializedPermission = (string)null;
     }
     else
     {
         if (this.m_site == null)
         {
             return;
         }
         this.m_unrestricted = false;
         this.m_sites        = new SiteString[1];
         this.m_sites[0]     = this.m_site;
         this.m_site         = (SiteString)null;
     }
 }
        private void ParseSite()
        {
            lock (this)
            {
                if (m_element == null)
                {
                    return;
                }

                String elSite = m_element.Attribute("Site");
                if (elSite == null)
                {
                    throw new ArgumentException(Environment.GetResourceString("Argument_SiteCannotBeNull"));
                }
                else
                {
                    m_site = new SiteString(elSite);
                }
                m_element = null;
            }
        }
 internal SiteMembershipCondition()
 {
     this.m_site = (SiteString)null;
 }
Example #20
0
 private Site(SiteString name)
 {
     Debug.Assert(name != null);
     m_name = name;
 }
 // Token: 0x06002A12 RID: 10770 RVA: 0x0009C849 File Offset: 0x0009AA49
 private Site(SiteString name)
 {
     this.m_name = name;
 }
Example #22
0
 private Site(SiteString name)
 {
     Contract.Assert(name != null);
     m_name = name;
 }
Example #23
0
 internal Site()
 {
     m_name = null;
 }
     //------------------------------------------------------
     //
     // PUBLIC CONSTRUCTORS
     //
     //------------------------------------------------------
 
     internal SiteMembershipCondition()
     {
         m_site = null;
     }
        private void ParseSite()
        {   
            lock (this)
            {
                if (m_element == null)
                    return;

                String elSite = m_element.Attribute( "Site" );
                if (elSite == null)
                    throw new ArgumentException( Environment.GetResourceString( "Argument_SiteCannotBeNull" ) );
                else
                    m_site = new SiteString( elSite );
                m_element = null;
            }
        }
 public void FromXml( SecurityElement e, PolicyLevel level  )
 {
     if (e == null)
         throw new ArgumentNullException("e");
 
     if (!e.Tag.Equals( "IMembershipCondition" ))
     {
         throw new ArgumentException( Environment.GetResourceString( "Argument_MembershipConditionElement" ) );
     }
     Contract.EndContractBlock();
     
     lock (this)
     {
         m_site = null;
         m_element = e;
     }
 }
Example #27
0
 internal Site(byte[] id, String name)
 {
     m_name = ParseSiteFromUrl(name);
 }
 internal SiteMembershipCondition()
 {
     this.m_site = null;
 }