当前位置: 首页>>代码示例>>C#>>正文


C# SecurityElement.Attribute方法代码示例

本文整理汇总了C#中System.Security.SecurityElement.Attribute方法的典型用法代码示例。如果您正苦于以下问题:C# SecurityElement.Attribute方法的具体用法?C# SecurityElement.Attribute怎么用?C# SecurityElement.Attribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Security.SecurityElement的用法示例。


在下文中一共展示了SecurityElement.Attribute方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: PrincipalInfo

		public PrincipalInfo(SecurityElement elem)
				{
					name = elem.Attribute("ID");
					role = elem.Attribute("Role");
					String value = elem.Attribute("Authenticated");
					isAuthenticated = (value != null && Boolean.Parse(value));
				}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:7,代码来源:PrincipalPermission.cs

示例2: FromXml

	// Convert an XML value into a permissions value.
	public override void FromXml(SecurityElement esd)
			{
				if(esd == null)
				{
					throw new ArgumentNullException("esd");
				}
				if(esd.Attribute("version") != "1")
				{
					throw new ArgumentException(_("Arg_PermissionVersion"));
				}
				name = esd.Attribute("Name");
				String value = esd.Attribute("Version");
				if(value != null)
				{
					version = new Version(value);
				}
				else
				{
					version = null;
				}
				value = esd.Attribute("PublicKeyBlob");
				if(value != null)
				{
					blob = new StrongNamePublicKeyBlob(value);
				}
				else
				{
					blob = null;
				}
			}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:31,代码来源:StrongNameIdentityPermission.cs

示例3: FromXml

 public override void FromXml(SecurityElement securityElement)
 {
     if (securityElement == null)
     {
         throw new ArgumentNullException("securityElement");
     }
     string str = securityElement.Attribute("class");
     if ((str == null) || (str.IndexOf(base.GetType().FullName, StringComparison.Ordinal) == -1))
     {
         throw new ArgumentException(SecurityResources.GetResourceString("Argument_InvalidClassAttribute"), "securityElement");
     }
     string strA = securityElement.Attribute("Unrestricted");
     if ((strA != null) && (string.Compare(strA, "true", StringComparison.OrdinalIgnoreCase) == 0))
     {
         this.m_flags = DataProtectionPermissionFlags.AllFlags;
     }
     else
     {
         this.m_flags = DataProtectionPermissionFlags.NoFlags;
         string str3 = securityElement.Attribute("Flags");
         if (str3 != null)
         {
             DataProtectionPermissionFlags flags = (DataProtectionPermissionFlags) Enum.Parse(typeof(DataProtectionPermissionFlags), str3);
             VerifyFlags(flags);
             this.m_flags = flags;
         }
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:28,代码来源:DataProtectionPermission.cs

示例4: FromXml

	// 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;
				}
				value = esd.Attribute("Access");
				if(value != null)
				{
					flags = (FileDialogPermissionAccess)
						Enum.Parse(typeof(FileDialogPermissionAccess), value);
				}
				else
				{
					flags = FileDialogPermissionAccess.None;
				}
			}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:32,代码来源:FileDialogPermission.cs

示例5: FromXml

 internal void FromXml(SecurityElement e)
 {
     string strA = e.Attribute("Authenticated");
     if (strA != null)
     {
         this.m_authenticated = string.Compare(strA, "true", StringComparison.OrdinalIgnoreCase) == 0;
     }
     else
     {
         this.m_authenticated = false;
     }
     string str2 = e.Attribute("ID");
     if (str2 != null)
     {
         this.m_id = str2;
     }
     else
     {
         this.m_id = null;
     }
     string str3 = e.Attribute("Role");
     if (str3 != null)
     {
         this.m_role = str3;
     }
     else
     {
         this.m_role = null;
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:30,代码来源:IDRole.cs

示例6: FromXml

 public override void FromXml(SecurityElement securityElement)
 {
     if (securityElement == null)
     {
         throw new ArgumentNullException(SR.GetString("AspNetHostingPermissionBadXml", new object[] { "securityElement" }));
     }
     if (!securityElement.Tag.Equals("IPermission"))
     {
         throw new ArgumentException(SR.GetString("AspNetHostingPermissionBadXml", new object[] { "securityElement" }));
     }
     string str = securityElement.Attribute("class");
     if (str == null)
     {
         throw new ArgumentException(SR.GetString("AspNetHostingPermissionBadXml", new object[] { "securityElement" }));
     }
     if (str.IndexOf(base.GetType().FullName, StringComparison.Ordinal) < 0)
     {
         throw new ArgumentException(SR.GetString("AspNetHostingPermissionBadXml", new object[] { "securityElement" }));
     }
     if (string.Compare(securityElement.Attribute("version"), "1", StringComparison.OrdinalIgnoreCase) != 0)
     {
         throw new ArgumentException(SR.GetString("AspNetHostingPermissionBadXml", new object[] { "version" }));
     }
     string str3 = securityElement.Attribute("Level");
     if (str3 == null)
     {
         this._level = AspNetHostingPermissionLevel.None;
     }
     else
     {
         this._level = (AspNetHostingPermissionLevel) Enum.Parse(typeof(AspNetHostingPermissionLevel), str3);
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:33,代码来源:AspNetHostingPermission.cs

示例7: FromXml

	// Convert an XML element into a permission object.
	public override void FromXml(SecurityElement securityElement)
			{
				String value;
				if(securityElement == null)
				{
					throw new ArgumentNullException("securityElement");
				}
				if(securityElement.Attribute("version") != "1")
				{
					throw new ArgumentException
						(S._("Arg_PermissionVersion"));
				}
				value = securityElement.Attribute("Unrestricted");
				if(value != null && Boolean.Parse(value))
				{
					level = AspNetHostingPermissionLevel.Unrestricted;
				}
				else
				{
					value = securityElement.Attribute("Level");
					if(value != null)
					{
						level = (AspNetHostingPermissionLevel)
							Enum.Parse(typeof(AspNetHostingPermissionLevel),
							           value);
					}
					else
					{
						level = AspNetHostingPermissionLevel.None;
					}
				}
			}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:33,代码来源:AspNetHostingPermission.cs

示例8: FromXml

	// 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(S._("Arg_PermissionVersion"));
				}
				value = esd.Attribute("Unrestricted");
				if(value != null && Boolean.Parse(value))
				{
					state = PermissionState.Unrestricted;
				}
				else
				{
					state = PermissionState.None;
				}
				value = esd.Attribute("Level");
				if(value != null)
				{
					level = (PrintingPermissionLevel)
						Enum.Parse(typeof(PrintingPermissionLevel), value);
				}
				else
				{
					level = PrintingPermissionLevel.NoPrinting;
				}
			}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:32,代码来源:PrintingPermission.cs

示例9: FromXml

 public override void FromXml(SecurityElement esd)
 {
     if (esd == null)
     {
         throw new ArgumentNullException("esd");
     }
     string str = esd.Attribute("class");
     if ((str == null) || (str.IndexOf(base.GetType().FullName) == -1))
     {
         throw new ArgumentException(System.Drawing.SR.GetString("InvalidClassName"));
     }
     string a = esd.Attribute("Unrestricted");
     if ((a != null) && string.Equals(a, "true", StringComparison.OrdinalIgnoreCase))
     {
         this.printingLevel = PrintingPermissionLevel.AllPrinting;
     }
     else
     {
         this.printingLevel = PrintingPermissionLevel.NoPrinting;
         string str3 = esd.Attribute("Level");
         if (str3 != null)
         {
             this.printingLevel = (PrintingPermissionLevel) Enum.Parse(typeof(PrintingPermissionLevel), str3);
         }
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:26,代码来源:PrintingPermission.cs

示例10: FromXml

	// 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;
				}
			}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:58,代码来源:IsolatedStoragePermission.cs

示例11: FromXml

 public void FromXml(SecurityElement element)
 {
     if (element == null)
     {
         throw new ArgumentNullException("element");
     }
     if (string.Compare(element.Tag, "ApplicationTrust", StringComparison.Ordinal) != 0)
     {
         throw new ArgumentException(Environment.GetResourceString("Argument_InvalidXML"));
     }
     this.m_appTrustedToRun = false;
     string strA = element.Attribute("TrustedToRun");
     if ((strA != null) && (string.Compare(strA, "true", StringComparison.Ordinal) == 0))
     {
         this.m_appTrustedToRun = true;
     }
     this.m_persist = false;
     string str2 = element.Attribute("Persist");
     if ((str2 != null) && (string.Compare(str2, "true", StringComparison.Ordinal) == 0))
     {
         this.m_persist = true;
     }
     this.m_appId = null;
     string applicationIdentityFullName = element.Attribute("FullName");
     if ((applicationIdentityFullName != null) && (applicationIdentityFullName.Length > 0))
     {
         this.m_appId = new System.ApplicationIdentity(applicationIdentityFullName);
     }
     this.m_psDefaultGrant = null;
     this.m_grantSetSpecialFlags = 0;
     SecurityElement element2 = element.SearchForChildByTag("DefaultGrant");
     if (element2 != null)
     {
         SecurityElement et = element2.SearchForChildByTag("PolicyStatement");
         if (et != null)
         {
             PolicyStatement statement = new PolicyStatement(null);
             statement.FromXml(et);
             this.m_psDefaultGrant = statement;
             this.m_grantSetSpecialFlags = SecurityManager.GetSpecialFlags(statement.PermissionSet, null);
         }
     }
     List<StrongName> list = new List<StrongName>();
     SecurityElement element4 = element.SearchForChildByTag("FullTrustAssemblies");
     if ((element4 != null) && (element4.InternalChildren != null))
     {
         IEnumerator enumerator = element4.Children.GetEnumerator();
         while (enumerator.MoveNext())
         {
             StrongName item = new StrongName();
             item.FromXml(enumerator.Current as SecurityElement);
             list.Add(item);
         }
     }
     this.m_fullTrustAssemblies = list.AsReadOnly();
     this.m_elExtraInfo = element.SearchForChildByTag("ExtraInfo");
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:57,代码来源:ApplicationTrust.cs

示例12: FromXml

	// Convert an XML value into a permissions value.
	public override void FromXml(SecurityElement esd)
			{
				if(esd == null)
				{
					throw new ArgumentNullException("esd");
				}
				if(esd.Attribute("version") != "1")
				{
					throw new ArgumentException(_("Arg_PermissionVersion"));
				}
				url = esd.Attribute("Url");
			}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:13,代码来源:UrlIdentityPermission.cs

示例13: FromXml

 public override void FromXml(SecurityElement securityElement)
 {
     if (securityElement == null)
     {
         throw new ArgumentNullException("securityElement");
     }
     if (!securityElement.Tag.Equals("IPermission"))
     {
         throw new ArgumentException(SR.GetString("net_not_ipermission"), "securityElement");
     }
     string str = securityElement.Attribute("class");
     if (str == null)
     {
         throw new ArgumentException(SR.GetString("net_no_classname"), "securityElement");
     }
     if (str.IndexOf(base.GetType().FullName) < 0)
     {
         throw new ArgumentException(SR.GetString("net_no_typename"), "securityElement");
     }
     string strA = securityElement.Attribute("Unrestricted");
     if ((strA != null) && (string.Compare(strA, "true", StringComparison.OrdinalIgnoreCase) == 0))
     {
         this.access = SmtpAccess.ConnectToUnrestrictedPort;
         this.unrestricted = true;
     }
     else
     {
         strA = securityElement.Attribute("Access");
         if (strA != null)
         {
             if (string.Compare(strA, "Connect", StringComparison.OrdinalIgnoreCase) == 0)
             {
                 this.access = SmtpAccess.Connect;
             }
             else if (string.Compare(strA, "ConnectToUnrestrictedPort", StringComparison.OrdinalIgnoreCase) == 0)
             {
                 this.access = SmtpAccess.ConnectToUnrestrictedPort;
             }
             else
             {
                 if (string.Compare(strA, "None", StringComparison.OrdinalIgnoreCase) != 0)
                 {
                     throw new ArgumentException(SR.GetString("net_perm_invalid_val_in_element"), "Access");
                 }
                 this.access = SmtpAccess.None;
             }
         }
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:49,代码来源:SmtpPermission.cs

示例14: FromXml

 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;
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:35,代码来源:IsolatedStoragePermission.cs

示例15: CheckSecurityElement

		internal static int CheckSecurityElement (SecurityElement se, string parameterName, int minimumVersion, int maximumVersion) 
		{
			if (se == null)
				throw new ArgumentNullException (parameterName);

			if (se.Tag != "IPermission") {
				string msg = Locale.GetText ("Invalid tag '{0}' expected 'IPermission'.");
				throw new ArgumentException (String.Format (msg, se.Tag), parameterName);
			}

			// we assume minimum version if no version number is supplied
			int version = minimumVersion;
			string v = se.Attribute ("version");
			if (v != null) {
				try {
					version = Int32.Parse (v);
				}
				catch (Exception e) {
					string msg = Locale.GetText ("Couldn't parse version from '{0}'.");
					msg = String.Format (msg, v);
					throw new ArgumentException (msg, parameterName, e);
				}
			}

			if ((version < minimumVersion) || (version > maximumVersion)) {
				string msg = Locale.GetText ("Unknown version '{0}', expected versions between ['{1}','{2}'].");
				msg = String.Format (msg, version, minimumVersion, maximumVersion);
				throw new ArgumentException (msg, parameterName);
			}
			return version;
		}
开发者ID:nlhepler,项目名称:mono,代码行数:31,代码来源:PermissionHelper.cs


注:本文中的System.Security.SecurityElement.Attribute方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。