本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}