using System; using System.Runtime.InteropServices; namespace System.Security.Permissions { /// Represents access to generic isolated storage capabilities. // Token: 0x02000552 RID: 1362 [ComVisible(true)] [Serializable] public abstract class IsolatedStoragePermission : CodeAccessPermission, IUnrestrictedPermission { /// Initializes a new instance of the class with either restricted or unrestricted permission as specified. /// One of the values. /// The parameter is not a valid value of . // Token: 0x060031BA RID: 12730 RVA: 0x000AB058 File Offset: 0x000A9258 protected IsolatedStoragePermission(PermissionState state) { if (CodeAccessPermission.CheckPermissionState(state, true) == PermissionState.Unrestricted) { this.UsageAllowed = IsolatedStorageContainment.UnrestrictedIsolatedStorage; } } /// Gets or sets the quota on the overall size of each user's total store. /// The size, in bytes, of the resource allocated to the user. // Token: 0x170009BA RID: 2490 // (get) Token: 0x060031BB RID: 12731 RVA: 0x000AB078 File Offset: 0x000A9278 // (set) Token: 0x060031BC RID: 12732 RVA: 0x000AB080 File Offset: 0x000A9280 public long UserQuota { get { return this.m_userQuota; } set { this.m_userQuota = value; } } /// Gets or sets the type of isolated storage containment allowed. /// One of the values. // Token: 0x170009BB RID: 2491 // (get) Token: 0x060031BD RID: 12733 RVA: 0x000AB08C File Offset: 0x000A928C // (set) Token: 0x060031BE RID: 12734 RVA: 0x000AB094 File Offset: 0x000A9294 public IsolatedStorageContainment UsageAllowed { get { return this.m_allowed; } set { if (!Enum.IsDefined(typeof(IsolatedStorageContainment), value)) { string text = string.Format(Locale.GetText("Invalid enum {0}"), value); throw new ArgumentException(text, "IsolatedStorageContainment"); } this.m_allowed = value; if (this.m_allowed == IsolatedStorageContainment.UnrestrictedIsolatedStorage) { this.m_userQuota = long.MaxValue; this.m_machineQuota = long.MaxValue; this.m_expirationDays = long.MaxValue; this.m_permanentData = true; } } } /// Returns a value indicating whether the current permission is unrestricted. /// true if the current permission is unrestricted; otherwise, false. // Token: 0x060031BF RID: 12735 RVA: 0x000AB128 File Offset: 0x000A9328 public bool IsUnrestricted() { return IsolatedStorageContainment.UnrestrictedIsolatedStorage == 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: 0x060031C0 RID: 12736 RVA: 0x000AB138 File Offset: 0x000A9338 public override SecurityElement ToXml() { SecurityElement securityElement = base.Element(1); if (this.m_allowed == IsolatedStorageContainment.UnrestrictedIsolatedStorage) { securityElement.AddAttribute("Unrestricted", "true"); } else { securityElement.AddAttribute("Allowed", this.m_allowed.ToString()); if (this.m_userQuota > 0L) { securityElement.AddAttribute("UserQuota", this.m_userQuota.ToString()); } } return securityElement; } /// Reconstructs a permission with a specified state from an XML encoding. /// The XML encoding to use to reconstruct the permission. /// The parameter is null. /// The parameter is not a valid permission element.-or- The parameter's version number is not valid. // Token: 0x060031C1 RID: 12737 RVA: 0x000AB1B4 File Offset: 0x000A93B4 public override void FromXml(SecurityElement esd) { CodeAccessPermission.CheckSecurityElement(esd, "esd", 1, 1); this.m_userQuota = 0L; this.m_machineQuota = 0L; this.m_expirationDays = 0L; this.m_permanentData = false; this.m_allowed = IsolatedStorageContainment.None; if (CodeAccessPermission.IsUnrestricted(esd)) { this.UsageAllowed = IsolatedStorageContainment.UnrestrictedIsolatedStorage; } else { string text = esd.Attribute("Allowed"); if (text != null) { this.UsageAllowed = (IsolatedStorageContainment)((int)Enum.Parse(typeof(IsolatedStorageContainment), text)); } text = esd.Attribute("UserQuota"); if (text != null) { Exception ex; long.Parse(text, true, out this.m_userQuota, out ex); } } } // Token: 0x060031C2 RID: 12738 RVA: 0x000AB260 File Offset: 0x000A9460 internal bool IsEmpty() { return this.m_userQuota == 0L && this.m_allowed == IsolatedStorageContainment.None; } // Token: 0x04001469 RID: 5225 private const int version = 1; // Token: 0x0400146A RID: 5226 internal long m_userQuota; // Token: 0x0400146B RID: 5227 internal long m_machineQuota; // Token: 0x0400146C RID: 5228 internal long m_expirationDays; // Token: 0x0400146D RID: 5229 internal bool m_permanentData; // Token: 0x0400146E RID: 5230 internal IsolatedStorageContainment m_allowed; } }