using System;
using System.Runtime.InteropServices;
namespace System.Security.Permissions
{
/// Specifies the allowed usage of a private virtual file system. This class cannot be inherited.
// Token: 0x02000550 RID: 1360
[ComVisible(true)]
[Serializable]
public sealed class IsolatedStorageFilePermission : IsolatedStoragePermission, IBuiltInPermission
{
/// Initializes a new instance of the class with either fully restricted or unrestricted permission as specified.
/// One of the values.
/// The parameter is not a valid value of .
// Token: 0x060031B0 RID: 12720 RVA: 0x000AACF8 File Offset: 0x000A8EF8
public IsolatedStorageFilePermission(PermissionState state)
: base(state)
{
}
// Token: 0x060031B1 RID: 12721 RVA: 0x000AAD04 File Offset: 0x000A8F04
int IBuiltInPermission.GetTokenIndex()
{
return 3;
}
/// Creates and returns an identical copy of the current permission.
/// A copy of the current permission.
// Token: 0x060031B2 RID: 12722 RVA: 0x000AAD08 File Offset: 0x000A8F08
public override IPermission Copy()
{
return new IsolatedStorageFilePermission(PermissionState.None)
{
m_userQuota = this.m_userQuota,
m_machineQuota = this.m_machineQuota,
m_expirationDays = this.m_expirationDays,
m_permanentData = this.m_permanentData,
m_allowed = this.m_allowed
};
}
/// Creates and returns a permission that is the intersection of the current permission and the specified permission.
/// A new permission that represents the intersection of the current permission and the specified permission. This new permission is null if the intersection is empty.
/// A permission to intersect with the current permission object. It must be of the same type as the current permission.
/// The parameter is not null and is not of the same type as the current permission.
// Token: 0x060031B3 RID: 12723 RVA: 0x000AAD5C File Offset: 0x000A8F5C
public override IPermission Intersect(IPermission target)
{
IsolatedStorageFilePermission isolatedStorageFilePermission = this.Cast(target);
if (isolatedStorageFilePermission == null)
{
return null;
}
if (base.IsEmpty() && isolatedStorageFilePermission.IsEmpty())
{
return null;
}
return new IsolatedStorageFilePermission(PermissionState.None)
{
m_userQuota = ((this.m_userQuota >= isolatedStorageFilePermission.m_userQuota) ? isolatedStorageFilePermission.m_userQuota : this.m_userQuota),
m_machineQuota = ((this.m_machineQuota >= isolatedStorageFilePermission.m_machineQuota) ? isolatedStorageFilePermission.m_machineQuota : this.m_machineQuota),
m_expirationDays = ((this.m_expirationDays >= isolatedStorageFilePermission.m_expirationDays) ? isolatedStorageFilePermission.m_expirationDays : this.m_expirationDays),
m_permanentData = (this.m_permanentData && isolatedStorageFilePermission.m_permanentData),
UsageAllowed = ((this.m_allowed >= isolatedStorageFilePermission.m_allowed) ? isolatedStorageFilePermission.m_allowed : this.m_allowed)
};
}
/// Determines whether the current permission is a subset of the specified permission.
/// true if the current permission is a subset of the specified permission; otherwise, false.
/// A permission that is to be tested for the subset relationship. This permission must be of the same type as the current permission.
/// The parameter is not null and is not of the same type as the current permission.
// Token: 0x060031B4 RID: 12724 RVA: 0x000AAE54 File Offset: 0x000A9054
public override bool IsSubsetOf(IPermission target)
{
IsolatedStorageFilePermission isolatedStorageFilePermission = this.Cast(target);
if (isolatedStorageFilePermission == null)
{
return base.IsEmpty();
}
return isolatedStorageFilePermission.IsUnrestricted() || (this.m_userQuota <= isolatedStorageFilePermission.m_userQuota && this.m_machineQuota <= isolatedStorageFilePermission.m_machineQuota && this.m_expirationDays <= isolatedStorageFilePermission.m_expirationDays && this.m_permanentData == isolatedStorageFilePermission.m_permanentData && this.m_allowed <= isolatedStorageFilePermission.m_allowed);
}
/// Creates a permission that is the union of the current permission and the specified permission.
/// A new permission that represents the union of the current permission and the specified permission.
/// A permission to combine with the current permission. It must be of the same type as the current permission.
/// The parameter is not null and is not of the same type as the current permission.
// Token: 0x060031B5 RID: 12725 RVA: 0x000AAEE4 File Offset: 0x000A90E4
public override IPermission Union(IPermission target)
{
IsolatedStorageFilePermission isolatedStorageFilePermission = this.Cast(target);
if (isolatedStorageFilePermission == null)
{
return this.Copy();
}
return new IsolatedStorageFilePermission(PermissionState.None)
{
m_userQuota = ((this.m_userQuota <= isolatedStorageFilePermission.m_userQuota) ? isolatedStorageFilePermission.m_userQuota : this.m_userQuota),
m_machineQuota = ((this.m_machineQuota <= isolatedStorageFilePermission.m_machineQuota) ? isolatedStorageFilePermission.m_machineQuota : this.m_machineQuota),
m_expirationDays = ((this.m_expirationDays <= isolatedStorageFilePermission.m_expirationDays) ? isolatedStorageFilePermission.m_expirationDays : this.m_expirationDays),
m_permanentData = (this.m_permanentData || isolatedStorageFilePermission.m_permanentData),
UsageAllowed = ((this.m_allowed <= isolatedStorageFilePermission.m_allowed) ? isolatedStorageFilePermission.m_allowed : this.m_allowed)
};
}
/// Creates an XML encoding of the permission and its current state.
/// An XML encoding of the permission, including any state information.
// Token: 0x060031B6 RID: 12726 RVA: 0x000AAFC8 File Offset: 0x000A91C8
[MonoTODO("(2.0) new override - something must have been added ???")]
[ComVisible(false)]
public override SecurityElement ToXml()
{
return base.ToXml();
}
// Token: 0x060031B7 RID: 12727 RVA: 0x000AAFD0 File Offset: 0x000A91D0
private IsolatedStorageFilePermission Cast(IPermission target)
{
if (target == null)
{
return null;
}
IsolatedStorageFilePermission isolatedStorageFilePermission = target as IsolatedStorageFilePermission;
if (isolatedStorageFilePermission == null)
{
CodeAccessPermission.ThrowInvalidPermission(target, typeof(IsolatedStorageFilePermission));
}
return isolatedStorageFilePermission;
}
// Token: 0x04001468 RID: 5224
private const int version = 1;
}
}