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


C# Security.SecurityElement类代码示例

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


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


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