• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Security.SecurityElement类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



SecurityElement类属于System.Security命名空间,在下文中一共展示了SecurityElement类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: 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


示例2: 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


示例3: 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


示例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

 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


示例6: ToXml

 private SecurityElement ToXml()
 {
     SecurityElement root = new SecurityElement("System.Xml.XmlSecureResolver");
     root.AddAttribute("version", "1");
     root.AddChild(new SecurityElement("UncDirectory", _uncDir));
     return root;
 }
开发者ID:Corillian,项目名称:corefx,代码行数:7,代码来源:XmlSecureResolver.cs


示例7: getXmlNodeList

        public override ArrayList getXmlNodeList(SecurityElement config, string itemNode)
        {
            ArrayList itemNodeList = new ArrayList();
            UtilXml.getXmlChildList(config, itemNode, ref itemNodeList);

            return itemNodeList;
        }
开发者ID:zhutaorun,项目名称:unitygame,代码行数:7,代码来源:DZDaoJiShiXml.cs


示例8: OnStartElement

        public void OnStartElement(string name, SmallXmlParser.IAttrList attrs)
        {
            SecurityElement newel = new SecurityElement(name);

            if (root == null)
            {
                root = newel;
                current = newel;

            }
            else
            {
                SecurityElement parent = (SecurityElement)stack.Peek();
                parent.AddChild(newel);
            }

            stack.Push(newel);
            current = newel;
            // attributes
            int n = attrs.Length;

            for (int i = 0; i < n; i++)
            {
                string attrName = SecurityElement.Escape(attrs.GetName(i));
                string attrValue = SecurityElement.Escape(attrs.GetValue(i));
                current.AddAttribute(attrName, attrValue);
            }
        }
开发者ID:pjkui,项目名称:behaviac,代码行数:28,代码来源:SecurityParser.cs


示例9: Element

		// snippet moved from FileIOPermission (nickd) to be reused in all derived classes
		internal static SecurityElement Element (Type type, int version) 
		{
			SecurityElement se = new SecurityElement ("IPermission");
			se.AddAttribute ("class", type.FullName + ", " + type.Assembly.ToString ().Replace ('\"', '\''));
			se.AddAttribute ("version", version.ToString ());
			return se;
		}
开发者ID:nlhepler,项目名称:mono,代码行数:8,代码来源:PermissionHelper.cs


示例10: ToXml

 internal SecurityElement ToXml()
 {
     SecurityElement element2;
     SecurityElement element = new SecurityElement("System.Security.Policy.PermissionRequestEvidence");
     element.AddAttribute("version", "1");
     if (this.m_request != null)
     {
         element2 = new SecurityElement("Request");
         element2.AddChild(this.m_request.ToXml());
         element.AddChild(element2);
     }
     if (this.m_optional != null)
     {
         element2 = new SecurityElement("Optional");
         element2.AddChild(this.m_optional.ToXml());
         element.AddChild(element2);
     }
     if (this.m_denied != null)
     {
         element2 = new SecurityElement("Denied");
         element2.AddChild(this.m_denied.ToXml());
         element.AddChild(element2);
     }
     return element;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:25,代码来源:PermissionRequestEvidence.cs


示例11: ToXml

		public SecurityElement ToXml ()
		{
			SecurityElement se = new SecurityElement (tag);
			se.AddAttribute ("class", typeof (MonoTrustManager).AssemblyQualifiedName);
			se.AddAttribute ("version", "1");
			return se;
		}
开发者ID:runefs,项目名称:Marvin,代码行数:7,代码来源:MonoTrustManager.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"));
				}
				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


示例13: 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)
				{
					readList = EnvironmentPermission.SplitPath
						(esd.Attribute("Read"), ';');
					writeList = EnvironmentPermission.SplitPath
						(esd.Attribute("Write"), ';');
					createList = EnvironmentPermission.SplitPath
						(esd.Attribute("Create"), ';');
				}
			}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:31,代码来源:RegistryPermission.cs


示例14: 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


示例15: 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


示例16: 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


示例17: CreatePermissionElement

 internal static SecurityElement CreatePermissionElement(IPermission perm, string permname)
 {
     SecurityElement element = new SecurityElement("IPermission");
     XMLUtil.AddClassAttribute(element, perm.GetType(), permname);
     element.AddAttribute("version", "1");
     return element;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:7,代码来源:CodeAccessPermission.cs


示例18: 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


示例19: 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


示例20: Constructor_SecurityElement_Empty

	public void Constructor_SecurityElement_Empty () 
	{
		// (empty) SecurityElement constructor
		SecurityElement se = new SecurityElement ("xml");
		SignatureDescription sig = new SignatureDescription (se);
		AssertNotNull ("SignatureDescription(SecurityElement)", sig);
	}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:7,代码来源:SignatureDescriptionTest.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# AccessControl.CommonSecurityDescriptor类代码示例发布时间:2022-05-26
下一篇:
C# Security.SecurityContext类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap