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


C# SecurityElement.SearchForChildByTag方法代码示例

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


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

示例1: GetNamedParam

 private byte[] GetNamedParam(SecurityElement se, string param)
 {
     SecurityElement sep = se.SearchForChildByTag(param);
     if (sep == null)
         return null;
     return Convert.FromBase64String(sep.Text);
 }
开发者ID:Fedorm,项目名称:core-master,代码行数:7,代码来源:DiffieHellman.cs

示例2: SignatureDescription

	/// LAMESPEC: ArgumentNullException is thrown (not CryptographicException)
	public SignatureDescription (SecurityElement el) 
	{
		if (el == null)
			throw new ArgumentNullException ("el");

		// thanksfully documented in VS.NET 2005
		SecurityElement child = el.SearchForChildByTag ("Deformatter");
		_DeformatterAlgorithm = ((child == null) ? null : child.Text);

		child = el.SearchForChildByTag ("Digest");
		_DigestAlgorithm = ((child == null) ? null : child.Text);

		child = el.SearchForChildByTag ("Formatter");
		_FormatterAlgorithm = ((child == null) ? null : child.Text);

		child = el.SearchForChildByTag ("Key");
		_KeyAlgorithm = ((child == null) ? null : child.Text);
	}
开发者ID:jack-pappas,项目名称:mono,代码行数:19,代码来源:SignatureDescription.cs

示例3: ParseXml

        protected override void ParseXml( SecurityElement e, PolicyLevel level )
        {
            //Reset the exiting content
            ResetConnectAccess();

            SecurityElement et = e.SearchForChildByTag("connectAccessRules");

            if (et == null || et.Children == null)
            {
                SetDefaults();
                return;
            }

            foreach(SecurityElement codeOriginElem in et.Children)
            {
                if (codeOriginElem.Tag.Equals("codeOrigin"))
                {
                    string originScheme = codeOriginElem.Attribute("scheme");
                    bool oneAdded = false;

                    if (codeOriginElem.Children != null)
                    {
                        foreach(SecurityElement accessElem in codeOriginElem.Children)
                        {
                            if (accessElem.Tag.Equals("connectAccess"))
                            {
                                string connectScheme = accessElem.Attribute("scheme");
                                string connectPort   = accessElem.Attribute("port");
                                AddConnectAccess(originScheme, new CodeConnectAccess(connectScheme, connectPort));
                                oneAdded = true;
                            }
                            else {
                                // improper tag found, just ignore
                            }
                        }
                    }

                    if (!oneAdded)
                    {
                        //special case as to no talkback access for a given scheme
                        AddConnectAccess(originScheme, null);
                    }

                }
                else {
                    // improper tag found, just ignore
                }
            }
        }
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:49,代码来源:netcodegroup.cs

示例4: FromXml

        public override void FromXml(SecurityElement securityElement)
        {
            string str3;
            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");
            this.m_connectList = new ArrayList();
            this.m_acceptList = new ArrayList();
            this.m_UnrestrictedAccept = this.m_UnrestrictedConnect = false;
            if ((strA != null) && (string.Compare(strA, "true", StringComparison.OrdinalIgnoreCase) == 0))
            {
                this.m_noRestriction = true;
                return;
            }
            this.m_noRestriction = false;
            SecurityElement element = securityElement.SearchForChildByTag("ConnectAccess");
            if (element != null)
            {
                foreach (SecurityElement element2 in element.Children)
                {
                    if (element2.Tag.Equals("URI"))
                    {
                        try
                        {
                            str3 = element2.Attribute("uri");
                        }
                        catch
                        {
                            str3 = null;
                        }
                        switch (str3)
                        {
                            case null:
                                throw new ArgumentException(SR.GetString("net_perm_invalid_val_in_element"), "ConnectAccess");

                            case ".*":
                                this.m_UnrestrictedConnect = true;
                                this.m_connectList = new ArrayList();
                                goto Label_0196;
                        }
                        this.AddAsPattern(NetworkAccess.Connect, new DelayedRegex(str3));
                    }
                }
            }
        Label_0196:
            element = securityElement.SearchForChildByTag("AcceptAccess");
            if (element != null)
            {
                foreach (SecurityElement element3 in element.Children)
                {
                    if (element3.Tag.Equals("URI"))
                    {
                        try
                        {
                            str3 = element3.Attribute("uri");
                        }
                        catch
                        {
                            str3 = null;
                        }
                        switch (str3)
                        {
                            case null:
                                throw new ArgumentException(SR.GetString("net_perm_invalid_val_in_element"), "AcceptAccess");

                            case ".*":
                                this.m_UnrestrictedAccept = true;
                                this.m_acceptList = new ArrayList();
                                return;
                        }
                        this.AddAsPattern(NetworkAccess.Accept, new DelayedRegex(str3));
                    }
                }
            }
        }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:90,代码来源:WebPermission.cs

示例5: 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;
				}
				acceptList.Clear();
				connectList.Clear();
				if(state != PermissionState.Unrestricted)
				{
					SecurityElement child;
					String str;
					child = esd.SearchForChildByTag("ConnectAccess");
					if(child != null && child.Children != null)
					{
						foreach(SecurityElement uri1 in child.Children)
						{
							if(uri1.Tag != "URI")
							{
								continue;
							}
							str = uri1.Attribute("uri");
							if(!IsRegex(str))
							{
								connectList.Add(RegexUnescape(str));
							}
						#if !ECMA_COMPAT
							else
							{
								connectList.Add(new Regex(str));
							}
						#endif
						}
					}
					child = esd.SearchForChildByTag("AcceptAccess");
					if(child != null && child.Children != null)
					{
						foreach(SecurityElement uri1 in child.Children)
						{
							if(uri1.Tag != "URI")
							{
								continue;
							}
							str = uri1.Attribute("uri");
							if(!IsRegex(str))
							{
								acceptList.Add(RegexUnescape(str));
							}
						#if !ECMA_COMPAT
							else
							{
								acceptList.Add(new Regex(str));
							}
						#endif
						}
					}
				}
			}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:73,代码来源:WebPermission.cs

示例6: FromXml

 internal void FromXml(SecurityElement et, PolicyLevel level, bool allowInternalOnly)
 {
     if (et == null)
     {
         throw new ArgumentNullException("et");
     }
     if (!et.Tag.Equals("PolicyStatement"))
     {
         throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, Environment.GetResourceString("Argument_InvalidXMLElement"), new object[] { "PolicyStatement", base.GetType().FullName }));
     }
     this.m_attributes = PolicyStatementAttribute.Nothing;
     string str = et.Attribute("Attributes");
     if (str != null)
     {
         this.m_attributes = (PolicyStatementAttribute) Enum.Parse(typeof(PolicyStatementAttribute), str);
     }
     lock (this)
     {
         this.m_permSet = null;
         if (level != null)
         {
             string name = et.Attribute("PermissionSetName");
             if (name != null)
             {
                 this.m_permSet = level.GetNamedPermissionSetInternal(name);
                 if (this.m_permSet == null)
                 {
                     this.m_permSet = new System.Security.PermissionSet(PermissionState.None);
                 }
             }
         }
         if (this.m_permSet == null)
         {
             SecurityElement element = et.SearchForChildByTag("PermissionSet");
             if (element == null)
             {
                 throw new ArgumentException(Environment.GetResourceString("Argument_InvalidXML"));
             }
             string str3 = element.Attribute("class");
             if ((str3 != null) && (str3.Equals("NamedPermissionSet") || str3.Equals("System.Security.NamedPermissionSet")))
             {
                 this.m_permSet = new NamedPermissionSet("DefaultName", PermissionState.None);
             }
             else
             {
                 this.m_permSet = new System.Security.PermissionSet(PermissionState.None);
             }
             try
             {
                 this.m_permSet.FromXml(element, allowInternalOnly, true);
             }
             catch
             {
             }
         }
         if (this.m_permSet == null)
         {
             this.m_permSet = new System.Security.PermissionSet(PermissionState.None);
         }
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:61,代码来源:PolicyStatement.cs

示例7: FromXml

        [System.Security.SecurityCritical]  // auto-generated
        internal void FromXml( SecurityElement et, PolicyLevel level, bool allowInternalOnly )
        {
            if (et == null)
                throw new ArgumentNullException( "et" );

            if (!et.Tag.Equals( "PolicyStatement" ))
                throw new ArgumentException( String.Format( CultureInfo.CurrentCulture, Environment.GetResourceString( "Argument_InvalidXMLElement" ),  "PolicyStatement", this.GetType().FullName ) );
            Contract.EndContractBlock();
        
            m_attributes = (PolicyStatementAttribute) 0;

            String strAttributes = et.Attribute( "Attributes" );

            if (strAttributes != null)
                m_attributes = (PolicyStatementAttribute)Enum.Parse( typeof( PolicyStatementAttribute ), strAttributes );

            lock (this)
            {
                m_permSet = null;

                if (level != null)
                {
                    String permSetName = et.Attribute( "PermissionSetName" );
    
                    if (permSetName != null)
                    {
                        m_permSet = level.GetNamedPermissionSetInternal( permSetName );

                        if (m_permSet == null)
                            m_permSet = new PermissionSet( PermissionState.None );
                    }
                }


                if (m_permSet == null)
                {
                    // There is no provided level, it is not a named permission set, or
                    // the named permission set doesn't exist in the provided level,
                    // so just create the class through reflection and decode normally.
        
                    SecurityElement e = et.SearchForChildByTag( "PermissionSet" );

                    if (e != null)
                    {
                        String className = e.Attribute( "class" );

                        if (className != null && (className.Equals( "NamedPermissionSet" ) ||
                                                  className.Equals( "System.Security.NamedPermissionSet" )))
                            m_permSet = new NamedPermissionSet( "DefaultName", PermissionState.None );
                        else
                            m_permSet = new PermissionSet( PermissionState.None );
                
                        try
                        {
                            m_permSet.FromXml( e, allowInternalOnly, true );
                        }
                        catch
                        {
                            // ignore any exceptions from the decode process.
                            // Note: we go ahead and use the permission set anyway.  This should be safe since
                            // the decode process should never give permission beyond what a proper decode would have
                            // given.
                        }
                    }
                    else
                    {
                        throw new ArgumentException( Environment.GetResourceString( "Argument_InvalidXML" ) );
                    }
                }

                if (m_permSet == null) 
                    m_permSet = new PermissionSet( PermissionState.None );
            }    
        }
开发者ID:uQr,项目名称:referencesource,代码行数:75,代码来源:policystatement.cs

示例8: FromXml

 public void FromXml(SecurityElement e)
 {
     if (e == null)
     {
         throw new ArgumentNullException("e");
     }
     lock (this)
     {
         Hashtable hashtable;
         ArrayList list = new ArrayList();
         SecurityElement element = e.SearchForChildByTag("SecurityClasses");
         if (element != null)
         {
             hashtable = new Hashtable();
             IEnumerator enumerator = element.Children.GetEnumerator();
             while (enumerator.MoveNext())
             {
                 SecurityElement current = (SecurityElement) enumerator.Current;
                 if (current.Tag.Equals("SecurityClass"))
                 {
                     string key = current.Attribute("Name");
                     string str2 = current.Attribute("Description");
                     if ((key != null) && (str2 != null))
                     {
                         hashtable.Add(key, str2);
                     }
                 }
             }
         }
         else
         {
             hashtable = null;
         }
         SecurityElement element3 = e.SearchForChildByTag("FullTrustAssemblies");
         if ((element3 != null) && (element3.InternalChildren != null))
         {
             string assemblyQualifiedName = typeof(StrongNameMembershipCondition).AssemblyQualifiedName;
             IEnumerator enumerator2 = element3.Children.GetEnumerator();
             while (enumerator2.MoveNext())
             {
                 StrongNameMembershipCondition condition = new StrongNameMembershipCondition();
                 condition.FromXml((SecurityElement) enumerator2.Current);
                 list.Add(condition);
             }
         }
         this.m_fullTrustAssemblies = list;
         ArrayList list2 = new ArrayList();
         SecurityElement elem = e.SearchForChildByTag("NamedPermissionSets");
         SecurityElement element5 = null;
         if ((elem != null) && (elem.InternalChildren != null))
         {
             element5 = this.UnnormalizeClassDeep(elem, hashtable);
             foreach (string str3 in s_reservedNamedPermissionSets)
             {
                 this.FindElement(element5, str3);
             }
         }
         if (element5 == null)
         {
             element5 = new SecurityElement("NamedPermissionSets");
         }
         list2.Add(BuiltInPermissionSets.FullTrust);
         list2.Add(BuiltInPermissionSets.Everything);
         list2.Add(BuiltInPermissionSets.SkipVerification);
         list2.Add(BuiltInPermissionSets.Execution);
         list2.Add(BuiltInPermissionSets.Nothing);
         list2.Add(BuiltInPermissionSets.Internet);
         list2.Add(BuiltInPermissionSets.LocalIntranet);
         foreach (PermissionSet set in list2)
         {
             set.IgnoreTypeLoadFailures = true;
         }
         this.m_namedPermissionSets = list2;
         this.m_permSetElement = element5;
         SecurityElement element6 = e.SearchForChildByTag("CodeGroup");
         if (element6 == null)
         {
             throw new ArgumentException(Environment.GetResourceString("Argument_InvalidXMLElement", new object[] { "CodeGroup", base.GetType().FullName }));
         }
         CodeGroup group = XMLUtil.CreateCodeGroup(this.UnnormalizeClassDeep(element6, hashtable));
         if (group == null)
         {
             throw new ArgumentException(Environment.GetResourceString("Argument_InvalidXMLElement", new object[] { "CodeGroup", base.GetType().FullName }));
         }
         group.FromXml(element6, this);
         this.m_rootCodeGroup = group;
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:88,代码来源:PolicyLevel.cs

示例9: 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;
				}
				permissions.Clear();
				if(state != PermissionState.Unrestricted)
				{
					SecurityElement child =
						esd.SearchForChildByTag("ConnectAccess");
					if(child != null)
					{
						AddFromXml(child, NetworkAccess.Connect);
					}
					child = esd.SearchForChildByTag("AcceptAccess");
					if(child != null)
					{
						AddFromXml(child, NetworkAccess.Accept);
					}
				}
			}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:37,代码来源:SocketPermission.cs

示例10: FromXml

        /// <include file='doc\WebPermission.uex' path='docs/doc[@for="WebPermission.FromXml"]/*' />
        /// <devdoc>
        /// </devdoc>
        public override void FromXml(SecurityElement securityElement) {
            if (securityElement == null) {

                //
                // null SecurityElement
                //

                throw new ArgumentNullException("securityElement");
            }
            if (!securityElement.Tag.Equals("IPermission")) {

                //
                // SecurityElement must be a permission element
                //

                throw new ArgumentException("securityElement");
            }

            string className = securityElement.Attribute("class");

            if (className == null) {

                //
                // SecurityElement must be a permission element for this type
                //

                throw new ArgumentException("securityElement");
            }
            if (className.IndexOf(this.GetType().FullName) < 0) {

                //
                // SecurityElement must be a permission element for this type
                //

                throw new ArgumentException("securityElement");
            }

            String str = securityElement.Attribute("Unrestricted");

            if (str != null) {
                m_noRestriction = (0 == string.Compare( str, "true", true, CultureInfo.InvariantCulture));
                if(m_noRestriction)
                    return;
            }

            m_noRestriction = false;
            m_connectList = new ArrayList();
            m_acceptList = new ArrayList();

            SecurityElement et = securityElement.SearchForChildByTag("ConnectAccess");
            string uriPattern;

            if (et != null) {

                foreach(SecurityElement uriElem in et.Children) {
                    //NOTE: Any stuff coming from XML is treated as URI PATTERN!
                    if (uriElem.Tag.Equals("URI")) {
                        try {
                            uriPattern = uriElem.Attributes["uri"] as string;
                        }
                        catch {
                            uriPattern = null;
                        }
                        if (uriPattern == null) {
                            throw new ArgumentException(SR.GetString(SR.net_perm_invalid_val_in_element), "ConnectAccess");
                        }
                        AddAsPattern(NetworkAccess.Connect, uriPattern);
                    }
                    else {
                        // improper tag found, just ignore
                    }
                }
            }

            et = securityElement.SearchForChildByTag("AcceptAccess");
            if (et != null) {

                foreach(SecurityElement uriElem in et.Children) {
                    //NOTE: Any stuff coming from XML is treated as URI PATTERN!
                    if (uriElem.Tag.Equals("URI")) {
                        try {
                            uriPattern = uriElem.Attributes["uri"] as string;
                        }
                        catch {
                            uriPattern = null;
                        }
                        if (uriPattern == null) {
                            throw new ArgumentException(SR.GetString(SR.net_perm_invalid_val_in_element), "AcceptAccess");
                        }
                        AddAsPattern(NetworkAccess.Accept, uriPattern);
                    }
                    else {
                        // improper tag found, just ignore
                    }
                }
            }
        }
开发者ID:ArildF,项目名称:masters,代码行数:100,代码来源:webpermission.cs

示例11: FromXml

        /// <devdoc>
        /// </devdoc>
        public override void FromXml(SecurityElement securityElement) {
            if (securityElement == null) {

                //
                // null SecurityElement
                //

                throw new ArgumentNullException("securityElement");
            }
            if (!securityElement.Tag.Equals("IPermission")) {

                //
                // SecurityElement must be a permission element
                //

                throw new ArgumentException(SR.GetString(SR.net_not_ipermission), "securityElement");
            }

            string className = securityElement.Attribute("class");

            if (className == null) {

                //
                // SecurityElement must be a permission element for this type
                //

                throw new ArgumentException(SR.GetString(SR.net_no_classname), "securityElement");
            }
            if (className.IndexOf(this.GetType().FullName) < 0) {

                //
                // SecurityElement must be a permission element for this type
                //

                throw new ArgumentException(SR.GetString(SR.net_no_typename), "securityElement");
            }

            //
            // Start recovering the state from XML encoding
            //

            initialize();


            String str = securityElement.Attribute("Unrestricted");

            if (str != null) {
                m_noRestriction = (0 == string.Compare( str, "true", StringComparison.OrdinalIgnoreCase ));
                if(m_noRestriction)
                    return;
            }

            m_noRestriction = false;
            m_connectList = new ArrayList();
            m_acceptList = new ArrayList();

            SecurityElement et = securityElement.SearchForChildByTag("ConnectAccess");
            if (et != null) {
                ParseAddXmlElement(et, m_connectList, "ConnectAccess, ");
            }
            et = securityElement.SearchForChildByTag("AcceptAccess");
            if (et != null) {
                ParseAddXmlElement(et, m_acceptList, "AcceptAccess, ");
            }
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:67,代码来源:SocketPermission.cs

示例12: FromXml

        /// <devdoc>
        /// </devdoc>
        public override void FromXml(SecurityElement securityElement) {
            if (securityElement == null) {

                //
                // null SecurityElement
                //

                throw new ArgumentNullException("securityElement");
            }
            if (!securityElement.Tag.Equals("IPermission")) {

                //
                // SecurityElement must be a permission element
                //

                throw new ArgumentException(SR.GetString(SR.net_not_ipermission), "securityElement");
            }

            string className = securityElement.Attribute("class");

            if (className == null) {

                //
                // SecurityElement must be a permission element for this type
                //

                throw new ArgumentException(SR.GetString(SR.net_no_classname), "securityElement");
            }
            if (className.IndexOf(this.GetType().FullName) < 0) {

                //
                // SecurityElement must be a permission element for this type
                //

                throw new ArgumentException(SR.GetString(SR.net_no_typename), "securityElement");
            }

            String str = securityElement.Attribute("Unrestricted");

            m_connectList = new ArrayList();
            m_acceptList = new ArrayList();
            m_UnrestrictedAccept = m_UnrestrictedConnect = false;

            if (str != null && string.Compare(str, "true", StringComparison.OrdinalIgnoreCase ) == 0)
            {
                m_noRestriction = true;
                return;
            }

            m_noRestriction = false;

            SecurityElement et = securityElement.SearchForChildByTag("ConnectAccess");
            string uriPattern;

            if (et != null) {

                foreach(SecurityElement uriElem in et.Children) {
                    //NOTE: Any stuff coming from XML is treated as URI PATTERN!
                    if (uriElem.Tag.Equals("URI")) {
                        try {
                            uriPattern = uriElem.Attribute("uri");
                        }
                        catch {
                            uriPattern = null;
                        }
                        if (uriPattern == null) {
                            throw new ArgumentException(SR.GetString(SR.net_perm_invalid_val_in_element), "ConnectAccess");
                        }
                        if (uriPattern == MatchAll)
                        {
                            m_UnrestrictedConnect = true;
                            m_connectList = new ArrayList();
                            break;
                        }
                        else
                        {
                            AddAsPattern(NetworkAccess.Connect, new DelayedRegex(uriPattern));
                        }
                    }
                    else {
                        // improper tag found, just ignore
                    }
                }
            }

            et = securityElement.SearchForChildByTag("AcceptAccess");
            if (et != null) {

                foreach(SecurityElement uriElem in et.Children) {
                    //NOTE: Any stuff coming from XML is treated as URI PATTERN!
                    if (uriElem.Tag.Equals("URI")) {
                        try {
                            uriPattern = uriElem.Attribute("uri");
                        }
                        catch {
                            uriPattern = null;
                        }
                        if (uriPattern == null) {
//.........这里部分代码省略.........
开发者ID:REALTOBIZ,项目名称:mono,代码行数:101,代码来源:WebPermission.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");
     }
     this.initialize();
     string strA = securityElement.Attribute("Unrestricted");
     if (strA != null)
     {
         this.m_noRestriction = 0 == string.Compare(strA, "true", StringComparison.OrdinalIgnoreCase);
         if (this.m_noRestriction)
         {
             return;
         }
     }
     this.m_noRestriction = false;
     this.m_connectList = new ArrayList();
     this.m_acceptList = new ArrayList();
     SecurityElement et = securityElement.SearchForChildByTag("ConnectAccess");
     if (et != null)
     {
         ParseAddXmlElement(et, this.m_connectList, "ConnectAccess, ");
     }
     et = securityElement.SearchForChildByTag("AcceptAccess");
     if (et != null)
     {
         ParseAddXmlElement(et, this.m_acceptList, "AcceptAccess, ");
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:43,代码来源:SocketPermission.cs

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

示例15: ParseXml

 protected override void ParseXml(SecurityElement e, PolicyLevel level)
 {
     this.ResetConnectAccess();
     SecurityElement element = e.SearchForChildByTag("connectAccessRules");
     if ((element == null) || (element.Children == null))
     {
         this.SetDefaults();
     }
     else
     {
         foreach (SecurityElement element2 in element.Children)
         {
             if (element2.Tag.Equals("codeOrigin"))
             {
                 string originScheme = element2.Attribute("scheme");
                 bool flag = false;
                 if (element2.Children != null)
                 {
                     foreach (SecurityElement element3 in element2.Children)
                     {
                         if (element3.Tag.Equals("connectAccess"))
                         {
                             string allowScheme = element3.Attribute("scheme");
                             string allowPort = element3.Attribute("port");
                             this.AddConnectAccess(originScheme, new CodeConnectAccess(allowScheme, allowPort));
                             flag = true;
                         }
                     }
                 }
                 if (!flag)
                 {
                     this.AddConnectAccess(originScheme, null);
                 }
             }
         }
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:37,代码来源:NetCodeGroup.cs


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