/// <summary> /// Has the certificate this attribute? /// </summary> /// <param name="name">Name of the attribute.</param> /// <returns>Is it there?</returns> protected bool HasAttribute(CertificateAttributeName name) { return this.attributes.Where(attribute => attribute.Name == name).Count() > 0; }
/// <summary> /// Get a string attribute value. /// </summary> /// <param name="name">Name of the attribute.</param> /// <returns>Value of the attribute or null.</returns> protected string GetAttributeValueString(CertificateAttributeName name) { CertificateAttribute attribute = GetAttribute(name); if (attribute is StringCertificateAttribute) { return ((StringCertificateAttribute)attribute).Value; } else { return null; } }
/// <summary> /// Get a string attribute value. /// </summary> /// <param name="name">Name of the attribute.</param> /// <returns>Value of the attribute or null.</returns> protected bool? GetAttributeValueBoolean(CertificateAttributeName name) { CertificateAttribute attribute = GetAttribute(name); if (attribute is BooleanCertificateAttribute) { return ((BooleanCertificateAttribute)attribute).Value; } else { return null; } }
/// <summary> /// Get a string attribute value. /// </summary> /// <param name="name">Name of the attribute.</param> /// <returns>Value of the attribute or null.</returns> protected int? GetAttributeValueInt32(CertificateAttributeName name) { CertificateAttribute attribute = GetAttribute(name); if (attribute is Int32CertificateAttribute) { return ((Int32CertificateAttribute)attribute).Value; } else { return null; } }
/// <summary> /// Get attribute if available. /// </summary> /// <param name="name">Name of the attribute.</param> /// <returns>Attribute.</returns> protected CertificateAttribute GetAttribute(CertificateAttributeName name) { return this.attributes.Where(attribute => attribute.Name == name).FirstOrDefault(); }