Esempio n. 1
0
        public override IPermission Copy()
        {
            CustomPerssion copy = new CustomPerssion(PermissionState.None);

            if (this.unrestricted)
            {
                copy.unrestricted = true;
            }
            else
            {
                copy.unrestricted = false;
            }
            return(copy);
        }
Esempio n. 2
0
 public override bool IsSubsetOf(IPermission target)
 {
     if (target == null)
     {
         return(!this.unrestricted);
     }
     try
     {
         CustomPerssion passedPermission = (CustomPerssion)target;
         if (!this.unrestricted == passedPermission.unrestricted)
         {
             return(true);
         }
         else
         {
             return(false);
         }
     }
     catch (InvalidCastException)
     {
         throw new ArgumentException("Argument_wrongType", this.GetType().FullName);
     }
 }
Esempio n. 3
0
 public override IPermission Intersect(IPermission target)
 {
     try
     {
         if (target == null)
         {
             return(null);
         }
         CustomPerssion PassedPermission = (CustomPerssion)target;
         if (!PassedPermission.IsUnrestricted())
         {
             return(PassedPermission);
         }
         else
         {
             return(this.Copy());
         }
     }
     catch (InvalidCastException)
     {
         throw new ArgumentException("Argument_wrongType", this.GetType().FullName);
     }
 }