/// <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);
}