Пример #1
0
        ///<summary>
        ///     Return the Union with the target
        ///</summary>
        public override IPermission Union(IPermission target)
        {
            if (target == null)
            {
                return(this.Copy());
            }

            WebBrowserPermission operand = target as WebBrowserPermission;

            if (operand != null)
            {
                WebBrowserPermissionLevel unionLevel = _webBrowserPermissionLevel > operand._webBrowserPermissionLevel ?

                                                       _webBrowserPermissionLevel : operand._webBrowserPermissionLevel;

                if (unionLevel == WebBrowserPermissionLevel.None)
                {
                    return(null);
                }
                else
                {
                    return(new WebBrowserPermission(unionLevel));
                }
            }
            else
            {
                throw new ArgumentException(SR.Get(SRID.TargetNotWebBrowserPermissionLevel));
            }
        }
Пример #2
0
        ///<summary>
        ///     Return the intersection with the target
        ///</summary>
        public override IPermission Intersect(IPermission target)
        {
            if (target == null)
            {
                return(null);
            }

            WebBrowserPermission operand = target as WebBrowserPermission;

            if (operand != null)
            {
                WebBrowserPermissionLevel intersectLevel = _webBrowserPermissionLevel < operand._webBrowserPermissionLevel
                                                                ? _webBrowserPermissionLevel : operand._webBrowserPermissionLevel;

                if (intersectLevel == WebBrowserPermissionLevel.None)
                {
                    return(null);
                }
                else
                {
                    return(new WebBrowserPermission(intersectLevel));
                }
            }
            else
            {
                throw new ArgumentException(SR.Get(SRID.TargetNotWebBrowserPermissionLevel));
            }
        }
Пример #3
0
        //
        // CodeAccessPermission implementation
        //


        ///<summary>
        ///     Is this a subsetOf the target ?
        ///</summary>
        public override bool IsSubsetOf(IPermission target)
        {
            if (target == null)
            {
                return(_webBrowserPermissionLevel == WebBrowserPermissionLevel.None);
            }

            WebBrowserPermission operand = target as WebBrowserPermission;

            if (operand != null)
            {
                return(this._webBrowserPermissionLevel <= operand._webBrowserPermissionLevel);
            }
            else
            {
                throw new ArgumentException(SR.Get(SRID.TargetNotWebBrowserPermissionLevel));
            }
        }
Пример #4
0
 ///<summary>
 ///     WebBrowserPermission ctor.
 ///</summary>
 public WebBrowserPermission(WebBrowserPermissionLevel webBrowserPermissionLevel)
 {
     WebBrowserPermission.VerifyWebBrowserPermissionLevel(webBrowserPermissionLevel);
     this._webBrowserPermissionLevel = webBrowserPermissionLevel;
 }