public override void FromXml(SecurityElement esd) { CodeAccessPermission.ValidateElement(esd, this); this.m_allowed = IsolatedStorageContainment.None; if (XMLUtil.IsUnrestricted(esd)) { this.m_allowed = IsolatedStorageContainment.UnrestrictedIsolatedStorage; } else { string str = esd.Attribute("Allowed"); if (str != null) { this.m_allowed = (IsolatedStorageContainment)Enum.Parse(typeof(IsolatedStorageContainment), str); } } if (this.m_allowed == IsolatedStorageContainment.UnrestrictedIsolatedStorage) { this.m_userQuota = 0x7fffffffffffffffL; this.m_machineQuota = 0x7fffffffffffffffL; this.m_expirationDays = 0x7fffffffffffffffL; this.m_permanentData = true; } else { string s = esd.Attribute("UserQuota"); this.m_userQuota = (s != null) ? long.Parse(s, CultureInfo.InvariantCulture) : 0L; s = esd.Attribute("MachineQuota"); this.m_machineQuota = (s != null) ? long.Parse(s, CultureInfo.InvariantCulture) : 0L; s = esd.Attribute("Expiry"); this.m_expirationDays = (s != null) ? long.Parse(s, CultureInfo.InvariantCulture) : 0L; s = esd.Attribute("Permanent"); this.m_permanentData = (s != null) ? bool.Parse(s) : false; } }
internal IsolatedStoragePermission (IsolatedStoragePermissionAttribute copyFrom) { this.state = PermissionState.None; this.userQuota = copyFrom.userQuota; this.usageAllowed = copyFrom.usageAllowed; }
public override void FromXml(SecurityElement esd) { CodeAccessPermission.ValidateElement(esd, this); this.m_allowed = IsolatedStorageContainment.None; if (XMLUtil.IsUnrestricted(esd)) { this.m_allowed = IsolatedStorageContainment.UnrestrictedIsolatedStorage; } else { string str = esd.Attribute("Allowed"); if (str != null) { this.m_allowed = (IsolatedStorageContainment) Enum.Parse(typeof(IsolatedStorageContainment), str); } } if (this.m_allowed == IsolatedStorageContainment.UnrestrictedIsolatedStorage) { this.m_userQuota = 0x7fffffffffffffffL; this.m_machineQuota = 0x7fffffffffffffffL; this.m_expirationDays = 0x7fffffffffffffffL; this.m_permanentData = true; } else { string s = esd.Attribute("UserQuota"); this.m_userQuota = (s != null) ? long.Parse(s, CultureInfo.InvariantCulture) : 0L; s = esd.Attribute("MachineQuota"); this.m_machineQuota = (s != null) ? long.Parse(s, CultureInfo.InvariantCulture) : 0L; s = esd.Attribute("Expiry"); this.m_expirationDays = (s != null) ? long.Parse(s, CultureInfo.InvariantCulture) : 0L; s = esd.Attribute("Permanent"); this.m_permanentData = (s != null) ? bool.Parse(s) : false; } }
public override void FromXml(SecurityElement esd) { // General validation in CodeAccessPermission CheckSecurityElement(esd, "esd", version, version); // Note: we do not (yet) care about the return value // as we only accept version 1 (min/max values) m_userQuota = 0; m_machineQuota = 0; m_expirationDays = 0; m_permanentData = false; m_allowed = IsolatedStorageContainment.None; if (IsUnrestricted(esd)) { UsageAllowed = IsolatedStorageContainment.UnrestrictedIsolatedStorage; } else { string a = esd.Attribute("Allowed"); if (a != null) { UsageAllowed = (IsolatedStorageContainment)Enum.Parse( typeof(IsolatedStorageContainment), a); } a = esd.Attribute("UserQuota"); if (a != null) { Exception exc; Int64.Parse(a, true, out m_userQuota, out exc); } } }
/// <summary>Reconstructs a permission with a specified state from an XML encoding.</summary> /// <param name="esd">The XML encoding to use to reconstruct the permission. </param> /// <exception cref="T:System.ArgumentNullException">The <paramref name="esd" /> parameter is null. </exception> /// <exception cref="T:System.ArgumentException">The <paramref name="esd" /> parameter is not a valid permission element.-or- The <paramref name="esd" /> parameter's version number is not valid. </exception> 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); } } }
internal IsolatedStoragePermission(IsolatedStorageContainment UsageAllowed, long ExpirationDays, bool PermanentData, long UserQuota) { this.m_machineQuota = 0L; this.m_userQuota = UserQuota; this.m_expirationDays = ExpirationDays; this.m_permanentData = PermanentData; this.m_allowed = UsageAllowed; }
// Token: 0x06002521 RID: 9505 RVA: 0x000872E5 File Offset: 0x000854E5 internal IsolatedStoragePermission(IsolatedStorageContainment UsageAllowed, long ExpirationDays, bool PermanentData, long UserQuota) { this.m_machineQuota = 0L; this.m_userQuota = UserQuota; this.m_expirationDays = ExpirationDays; this.m_permanentData = PermanentData; this.m_allowed = UsageAllowed; }
// Convert an XML value into a permissions value. public override void FromXml(SecurityElement esd) { String value; if (esd == null) { throw new ArgumentNullException("esd"); } if (esd.Attribute("version") != "1") { throw new ArgumentException(_("Arg_PermissionVersion")); } value = esd.Attribute("Unrestricted"); if (value != null && Boolean.Parse(value)) { state = PermissionState.Unrestricted; } else { state = PermissionState.None; } if (state != PermissionState.Unrestricted) { value = esd.Attribute("Allowed"); if (value != null) { usageAllowed = (IsolatedStorageContainment) Enum.Parse(typeof(IsolatedStorageContainment), value); } else { usageAllowed = IsolatedStorageContainment.None; } } else { usageAllowed = IsolatedStorageContainment.UnrestrictedIsolatedStorage; } if (usageAllowed != IsolatedStorageContainment.UnrestrictedIsolatedStorage) { value = esd.Attribute("UserQuota"); if (value != null) { userQuota = Int64.Parse(value); } else { userQuota = 0; } } else { userQuota = Int64.MaxValue; } }
internal IsolatedStoragePermission(IsolatedStorageContainment UsageAllowed, long ExpirationDays, bool PermanentData) { m_userQuota = 0; // typical demand won't include quota m_machineQuota = 0; // typical demand won't include quota m_expirationDays = ExpirationDays; m_permanentData = PermanentData; m_allowed = UsageAllowed; }
public override void FromXml(SecurityElement esd) { CodeAccessPermission.ValidateElement(esd, this); m_allowed = IsolatedStorageContainment.None; // default if no match if (XMLUtil.IsUnrestricted(esd)) { m_allowed = IsolatedStorageContainment.UnrestrictedIsolatedStorage; } else { String allowed = esd.Attribute("Allowed"); if (allowed != null) { m_allowed = (IsolatedStorageContainment)Enum.Parse(typeof(IsolatedStorageContainment), allowed); } } if (m_allowed == IsolatedStorageContainment.UnrestrictedIsolatedStorage) { m_userQuota = Int64.MaxValue; m_machineQuota = Int64.MaxValue; m_expirationDays = Int64.MaxValue; m_permanentData = true; } else { String param; param = esd.Attribute(_strUserQuota); m_userQuota = param != null?Int64.Parse(param, CultureInfo.InvariantCulture) : 0; param = esd.Attribute(_strMachineQuota); m_machineQuota = param != null?Int64.Parse(param, CultureInfo.InvariantCulture) : 0; param = esd.Attribute(_strExpiry); m_expirationDays = param != null?Int64.Parse(param, CultureInfo.InvariantCulture) : 0; param = esd.Attribute(_strPermDat); m_permanentData = param != null ? (Boolean.Parse(param)) : false; } }
// Constructors. public IsolatedStoragePermission(PermissionState state) { if(state != PermissionState.Unrestricted && state != PermissionState.None) { throw new ArgumentException(_("Arg_PermissionState")); } this.state = state; if(state == PermissionState.Unrestricted) { userQuota = Int64.MaxValue; usageAllowed = IsolatedStorageContainment.UnrestrictedIsolatedStorage; } else { userQuota = 0; usageAllowed = IsolatedStorageContainment.None; } }
// Constructors. public IsolatedStoragePermission(PermissionState state) { if (state != PermissionState.Unrestricted && state != PermissionState.None) { throw new ArgumentException(_("Arg_PermissionState")); } this.state = state; if (state == PermissionState.Unrestricted) { userQuota = Int64.MaxValue; usageAllowed = IsolatedStorageContainment.UnrestrictedIsolatedStorage; } else { userQuota = 0; usageAllowed = IsolatedStorageContainment.None; } }
/// <summary>从 XML 编码重新构造具有指定状态的权限。</summary> /// <param name="esd">用于重新构造权限的 XML 编码。</param> /// <exception cref="T:System.ArgumentNullException"> /// <paramref name="esd" /> 参数为 null。</exception> /// <exception cref="T:System.ArgumentException"> /// <paramref name="esd" /> 参数不是有效的权限元素。- 或 -<paramref name="esd" /> 参数的版本号无效。</exception> public override void FromXml(SecurityElement esd) { CodeAccessPermission.ValidateElement(esd, (IPermission)this); this.m_allowed = IsolatedStorageContainment.None; if (XMLUtil.IsUnrestricted(esd)) { this.m_allowed = IsolatedStorageContainment.UnrestrictedIsolatedStorage; } else { string str = esd.Attribute("Allowed"); if (str != null) { this.m_allowed = (IsolatedStorageContainment)Enum.Parse(typeof(IsolatedStorageContainment), str); } } 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; } else { string s1 = esd.Attribute("UserQuota"); this.m_userQuota = s1 != null?long.Parse(s1, (IFormatProvider)CultureInfo.InvariantCulture) : 0L; string s2 = esd.Attribute("MachineQuota"); this.m_machineQuota = s2 != null?long.Parse(s2, (IFormatProvider)CultureInfo.InvariantCulture) : 0L; string s3 = esd.Attribute("Expiry"); this.m_expirationDays = s3 != null?long.Parse(s3, (IFormatProvider)CultureInfo.InvariantCulture) : 0L; string str = esd.Attribute("Permanent"); this.m_permanentData = str != null && bool.Parse(str); } }
protected IsolatedStoragePermission(PermissionState state) { if (state == PermissionState.Unrestricted) { this.m_userQuota = 0x7fffffffffffffffL; this.m_machineQuota = 0x7fffffffffffffffL; this.m_expirationDays = 0x7fffffffffffffffL; this.m_permanentData = true; this.m_allowed = IsolatedStorageContainment.UnrestrictedIsolatedStorage; } else { if (state != PermissionState.None) { throw new ArgumentException(Environment.GetResourceString("Argument_InvalidPermissionState")); } this.m_userQuota = 0L; this.m_machineQuota = 0L; this.m_expirationDays = 0L; this.m_permanentData = false; this.m_allowed = IsolatedStorageContainment.None; } }
//------------------------------------------------------ // // CONSTRUCTORS // //------------------------------------------------------ protected IsolatedStoragePermission(PermissionState state) { if (state == PermissionState.Unrestricted) { m_userQuota = Int64.MaxValue; m_machineQuota = Int64.MaxValue; m_expirationDays = Int64.MaxValue; m_permanentData = true; m_allowed = IsolatedStorageContainment.UnrestrictedIsolatedStorage; } else if (state == PermissionState.None) { m_userQuota = 0; m_machineQuota = 0; m_expirationDays = 0; m_permanentData = false; m_allowed = IsolatedStorageContainment.None; } else { throw new ArgumentException(Environment.GetResourceString("Argument_InvalidPermissionState")); } }
public override void FromXml(SecurityElement esd) { CodeAccessPermission.ValidateElement( esd, this ); m_allowed = IsolatedStorageContainment.None; // default if no match if (XMLUtil.IsUnrestricted(esd)) { m_allowed = IsolatedStorageContainment.UnrestrictedIsolatedStorage; } else { String allowed = esd.Attribute( "Allowed" ); if (allowed != null) m_allowed = (IsolatedStorageContainment)Enum.Parse( typeof( IsolatedStorageContainment ), allowed ); } if (m_allowed == IsolatedStorageContainment.UnrestrictedIsolatedStorage) { m_userQuota = Int64.MaxValue; m_machineQuota = Int64.MaxValue; m_expirationDays = Int64.MaxValue ; m_permanentData = true; } else { String param; param = esd.Attribute (_strUserQuota) ; m_userQuota = param != null ? Int64.Parse(param, CultureInfo.InvariantCulture) : 0 ; param = esd.Attribute (_strMachineQuota) ; m_machineQuota = param != null ? Int64.Parse(param, CultureInfo.InvariantCulture) : 0 ; param = esd.Attribute (_strExpiry) ; m_expirationDays = param != null ? Int64.Parse(param, CultureInfo.InvariantCulture) : 0 ; param = esd.Attribute (_strPermDat) ; m_permanentData = param != null ? (Boolean.Parse(param)) : false ; } }
/// <include file='doc\IsolatedStorageFilePermission.uex' path='docs/doc[@for="IsolatedStorageFilePermission.IsolatedStorageFilePermission2"]/*' /> internal IsolatedStorageFilePermission(IsolatedStorageContainment UsageAllowed, long ExpirationDays, bool PermanentData, long UserQuota) : base(UsageAllowed, ExpirationDays, PermanentData, UserQuota) { }
internal IsolatedStoragePermission(IsolatedStoragePermission copyFrom) { this.state = copyFrom.state; this.userQuota = copyFrom.userQuota; this.usageAllowed = copyFrom.usageAllowed; }
// Convert an XML value into a permissions value. public override void FromXml(SecurityElement esd) { String value; if(esd == null) { throw new ArgumentNullException("esd"); } if(esd.Attribute("version") != "1") { throw new ArgumentException(_("Arg_PermissionVersion")); } value = esd.Attribute("Unrestricted"); if(value != null && Boolean.Parse(value)) { state = PermissionState.Unrestricted; } else { state = PermissionState.None; } if(state != PermissionState.Unrestricted) { value = esd.Attribute("Allowed"); if(value != null) { usageAllowed = (IsolatedStorageContainment) Enum.Parse(typeof(IsolatedStorageContainment), value); } else { usageAllowed = IsolatedStorageContainment.None; } } else { usageAllowed = IsolatedStorageContainment.UnrestrictedIsolatedStorage; } if(usageAllowed != IsolatedStorageContainment.UnrestrictedIsolatedStorage) { value = esd.Attribute("UserQuota"); if(value != null) { userQuota = Int64.Parse(value); } else { userQuota = 0; } } else { userQuota = Int64.MaxValue; } }
//------------------------------------------------------ // // PUBLIC CONSTRUCTORS // //------------------------------------------------------ /// <include file='doc\IsolatedStoragePermission.uex' path='docs/doc[@for="IsolatedStoragePermission.IsolatedStoragePermission"]/*' /> public IsolatedStoragePermission(PermissionState state) { if (state == PermissionState.Unrestricted) { m_userQuota = Int64.MaxValue; m_machineQuota = Int64.MaxValue; m_expirationDays = Int64.MaxValue ; m_permanentData = true; m_allowed = IsolatedStorageContainment.UnrestrictedIsolatedStorage; } else if (state == PermissionState.None) { m_userQuota = 0; m_machineQuota = 0; m_expirationDays = 0; m_permanentData = false; m_allowed = IsolatedStorageContainment.None; } else { throw new ArgumentException(Environment.GetResourceString("Argument_InvalidPermissionState")); } }
internal IsolatedStorageFilePermission(IsolatedStorageContainment UsageAllowed, long ExpirationDays, bool PermanentData) : base(UsageAllowed, ExpirationDays, PermanentData) { }
public override void FromXml (SecurityElement esd) { // General validation in CodeAccessPermission CheckSecurityElement (esd, "esd", version, version); // Note: we do not (yet) care about the return value // as we only accept version 1 (min/max values) m_userQuota = 0; m_machineQuota = 0; m_expirationDays = 0; m_permanentData = false; m_allowed = IsolatedStorageContainment.None; if (IsUnrestricted (esd)) { UsageAllowed = IsolatedStorageContainment.UnrestrictedIsolatedStorage; } else { string a = esd.Attribute ("Allowed"); if (a != null) { UsageAllowed = (IsolatedStorageContainment) Enum.Parse ( typeof (IsolatedStorageContainment), a); } a = esd.Attribute ("UserQuota"); if (a != null) { m_userQuota = Int64.Parse (a, CultureInfo.InvariantCulture); } } }