当前位置: 首页>>代码示例>>C#>>正文


C# Permissions.IsolatedStorageFilePermission类代码示例

本文整理汇总了C#中System.Security.Permissions.IsolatedStorageFilePermission的典型用法代码示例。如果您正苦于以下问题:C# IsolatedStorageFilePermission类的具体用法?C# IsolatedStorageFilePermission怎么用?C# IsolatedStorageFilePermission使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


IsolatedStorageFilePermission类属于System.Security.Permissions命名空间,在下文中一共展示了IsolatedStorageFilePermission类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Intersect

 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;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:32,代码来源:IsolatedStorageFilePermission.cs

示例2: Union

     //------------------------------------------------------
     //
     // IPERMISSION IMPLEMENTATION
     //
     //------------------------------------------------------
     
     public override IPermission Union(IPermission target)
     {
         if (target == null)
         {
             return this.Copy();
         }
         else if (!VerifyType(target))
         {
             throw new 
                 ArgumentException(
                                 Environment.GetResourceString("Argument_WrongType", this.GetType().FullName)
                                  );
         }
         
         IsolatedStorageFilePermission operand = (IsolatedStorageFilePermission)target;
 
         if (this.IsUnrestricted() || operand.IsUnrestricted()) 
         {
             return new IsolatedStorageFilePermission( PermissionState.Unrestricted );
         }
         else
         {
             IsolatedStorageFilePermission union;
             union = new IsolatedStorageFilePermission( PermissionState.None );
             union.m_userQuota = max(m_userQuota,operand.m_userQuota);   
             union.m_machineQuota = max(m_machineQuota,operand.m_machineQuota);  
             union.m_expirationDays = max(m_expirationDays,operand.m_expirationDays);    
             union.m_permanentData = m_permanentData || operand.m_permanentData; 
             union.m_allowed = (IsolatedStorageContainment)max((long)m_allowed,(long)operand.m_allowed); 
             return union;
         }
     }   
开发者ID:uQr,项目名称:referencesource,代码行数:38,代码来源:isolatedstoragefilepermission.cs

示例3: CreateStackWalk

 protected override IStackWalk CreateStackWalk()
 {
     IsolatedStorageFilePermission permission = new IsolatedStorageFilePermission(PermissionState.Unrestricted);
     permission.UsageAllowed = attribute.UsageAllowed;
     permission.UserQuota = attribute.UsageQuota;
     return permission;
 }
开发者ID:BackupTheBerlios,项目名称:mbunit-svn,代码行数:7,代码来源:DenyIsolatedFileStorageAttribute.cs

示例4: Copy

		// Properties

		// Methods

		public override IPermission Copy () 
		{
			IsolatedStorageFilePermission p = new IsolatedStorageFilePermission (PermissionState.None);
			p.m_userQuota = m_userQuota;
			p.m_machineQuota = m_machineQuota;
			p.m_expirationDays = m_expirationDays;
			p.m_permanentData = m_permanentData;
			p.m_allowed = m_allowed;
			return p;
		}
开发者ID:runefs,项目名称:Marvin,代码行数:14,代码来源:IsolatedStorageFilePermission.cs

示例5: CreatePermission

		// Methods
		public override IPermission CreatePermission ()
		{
			IsolatedStorageFilePermission perm = null;
			if (this.Unrestricted)
				perm = new IsolatedStorageFilePermission (PermissionState.Unrestricted);
			else {
				perm = new IsolatedStorageFilePermission (PermissionState.None);
				perm.UsageAllowed = this.UsageAllowed;
				perm.UserQuota = this.UserQuota;
			}
			return perm;
		}
开发者ID:jack-pappas,项目名称:mono,代码行数:13,代码来源:IsolatedStorageFilePermissionAttribute.cs

示例6: Copy

 public override IPermission Copy()
 {
     IsolatedStorageFilePermission permission = new IsolatedStorageFilePermission(PermissionState.Unrestricted);
     if (!base.IsUnrestricted())
     {
         permission.m_userQuota = base.m_userQuota;
         permission.m_machineQuota = base.m_machineQuota;
         permission.m_expirationDays = base.m_expirationDays;
         permission.m_permanentData = base.m_permanentData;
         permission.m_allowed = base.m_allowed;
     }
     return permission;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:13,代码来源:IsolatedStorageFilePermission.cs

示例7: PermissionStateUnrestricted

		public void PermissionStateUnrestricted ()
		{
			IsolatedStorageFilePermission isfp = new IsolatedStorageFilePermission (PermissionState.Unrestricted);
			Assert.AreEqual (IsolatedStorageContainment.UnrestrictedIsolatedStorage, isfp.UsageAllowed, "UsageAllowed");
			Assert.AreEqual (Int64.MaxValue, isfp.UserQuota, "UserQuota");

			SecurityElement se = isfp.ToXml ();
			// only class and version are present
			Assert.AreEqual ("true", se.Attribute ("Unrestricted"), "Xml-Unrestricted");
			Assert.IsNull (se.Children, "Xml-Children");

			IsolatedStorageFilePermission copy = (IsolatedStorageFilePermission)isfp.Copy ();
			Assert.IsFalse (Object.ReferenceEquals (isfp, copy), "ReferenceEquals");
			Assert.AreEqual (isfp.UsageAllowed, copy.UsageAllowed, "UsageAllowed");
			Assert.AreEqual (isfp.UserQuota, copy.UserQuota, "UserQuota");
		}
开发者ID:Profit0004,项目名称:mono,代码行数:16,代码来源:IsolatedStorageFilePermissionTest.cs

示例8: Intersect

		public override IPermission Intersect (IPermission target) 
		{
			IsolatedStorageFilePermission isfp = Cast (target);
			if (isfp == null)
				return null;
			if (IsEmpty () && isfp.IsEmpty ())
				return null;

			IsolatedStorageFilePermission p = new IsolatedStorageFilePermission (PermissionState.None);
			p.m_userQuota = (m_userQuota < isfp.m_userQuota) ? m_userQuota : isfp.m_userQuota;
			p.m_machineQuota = (m_machineQuota < isfp.m_machineQuota) ? m_machineQuota : isfp.m_machineQuota;
			p.m_expirationDays = (m_expirationDays < isfp.m_expirationDays) ? m_expirationDays : isfp.m_expirationDays;
			p.m_permanentData = (m_permanentData && isfp.m_permanentData);
			// UsageAllowed == Unrestricted is a special case handled by the property
			p.UsageAllowed = (m_allowed < isfp.m_allowed) ? m_allowed : isfp.m_allowed;
			return p;
		}
开发者ID:runefs,项目名称:Marvin,代码行数:17,代码来源:IsolatedStorageFilePermission.cs

示例9: Intersect

		public void Intersect ()
		{
			IsolatedStorageFilePermission empty = new IsolatedStorageFilePermission (PermissionState.None);
			IsolatedStorageFilePermission intersect = (IsolatedStorageFilePermission)empty.Intersect (null);
			Assert.IsNull (intersect, "empty N null");

			intersect = (IsolatedStorageFilePermission)empty.Intersect (empty);
			Assert.IsNull (intersect, "empty N empty");

			IsolatedStorageFilePermission unrestricted = new IsolatedStorageFilePermission (PermissionState.Unrestricted);
			intersect = (IsolatedStorageFilePermission)unrestricted.Intersect (null);
			Assert.IsNull (intersect, "unrestricted N null");

			intersect = (IsolatedStorageFilePermission)unrestricted.Intersect (empty);
			Assert.IsNotNull (intersect, "unrestricted N empty");

			intersect = (IsolatedStorageFilePermission)unrestricted.Intersect (unrestricted);
			Assert.IsNotNull (intersect, "unrestricted N unrestricted");
		}
开发者ID:Profit0004,项目名称:mono,代码行数:19,代码来源:IsolatedStorageFilePermissionTest.cs

示例10: DemandAdminPermission

        private static void DemandAdminPermission()
        {
            // Ok if more than one instance is created, no need to sync.
            if (s_PermAdminUser == null)
            {
                s_PermAdminUser = new IsolatedStorageFilePermission(
                    IsolatedStorageContainment.AdministerIsolatedStorageByUser,
                        0, false);
            }

            s_PermAdminUser.Demand();
        }
开发者ID:ArildF,项目名称:masters,代码行数:12,代码来源:isolatedstoragefile.cs

示例11: FromXml_WrongVersion

		public void FromXml_WrongVersion ()
		{
			IsolatedStorageFilePermission isfp = new IsolatedStorageFilePermission (PermissionState.None);
			SecurityElement se = isfp.ToXml ();
			se.Attributes.Remove ("version");
			se.Attributes.Add ("version", "2");
			isfp.FromXml (se);
		}
开发者ID:Profit0004,项目名称:mono,代码行数:8,代码来源:IsolatedStorageFilePermissionTest.cs

示例12: FromXml_WrongClass

		public void FromXml_WrongClass ()
		{
			IsolatedStorageFilePermission isfp = new IsolatedStorageFilePermission (PermissionState.None);
			SecurityElement se = isfp.ToXml ();

			SecurityElement w = new SecurityElement (se.Tag);
			w.AddAttribute ("class", "Wrong" + se.Attribute ("class"));
			w.AddAttribute ("version", se.Attribute ("version"));
			isfp.FromXml (w);
			// doesn't care of the class name at that stage
			// anyway the class has already be created so...
		}
开发者ID:Profit0004,项目名称:mono,代码行数:12,代码来源:IsolatedStorageFilePermissionTest.cs

示例13: FromXml_WrongTag

		public void FromXml_WrongTag ()
		{
			IsolatedStorageFilePermission isfp = new IsolatedStorageFilePermission (PermissionState.None);
			SecurityElement se = isfp.ToXml ();
			se.Tag = "IMono";
			isfp.FromXml (se);
		}
开发者ID:Profit0004,项目名称:mono,代码行数:7,代码来源:IsolatedStorageFilePermissionTest.cs

示例14: Copy

 public override IPermission Copy()
 {
     IsolatedStorageFilePermission copy ;
     copy = new IsolatedStorageFilePermission(PermissionState.Unrestricted);
     if(!IsUnrestricted()){
         copy.m_userQuota = m_userQuota; 
         copy.m_machineQuota = m_machineQuota;   
         copy.m_expirationDays = m_expirationDays;   
         copy.m_permanentData = m_permanentData; 
         copy.m_allowed = m_allowed; 
     }
     return copy;
 }
开发者ID:uQr,项目名称:referencesource,代码行数:13,代码来源:isolatedstoragefilepermission.cs

示例15: Intersect

        public override IPermission Intersect(IPermission target)
        {
            if (target == null)
                return null;
            else if (!VerifyType(target))
            {
                throw new 
                    ArgumentException(
                                    Environment.GetResourceString("Argument_WrongType", this.GetType().FullName)
                                     );
            }

            IsolatedStorageFilePermission operand = (IsolatedStorageFilePermission)target;

            if(operand.IsUnrestricted()) 
                return Copy();
            else if(IsUnrestricted())
                return target.Copy();
            
            IsolatedStorageFilePermission intersection;
            intersection = new IsolatedStorageFilePermission( PermissionState.None );
            intersection.m_userQuota = min(m_userQuota,operand.m_userQuota);    
            intersection.m_machineQuota = min(m_machineQuota,operand.m_machineQuota);   
            intersection.m_expirationDays = min(m_expirationDays,operand.m_expirationDays); 
            intersection.m_permanentData = m_permanentData && operand.m_permanentData;  
            intersection.m_allowed = (IsolatedStorageContainment)min((long)m_allowed,(long)operand.m_allowed);  

            if ((intersection.m_userQuota == 0) &&
            (intersection.m_machineQuota == 0) &&
            (intersection.m_expirationDays == 0) &&
            (intersection.m_permanentData == false) &&
            (intersection.m_allowed == IsolatedStorageContainment.None))
                return null;

            return intersection;
        }
开发者ID:uQr,项目名称:referencesource,代码行数:36,代码来源:isolatedstoragefilepermission.cs


注:本文中的System.Security.Permissions.IsolatedStorageFilePermission类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。