Skip to content

Commit

Permalink
Prefer friendly names from oid.txt over the friendly names of the sys…
Browse files Browse the repository at this point in the history
…tem.
  • Loading branch information
RufusJWB committed Jan 29, 2019
1 parent 10cd1d5 commit 69537bb
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions Asn1Editor/API/Utils/ASN/AsnDecoder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -209,12 +209,18 @@ class AsnDecoder {
}
static String DecodeObjectIdentifier(Asn1Reader asn) {
Oid oid = new Asn1ObjectIdentifier(asn).Value;
if (String.IsNullOrEmpty(oid.FriendlyName) && MainWindowVM.OIDs.ContainsKey(oid.Value)) {
oid.FriendlyName = MainWindowVM.OIDs[oid.Value];

if (MainWindowVM.OIDs.ContainsKey(oid.Value))
{
return MainWindowVM.OIDs[oid.Value]; //todo: This seems not to be thread safe
}

if (!String.IsNullOrWhiteSpace(oid.FriendlyName))
{
return $"{oid.FriendlyName} ({oid.Value})";
}
return String.IsNullOrEmpty(oid.FriendlyName)
? oid.Value
: $"{oid.FriendlyName} ({oid.Value})";

return oid.Value;
}
static String DecodeUTF8String(Asn1Reader asn) {
return Encoding.UTF8.GetString(asn.RawData, asn.PayloadStartOffset, asn.PayloadLength);
Expand Down

0 comments on commit 69537bb

Please sign in to comment.