Skip to content

Commit 0e1d99d

Browse files
committed
Hex string
1 parent 5911c7e commit 0e1d99d

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

Meshtastic/Extensions/ReflectionExtensions.cs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,12 @@ public static IEnumerable<PropertyInfo> GetProperties(this object instance)
4747
.Where(p => !Exclusions.Contains(p.Name));
4848
}
4949

50-
public static string GetSettingValue(this PropertyInfo property, object instance) =>
51-
(property.GetValue(instance)?.ToString() ?? string.Empty).Replace("[", string.Empty).Replace("]", string.Empty);
52-
50+
public static string GetSettingValue(this PropertyInfo property, object instance)
51+
{
52+
if (property.PropertyType == typeof(ByteString)) {
53+
var byteString = (ByteString)property.GetValue(instance)!;
54+
return Convert.ToHexString(byteString.ToByteArray());
55+
}
56+
return (property.GetValue(instance)?.ToString() ?? string.Empty).Replace("[", string.Empty).Replace("]", string.Empty);
57+
}
5358
}

0 commit comments

Comments
 (0)