public Oid(string oid) { // If we were passed the friendly name, retrieve the value String. this.Value = OidLookup.ToOid(oid, OidGroup.All, fallBackToAllGroups: false) ?? oid; _group = OidGroup.All; }
public static Oid FromOidValue(string oidValue, OidGroup group) { ArgumentNullException.ThrowIfNull(oidValue); string?friendlyName = OidLookup.ToFriendlyName(oidValue, group, fallBackToAllGroups: false); if (friendlyName == null) { throw new CryptographicException(SR.Cryptography_Oid_InvalidValue); } return(new Oid(oidValue, friendlyName, group)); }
public Oid(String oid) { // If we were passed the friendly name, retrieve the value String. String oidValue = OidLookup.ToOid(oid, OidGroup.All, fallBackToAllGroups: false); if (oidValue == null) { oidValue = oid; } this.Value = oidValue; _group = OidGroup.All; }
public static Oid FromFriendlyName(string friendlyName, OidGroup group) { if (friendlyName == null) { throw new ArgumentNullException(nameof(friendlyName)); } string?oidValue = OidLookup.ToOid(friendlyName, group, fallBackToAllGroups: false); if (oidValue == null) { throw new CryptographicException(SR.Cryptography_Oid_InvalidName); } return(new Oid(oidValue, friendlyName, group)); }
// Indexer using an OID friendly name or value. public Oid?this[string oid] { get { // If we were passed the friendly name, retrieve the value String. string?oidValue = OidLookup.ToOid(oid, OidGroup.All, fallBackToAllGroups: false) ?? oid; for (int i = 0; i < _count; i++) { Oid entry = _oids[i]; if (entry.Value == oidValue) { return(entry); } } return(null); } }
// Indexer using an OID friendly name or value. public Oid this[String oid] { get { // If we were passed the friendly name, retrieve the value String. String oidValue = OidLookup.ToOid(oid, OidGroup.All, fallBackToAllGroups: false); if (oidValue == null) { oidValue = oid; } foreach (Oid entry in _list) { if (entry.Value == oidValue) { return(entry); } } return(null); } }