Inheritance: System.Security.CodeAccessPermission, IUnrestrictedPermission
Ejemplo n.º 1
0
        public override IPermission Intersect(IPermission target)
        {
            if (target == null)
            {
                return(null);
            }
            if (!base.VerifyType(target))
            {
                throw new ArgumentException(Environment.GetResourceString("Argument_WrongType", new object[] { base.GetType().FullName }));
            }
            IsolatedStorageFilePermission permission = (IsolatedStorageFilePermission)target;

            if (permission.IsUnrestricted())
            {
                return(this.Copy());
            }
            if (base.IsUnrestricted())
            {
                return(target.Copy());
            }
            IsolatedStorageFilePermission permission2 = new IsolatedStorageFilePermission(PermissionState.None)
            {
                m_userQuota      = IsolatedStoragePermission.min(base.m_userQuota, permission.m_userQuota),
                m_machineQuota   = IsolatedStoragePermission.min(base.m_machineQuota, permission.m_machineQuota),
                m_expirationDays = IsolatedStoragePermission.min(base.m_expirationDays, permission.m_expirationDays),
                m_permanentData  = base.m_permanentData && permission.m_permanentData,
                m_allowed        = (IsolatedStorageContainment)((int)IsolatedStoragePermission.min((long)base.m_allowed, (long)permission.m_allowed))
            };

            if ((((permission2.m_userQuota == 0L) && (permission2.m_machineQuota == 0L)) && ((permission2.m_expirationDays == 0L) && !permission2.m_permanentData)) && (permission2.m_allowed == IsolatedStorageContainment.None))
            {
                return(null);
            }
            return(permission2);
        }
Ejemplo n.º 2
0
        /// <summary>创建一个权限,该权限是当前权限与指定权限的并集。</summary>
        /// <returns>一个新权限,它表示当前权限与指定权限的并集。</returns>
        /// <param name="target">将与当前权限合并的权限。它必须与当前权限属于同一类型。</param>
        /// <exception cref="T:System.ArgumentException">
        /// <paramref name="target" /> 参数不是 null,而且与当前权限不是同一类型。</exception>
        public override IPermission Union(IPermission target)
        {
            if (target == null)
            {
                return(this.Copy());
            }
            if (!this.VerifyType(target))
            {
                throw new ArgumentException(Environment.GetResourceString("Argument_WrongType", (object)this.GetType().FullName));
            }
            IsolatedStorageFilePermission storageFilePermission1 = (IsolatedStorageFilePermission)target;

            if (this.IsUnrestricted() || storageFilePermission1.IsUnrestricted())
            {
                return((IPermission) new IsolatedStorageFilePermission(PermissionState.Unrestricted));
            }
            IsolatedStorageFilePermission storageFilePermission2 = new IsolatedStorageFilePermission(PermissionState.None);
            long num1 = IsolatedStoragePermission.max(this.m_userQuota, storageFilePermission1.m_userQuota);

            storageFilePermission2.m_userQuota = num1;
            long num2 = IsolatedStoragePermission.max(this.m_machineQuota, storageFilePermission1.m_machineQuota);

            storageFilePermission2.m_machineQuota = num2;
            long num3 = IsolatedStoragePermission.max(this.m_expirationDays, storageFilePermission1.m_expirationDays);

            storageFilePermission2.m_expirationDays = num3;
            int num4 = this.m_permanentData ? 1 : (storageFilePermission1.m_permanentData ? 1 : 0);

            storageFilePermission2.m_permanentData = num4 != 0;
            int num5 = (int)IsolatedStoragePermission.max((long)this.m_allowed, (long)storageFilePermission1.m_allowed);

            storageFilePermission2.m_allowed = (IsolatedStorageContainment)num5;
            return((IPermission)storageFilePermission2);
        }
Ejemplo n.º 3
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);
            }
            if (!this.VerifyType(target))
            {
                throw new ArgumentException(Environment.GetResourceString("Argument_WrongType", (object)this.GetType().FullName));
            }
            IsolatedStorageFilePermission storageFilePermission1 = (IsolatedStorageFilePermission)target;

            if (storageFilePermission1.IsUnrestricted())
            {
                return(this.Copy());
            }
            if (this.IsUnrestricted())
            {
                return(target.Copy());
            }
            IsolatedStorageFilePermission storageFilePermission2 = new IsolatedStorageFilePermission(PermissionState.None);

            storageFilePermission2.m_userQuota      = IsolatedStoragePermission.min(this.m_userQuota, storageFilePermission1.m_userQuota);
            storageFilePermission2.m_machineQuota   = IsolatedStoragePermission.min(this.m_machineQuota, storageFilePermission1.m_machineQuota);
            storageFilePermission2.m_expirationDays = IsolatedStoragePermission.min(this.m_expirationDays, storageFilePermission1.m_expirationDays);
            storageFilePermission2.m_permanentData  = this.m_permanentData && storageFilePermission1.m_permanentData;
            storageFilePermission2.m_allowed        = (IsolatedStorageContainment)IsolatedStoragePermission.min((long)this.m_allowed, (long)storageFilePermission1.m_allowed);
            if (storageFilePermission2.m_userQuota == 0L && storageFilePermission2.m_machineQuota == 0L && (storageFilePermission2.m_expirationDays == 0L && !storageFilePermission2.m_permanentData) && storageFilePermission2.m_allowed == IsolatedStorageContainment.None)
            {
                return((IPermission)null);
            }
            return((IPermission)storageFilePermission2);
        }
Ejemplo n.º 4
0
        /// <summary>Creates a permission that is the union of the current permission and the specified permission.</summary>
        /// <param name="target">A permission to combine with the current permission. It must be of the same type as the current permission. </param>
        /// <returns>A new permission that represents the union of the current permission and the specified permission.</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: 0x0600252E RID: 9518 RVA: 0x0008758C File Offset: 0x0008578C
        public override IPermission Union(IPermission target)
        {
            if (target == null)
            {
                return(this.Copy());
            }
            if (!base.VerifyType(target))
            {
                throw new ArgumentException(Environment.GetResourceString("Argument_WrongType", new object[]
                {
                    base.GetType().FullName
                }));
            }
            IsolatedStorageFilePermission isolatedStorageFilePermission = (IsolatedStorageFilePermission)target;

            if (base.IsUnrestricted() || isolatedStorageFilePermission.IsUnrestricted())
            {
                return(new IsolatedStorageFilePermission(PermissionState.Unrestricted));
            }
            return(new IsolatedStorageFilePermission(PermissionState.None)
            {
                m_userQuota = IsolatedStoragePermission.max(this.m_userQuota, isolatedStorageFilePermission.m_userQuota),
                m_machineQuota = IsolatedStoragePermission.max(this.m_machineQuota, isolatedStorageFilePermission.m_machineQuota),
                m_expirationDays = IsolatedStoragePermission.max(this.m_expirationDays, isolatedStorageFilePermission.m_expirationDays),
                m_permanentData = (this.m_permanentData || isolatedStorageFilePermission.m_permanentData),
                m_allowed = (IsolatedStorageContainment)IsolatedStoragePermission.max((long)this.m_allowed, (long)isolatedStorageFilePermission.m_allowed)
            });
        }
	internal IsolatedStoragePermission(IsolatedStoragePermission copyFrom)
			{
				this.state = copyFrom.state;
				this.userQuota = copyFrom.userQuota;
				this.usageAllowed = copyFrom.usageAllowed;
			}
Ejemplo n.º 6
0
 internal IsolatedStoragePermission(IsolatedStoragePermission copyFrom)
 {
     this.state        = copyFrom.state;
     this.userQuota    = copyFrom.userQuota;
     this.usageAllowed = copyFrom.usageAllowed;
 }
	internal IsolatedStorageFilePermission(IsolatedStoragePermission copyFrom)
			: base(copyFrom)
			{
				// Nothing to do here.
			}
Ejemplo n.º 8
0
 internal IsolatedStorageFilePermission(IsolatedStoragePermission copyFrom)
     : base(copyFrom)
 {
     // Nothing to do here.
 }