本文整理汇总了C#中System.Security.Permissions.IsolatedStorageFilePermission类的典型用法代码示例。如果您正苦于以下问题:C# IsolatedStorageFilePermission类的具体用法?C# IsolatedStorageFilePermission怎么用?C# IsolatedStorageFilePermission使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IsolatedStorageFilePermission类属于System.Security.Permissions命名空间,在下文中一共展示了IsolatedStorageFilePermission类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: UsageAllowedQuota
public void UsageAllowedQuota ()
{
IsolatedStorageFilePermission empty = new IsolatedStorageFilePermission (PermissionState.None);
IsolatedStorageFilePermission small = new IsolatedStorageFilePermission (PermissionState.None);
small.UsageAllowed = IsolatedStorageContainment.DomainIsolationByUser;
small.UserQuota = 1;
IsolatedStorageFilePermission union = (IsolatedStorageFilePermission)empty.Union (small);
Assert.AreEqual (IsolatedStorageContainment.DomainIsolationByUser, union.UsageAllowed, "DomainIsolationByUser");
Assert.AreEqual (1, union.UserQuota, "1");
Assert.IsFalse (union.IsUnrestricted (), "IsUnrestricted-1");
Assert.IsTrue (small.IsSubsetOf (union), "IsSubset-1a");
Assert.IsTrue (empty.IsSubsetOf (union), "IsSubset-1b");
Assert.IsTrue (union.IsSubsetOf (small), "IsSubset-1c");
IsolatedStorageFilePermission intersect = (IsolatedStorageFilePermission)union.Intersect (small);
Assert.AreEqual (small.UsageAllowed, intersect.UsageAllowed, "Intersect-UsageAllowed-1");
Assert.AreEqual (small.UserQuota, intersect.UserQuota, "Intersect-UserQuota-1");
small.UsageAllowed = IsolatedStorageContainment.AssemblyIsolationByUser;
small.UserQuota = 2;
union = (IsolatedStorageFilePermission)union.Union (small);
Assert.AreEqual (IsolatedStorageContainment.AssemblyIsolationByUser, union.UsageAllowed, "AssemblyIsolationByUser");
Assert.AreEqual (2, union.UserQuota, "2");
Assert.IsFalse (union.IsUnrestricted (), "IsUnrestricted-2");
Assert.IsTrue (small.IsSubsetOf (union), "IsSubset-2a");
Assert.IsTrue (empty.IsSubsetOf (union), "IsSubset-2b");
Assert.IsTrue (union.IsSubsetOf (small), "IsSubset-2c");
intersect = (IsolatedStorageFilePermission)union.Intersect (small);
Assert.AreEqual (small.UsageAllowed, intersect.UsageAllowed, "Intersect-UsageAllowed-2");
Assert.AreEqual (small.UserQuota, intersect.UserQuota, "Intersect-UserQuota-2");
small.UsageAllowed = IsolatedStorageContainment.ApplicationIsolationByUser;
small.UserQuota = 3;
union = (IsolatedStorageFilePermission)union.Union (small);
Assert.AreEqual (IsolatedStorageContainment.AssemblyIsolationByUser, union.UsageAllowed, "ApplicationIsolationByUser");
Assert.AreEqual (3, union.UserQuota, "3");
Assert.IsFalse (union.IsUnrestricted (), "IsUnrestricted-3");
Assert.IsTrue (small.IsSubsetOf (union), "IsSubset-3a");
Assert.IsTrue (empty.IsSubsetOf (union), "IsSubset-3b");
Assert.IsFalse (union.IsSubsetOf (small), "IsSubset-3c");
intersect = (IsolatedStorageFilePermission)union.Intersect (small);
Assert.AreEqual (small.UsageAllowed, intersect.UsageAllowed, "Intersect-UsageAllowed-3");
Assert.AreEqual (small.UserQuota, intersect.UserQuota, "Intersect-UserQuota-3");
small.UsageAllowed = IsolatedStorageContainment.DomainIsolationByMachine;
small.UserQuota = 4;
union = (IsolatedStorageFilePermission)union.Union (small);
Assert.AreEqual (IsolatedStorageContainment.DomainIsolationByMachine, union.UsageAllowed, "DomainIsolationByMachine");
Assert.AreEqual (4, union.UserQuota, "4");
Assert.IsFalse (union.IsUnrestricted (), "IsUnrestricted-4");
Assert.IsTrue (small.IsSubsetOf (union), "IsSubset-4a");
Assert.IsTrue (empty.IsSubsetOf (union), "IsSubset-4b");
Assert.IsTrue (union.IsSubsetOf (small), "IsSubset-4c");
intersect = (IsolatedStorageFilePermission)union.Intersect (small);
Assert.AreEqual (small.UsageAllowed, intersect.UsageAllowed, "Intersect-UsageAllowed-4");
Assert.AreEqual (small.UserQuota, intersect.UserQuota, "Intersect-UserQuota-4");
small.UsageAllowed = IsolatedStorageContainment.AssemblyIsolationByMachine;
small.UserQuota = 5;
union = (IsolatedStorageFilePermission)union.Union (small);
Assert.AreEqual (IsolatedStorageContainment.AssemblyIsolationByMachine, union.UsageAllowed, "AssemblyIsolationByMachine");
Assert.AreEqual (5, union.UserQuota, "5");
Assert.IsFalse (union.IsUnrestricted (), "IsUnrestricted-5");
Assert.IsTrue (small.IsSubsetOf (union), "IsSubset-5a");
Assert.IsTrue (empty.IsSubsetOf (union), "IsSubset-5b");
Assert.IsTrue (union.IsSubsetOf (small), "IsSubset-5c");
intersect = (IsolatedStorageFilePermission)union.Intersect (small);
Assert.AreEqual (small.UsageAllowed, intersect.UsageAllowed, "Intersect-UsageAllowed-5");
Assert.AreEqual (small.UserQuota, intersect.UserQuota, "Intersect-UserQuota-5");
small.UsageAllowed = IsolatedStorageContainment.ApplicationIsolationByMachine;
small.UserQuota = 6;
union = (IsolatedStorageFilePermission)union.Union (small);
Assert.AreEqual (IsolatedStorageContainment.ApplicationIsolationByMachine, union.UsageAllowed, "ApplicationIsolationByMachine");
Assert.AreEqual (6, union.UserQuota, "6");
Assert.IsFalse (union.IsUnrestricted (), "IsUnrestricted-6");
Assert.IsTrue (small.IsSubsetOf (union), "IsSubset-6a");
Assert.IsTrue (empty.IsSubsetOf (union), "IsSubset-6b");
Assert.IsTrue (union.IsSubsetOf (small), "IsSubset-6c");
intersect = (IsolatedStorageFilePermission)union.Intersect (small);
Assert.AreEqual (small.UsageAllowed, intersect.UsageAllowed, "Intersect-UsageAllowed-6");
Assert.AreEqual (small.UserQuota, intersect.UserQuota, "Intersect-UserQuota-6");
small.UsageAllowed = IsolatedStorageContainment.DomainIsolationByRoamingUser;
small.UserQuota = 7;
union = (IsolatedStorageFilePermission)union.Union (small);
Assert.AreEqual (IsolatedStorageContainment.DomainIsolationByRoamingUser, union.UsageAllowed, "DomainIsolationByRoamingUser");
Assert.AreEqual (7, union.UserQuota, "7a");
Assert.IsFalse (union.IsUnrestricted (), "IsUnrestricted-7a");
Assert.IsTrue (small.IsSubsetOf (union), "IsSubset-7a");
Assert.IsTrue (empty.IsSubsetOf (union), "IsSubset-7b");
Assert.IsTrue (union.IsSubsetOf (small), "IsSubset-7c");
intersect = (IsolatedStorageFilePermission)union.Intersect (small);
Assert.AreEqual (small.UsageAllowed, intersect.UsageAllowed, "Intersect-UsageAllowed-7");
Assert.AreEqual (small.UserQuota, intersect.UserQuota, "Intersect-UserQuota-7");
// can't go back ;-)
small.UsageAllowed = IsolatedStorageContainment.DomainIsolationByUser;
small.UserQuota = 1;
union = (IsolatedStorageFilePermission)union.Union (small);
Assert.AreEqual (IsolatedStorageContainment.DomainIsolationByRoamingUser, union.UsageAllowed, "DomainIsolationByRoamingUser");
Assert.AreEqual (7, union.UserQuota, "7b");
Assert.IsFalse (union.IsUnrestricted (), "IsUnrestricted-7b");
//.........这里部分代码省略.........
开发者ID:Profit0004,项目名称:mono,代码行数:101,代码来源:IsolatedStorageFilePermissionTest.cs
示例17: FromXml_Null
public void FromXml_Null ()
{
IsolatedStorageFilePermission isfp = new IsolatedStorageFilePermission (PermissionState.None);
isfp.FromXml (null);
}
开发者ID:Profit0004,项目名称:mono,代码行数:5,代码来源:IsolatedStorageFilePermissionTest.cs
示例18: BuildLocalIntranet
private static NamedPermissionSet BuildLocalIntranet ()
{
NamedPermissionSet nps = new NamedPermissionSet (ReservedNames.LocalIntranet, PermissionState.None);
nps.AddPermission (new EnvironmentPermission (EnvironmentPermissionAccess.Read, "USERNAME;USER"));
nps.AddPermission (new FileDialogPermission (PermissionState.Unrestricted));
IsolatedStorageFilePermission isfp = new IsolatedStorageFilePermission (PermissionState.None);
isfp.UsageAllowed = IsolatedStorageContainment.AssemblyIsolationByUser;
isfp.UserQuota = Int64.MaxValue;
nps.AddPermission (isfp);
nps.AddPermission (new ReflectionPermission (ReflectionPermissionFlag.ReflectionEmit));
SecurityPermissionFlag spf = SecurityPermissionFlag.Execution | SecurityPermissionFlag.Assertion;
nps.AddPermission (new SecurityPermission (spf));
nps.AddPermission (new UIPermission (PermissionState.Unrestricted));
// DnsPermission requires stuff outside corlib (System)
nps.AddPermission (PermissionBuilder.Create (DnsPermissionClass, PermissionState.Unrestricted));
// PrintingPermission requires stuff outside corlib (System.Drawing)
nps.AddPermission (PermissionBuilder.Create (PrintingPermission ("SafePrinting")));
return nps;
}
开发者ID:jack-pappas,项目名称:mono,代码行数:27,代码来源:DefaultPolicies.cs
示例19: FromXml_WrongTagCase
public void FromXml_WrongTagCase ()
{
IsolatedStorageFilePermission isfp = new IsolatedStorageFilePermission (PermissionState.None);
SecurityElement se = isfp.ToXml ();
se.Tag = "IPERMISSION"; // instead of IPermission
isfp.FromXml (se);
}
开发者ID:Profit0004,项目名称:mono,代码行数:7,代码来源:IsolatedStorageFilePermissionTest.cs
示例20: BuildInternet
private static NamedPermissionSet BuildInternet ()
{
NamedPermissionSet nps = new NamedPermissionSet (ReservedNames.Internet, PermissionState.None);
nps.AddPermission (new FileDialogPermission (FileDialogPermissionAccess.Open));
IsolatedStorageFilePermission isfp = new IsolatedStorageFilePermission (PermissionState.None);
isfp.UsageAllowed = IsolatedStorageContainment.DomainIsolationByUser;
isfp.UserQuota = 512000;
nps.AddPermission (isfp);
nps.AddPermission (new SecurityPermission (SecurityPermissionFlag.Execution));
nps.AddPermission (new UIPermission (UIPermissionWindow.SafeTopLevelWindows, UIPermissionClipboard.OwnClipboard));
// PrintingPermission requires stuff outside corlib (System.Drawing)
nps.AddPermission (PermissionBuilder.Create (PrintingPermission ("SafePrinting")));
return nps;
}
开发者ID:jack-pappas,项目名称:mono,代码行数:18,代码来源:DefaultPolicies.cs
注:本文中的System.Security.Permissions.IsolatedStorageFilePermission类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论