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


C# System.Security.SecurityElement.AddAttribute方法代码示例

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


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

示例1: ToXml

 internal SecurityElement ToXml()
 {
     SecurityElement root = new SecurityElement( "Identity" );
     
     if (m_authenticated)
         root.AddAttribute( "Authenticated", "true" );
         
     if (m_id != null)
     {
         root.AddAttribute( "ID", SecurityElement.Escape( m_id ) );
     }
        
     if (m_role != null)
     {
         root.AddAttribute( "Role", SecurityElement.Escape( m_role ) );
     }
                     
     return root;
 }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:19,代码来源:PrincipalPermission.cs

示例2: ToXml

 public override SecurityElement ToXml()
 {
     SecurityElement esd = CodeAccessPermission.CreatePermissionElement( this, "System.Security.Permissions.UrlIdentityPermission" );
     if (m_unrestricted)
         esd.AddAttribute( "Unrestricted", "true" );
     else if (m_urls != null)
     {
         if (m_urls.Length == 1)
             esd.AddAttribute( "Url", m_urls[0].ToString() );
         else
         {
             int n;
             for(n = 0; n < m_urls.Length; n++)
             {
                 SecurityElement child = new SecurityElement("Url");
                 child.AddAttribute( "Url", m_urls[n].ToString() );
                 esd.AddChild(child);
             }
         }
     }
     return esd;
 }
开发者ID:Rayislandstyle,项目名称:dotnet-coreclr,代码行数:22,代码来源:URLIdentityPermission.cs

示例3: ToXml

 public override SecurityElement ToXml()
 {
     SecurityElement esd = CodeAccessPermission.CreatePermissionElement( this, "System.Security.Permissions.StrongNameIdentityPermission" );
     if (m_unrestricted)
         esd.AddAttribute( "Unrestricted", "true" );
     else if (m_strongNames != null)
     {
         if (m_strongNames.Length == 1)
         {
             if (m_strongNames[0].m_publicKeyBlob != null)
                 esd.AddAttribute("PublicKeyBlob", Hex.EncodeHexString(m_strongNames[0].m_publicKeyBlob.PublicKey));
             if (m_strongNames[0].m_name != null)
                 esd.AddAttribute("Name", m_strongNames[0].m_name);
             if ((Object)m_strongNames[0].m_version != null)
                 esd.AddAttribute("AssemblyVersion", m_strongNames[0].m_version.ToString());
         }
         else
         {
             int n;
             for(n = 0; n < m_strongNames.Length; n++)
             {
                 SecurityElement child = new SecurityElement("StrongName");
                 if (m_strongNames[n].m_publicKeyBlob != null)
                     child.AddAttribute("PublicKeyBlob", Hex.EncodeHexString(m_strongNames[n].m_publicKeyBlob.PublicKey));
                 if (m_strongNames[n].m_name != null)
                     child.AddAttribute("Name", m_strongNames[n].m_name);
                 if ((Object)m_strongNames[n].m_version != null)
                     child.AddAttribute("AssemblyVersion", m_strongNames[n].m_version.ToString());
                 esd.AddChild(child);
             }
         }
     }
     return esd;
 }
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:34,代码来源:strongnameidentitypermission.cs

示例4: ToXml

 public override SecurityElement ToXml()
 { 
     SecurityElement esd = CodeAccessPermission.CreatePermissionElement( this, "System.Security.Permissions.ZoneIdentityPermission" );
     if (SecurityZone != SecurityZone.NoZone)
     {
         esd.AddAttribute( "Zone", Enum.GetName( typeof( SecurityZone ), this.SecurityZone ) ); 
     }
     else 
     { 
         int nEnum = 0;
         uint nFlag; 
         for(nFlag = 1; nFlag < AllZones; nFlag <<= 1)
         {
             if((m_zones & nFlag) != 0)
             { 
                 SecurityElement child = new SecurityElement("Zone");
                 child.AddAttribute( "Zone", Enum.GetName( typeof( SecurityZone ), (SecurityZone)nEnum ) ); 
                 esd.AddChild(child); 
             }
             nEnum++; 
         }
     }
     return esd;
 } 
开发者ID:sjyanxin,项目名称:WPFSource,代码行数:24,代码来源:ZoneIdentityPermission.cs

示例5: ToXml

        public SecurityElement ToXml( PolicyLevel level )
        {
            SecurityElement root = new SecurityElement( "IMembershipCondition" );
            System.Security.Util.XMLUtil.AddClassAttribute( root, this.GetType(), "System.Security.Policy.StrongNameMembershipCondition" );
            // If you hit this assert then most likely you are trying to change the name of this class. 
            // This is ok as long as you change the hard coded string above and change the assert below.
            Contract.Assert( this.GetType().FullName.Equals( "System.Security.Policy.StrongNameMembershipCondition" ), "Class name changed!" );

            root.AddAttribute( "version", "1" );
            
            if (PublicKey != null)
                root.AddAttribute( s_tagPublicKeyBlob, System.Security.Util.Hex.EncodeHexString( PublicKey.PublicKey ) );

            if (Name != null)
                root.AddAttribute( s_tagName, Name );

            if ((Object) Version != null)
                root.AddAttribute( s_tagVersion, Version.ToString() );

            return root;

        }
开发者ID:REALTOBIZ,项目名称:mono,代码行数:22,代码来源:strongnamemembershipcondition.cs

示例6: ToXml

 /// <include file='doc\ApplicationDirectoryMembershipCondition.uex' path='docs/doc[@for="ApplicationDirectoryMembershipCondition.ToXml1"]/*' />
 public SecurityElement ToXml( PolicyLevel level )
 {
     SecurityElement root = new SecurityElement( "IMembershipCondition" );
     System.Security.Util.XMLUtil.AddClassAttribute( root, this.GetType() );
     root.AddAttribute( "version", "1" );
     
     return root;
 }
开发者ID:ArildF,项目名称:masters,代码行数:9,代码来源:applicationdirectorymembershipcondition.cs

示例7: ToXml

        public SecurityElement ToXml( PolicyLevel level )
        {
            SecurityElement root = new SecurityElement( "IMembershipCondition" );
            System.Security.Util.XMLUtil.AddClassAttribute( root, this.GetType(), "System.Security.Policy.ApplicationDirectoryMembershipCondition" );
            // If you hit this assert then most likely you are trying to change the name of this class. 
            // This is ok as long as you change the hard coded string above and change the assert below.
            BCLDebug.Assert( this.GetType().FullName.Equals( "System.Security.Policy.ApplicationDirectoryMembershipCondition" ), "Class name changed!" );

            root.AddAttribute( "version", "1" );
            
            return root;
        }
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:12,代码来源:ApplicationDirectoryMembershipCondition.cs

示例8: ToXml

 public override SecurityElement ToXml()
 {
     SecurityElement esd = CodeAccessPermission.CreatePermissionElement( this, "System.Security.Permissions.PublisherIdentityPermission" );
     if (m_unrestricted)
         esd.AddAttribute( "Unrestricted", "true" );
     else if (m_certs != null)
     {
         if (m_certs.Length == 1)
             esd.AddAttribute( "X509v3Certificate", m_certs[0].GetRawCertDataString() );
         else
         {
             int n;
             for(n = 0; n < m_certs.Length; n++)
             {
                 SecurityElement child = new SecurityElement("Cert");
                 child.AddAttribute( "X509v3Certificate", m_certs[n].GetRawCertDataString() );
                 esd.AddChild(child);
             }
         }
     }
     return esd;
 }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:22,代码来源:PublisherIdentityPermission.cs

示例9: ToXml

 /// <include file='doc\PrincipalPermission.uex' path='docs/doc[@for="PrincipalPermission.ToXml"]/*' />
 public SecurityElement ToXml()
 {
     SecurityElement root = new SecurityElement( "Permission" );
     
     XMLUtil.AddClassAttribute( root, this.GetType() );
     root.AddAttribute( "version", "1" );
     
     int count = m_array.Length;
     for (int i = 0; i < count; ++i)
     {
         root.AddChild( m_array[i].ToXml() );
     }
     
     return root;
 }
开发者ID:ArildF,项目名称:masters,代码行数:16,代码来源:principalpermission.cs

示例10: ToXml

        /// <include file='doc\StrongNameMembershipCondition.uex' path='docs/doc[@for="StrongNameMembershipCondition.ToXml1"]/*' />
        public SecurityElement ToXml( PolicyLevel level )
        {
            SecurityElement root = new SecurityElement( "IMembershipCondition" );
            System.Security.Util.XMLUtil.AddClassAttribute( root, this.GetType() );
            root.AddAttribute( "version", "1" );
            
            if (PublicKey != null)
                root.AddAttribute( s_tagPublicKeyBlob, System.Security.Util.Hex.EncodeHexString( PublicKey.PublicKey ) );

            if (Name != null)
                root.AddAttribute( s_tagName, Name );

            if ((Object) Version != null)
                root.AddAttribute( s_tagVersion, Version.ToString() );

            return root;

        }
开发者ID:ArildF,项目名称:masters,代码行数:19,代码来源:strongnamemembershipcondition.cs

示例11: ToXml

 /// <include file='doc\SiteMembershipCondition.uex' path='docs/doc[@for="SiteMembershipCondition.ToXml1"]/*' />
 public SecurityElement ToXml( PolicyLevel level )
 {
     if (m_site == null && m_element != null)
         ParseSite();
                 
     SecurityElement root = new SecurityElement( "IMembershipCondition" );
     System.Security.Util.XMLUtil.AddClassAttribute( root, this.GetType() );
     root.AddAttribute( "version", "1" );
     
     if (m_site != null)
         root.AddAttribute( "Site", m_site.ToString() );
     
     return root;
 }
开发者ID:ArildF,项目名称:masters,代码行数:15,代码来源:sitemembershipcondition.cs

示例12: ToXml

 /// <include file='doc\ZoneMembershipCondition.uex' path='docs/doc[@for="ZoneMembershipCondition.ToXml1"]/*' />
 public SecurityElement ToXml( PolicyLevel level )
 {
     if (m_zone == SecurityZone.NoZone && m_element != null)
         ParseZone();
         
     SecurityElement root = new SecurityElement( "IMembershipCondition" );
     System.Security.Util.XMLUtil.AddClassAttribute( root, this.GetType() );
     root.AddAttribute( "version", "1" );
     
     if (m_zone != SecurityZone.NoZone)
         root.AddAttribute( "Zone", Enum.GetName( typeof( SecurityZone ), m_zone ) );
     
     return root;
 }
开发者ID:ArildF,项目名称:masters,代码行数:15,代码来源:zonemembershipcondition.cs

示例13: ToXml

        public SecurityElement ToXml( PolicyLevel level )
        {
            if (m_site == null && m_element != null)
                ParseSite();
                        
            SecurityElement root = new SecurityElement( "IMembershipCondition" );
            System.Security.Util.XMLUtil.AddClassAttribute( root, this.GetType(), "System.Security.Policy.SiteMembershipCondition" );
            // If you hit this assert then most likely you are trying to change the name of this class. 
            // This is ok as long as you change the hard coded string above and change the assert below.
            BCLDebug.Assert( this.GetType().FullName.Equals( "System.Security.Policy.SiteMembershipCondition" ), "Class name changed!" );

            root.AddAttribute( "version", "1" );
            
            if (m_site != null)
                root.AddAttribute( "Site", m_site.ToString() );
            
            return root;
        }
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:18,代码来源:sitemembershipcondition.cs


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