88 lines
3.2 KiB
C#
88 lines
3.2 KiB
C#
using System;
|
|
using System.Runtime.InteropServices;
|
|
|
|
namespace System.Security.Permissions
|
|
{
|
|
/// <summary>Allows security actions for <see cref="T:System.Security.Permissions.FileDialogPermission" /> to be applied to code using declarative security. This class cannot be inherited.</summary>
|
|
// Token: 0x02000543 RID: 1347
|
|
[ComVisible(true)]
|
|
[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Constructor | AttributeTargets.Method, AllowMultiple = true, Inherited = false)]
|
|
[Serializable]
|
|
public sealed class FileDialogPermissionAttribute : CodeAccessSecurityAttribute
|
|
{
|
|
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Permissions.FileDialogPermissionAttribute" /> class with the specified <see cref="T:System.Security.Permissions.SecurityAction" />.</summary>
|
|
/// <param name="action">One of the <see cref="T:System.Security.Permissions.SecurityAction" /> values. </param>
|
|
// Token: 0x0600313E RID: 12606 RVA: 0x000A97E0 File Offset: 0x000A79E0
|
|
public FileDialogPermissionAttribute(SecurityAction action)
|
|
: base(action)
|
|
{
|
|
}
|
|
|
|
/// <summary>Gets or sets a value indicating whether permission to open files through the file dialog is declared.</summary>
|
|
/// <returns>true if permission to open files through the file dialog is declared; otherwise, false.</returns>
|
|
// Token: 0x170009A1 RID: 2465
|
|
// (get) Token: 0x0600313F RID: 12607 RVA: 0x000A97EC File Offset: 0x000A79EC
|
|
// (set) Token: 0x06003140 RID: 12608 RVA: 0x000A97F4 File Offset: 0x000A79F4
|
|
public bool Open
|
|
{
|
|
get
|
|
{
|
|
return this.canOpen;
|
|
}
|
|
set
|
|
{
|
|
this.canOpen = value;
|
|
}
|
|
}
|
|
|
|
/// <summary>Gets or sets a value indicating whether permission to save files through the file dialog is declared.</summary>
|
|
/// <returns>true if permission to save files through the file dialog is declared; otherwise, false.</returns>
|
|
// Token: 0x170009A2 RID: 2466
|
|
// (get) Token: 0x06003141 RID: 12609 RVA: 0x000A9800 File Offset: 0x000A7A00
|
|
// (set) Token: 0x06003142 RID: 12610 RVA: 0x000A9808 File Offset: 0x000A7A08
|
|
public bool Save
|
|
{
|
|
get
|
|
{
|
|
return this.canSave;
|
|
}
|
|
set
|
|
{
|
|
this.canSave = value;
|
|
}
|
|
}
|
|
|
|
/// <summary>Creates and returns a new <see cref="T:System.Security.Permissions.FileDialogPermission" />.</summary>
|
|
/// <returns>A <see cref="T:System.Security.Permissions.FileDialogPermission" /> that corresponds to this attribute.</returns>
|
|
// Token: 0x06003143 RID: 12611 RVA: 0x000A9814 File Offset: 0x000A7A14
|
|
public override IPermission CreatePermission()
|
|
{
|
|
FileDialogPermission fileDialogPermission;
|
|
if (base.Unrestricted)
|
|
{
|
|
fileDialogPermission = new FileDialogPermission(PermissionState.Unrestricted);
|
|
}
|
|
else
|
|
{
|
|
FileDialogPermissionAccess fileDialogPermissionAccess = FileDialogPermissionAccess.None;
|
|
if (this.canOpen)
|
|
{
|
|
fileDialogPermissionAccess |= FileDialogPermissionAccess.Open;
|
|
}
|
|
if (this.canSave)
|
|
{
|
|
fileDialogPermissionAccess |= FileDialogPermissionAccess.Save;
|
|
}
|
|
fileDialogPermission = new FileDialogPermission(fileDialogPermissionAccess);
|
|
}
|
|
return fileDialogPermission;
|
|
}
|
|
|
|
// Token: 0x0400141E RID: 5150
|
|
private bool canOpen;
|
|
|
|
// Token: 0x0400141F RID: 5151
|
|
private bool canSave;
|
|
}
|
|
}
|