Skip to content

Commit

Permalink
update test console app
Browse files Browse the repository at this point in the history
  • Loading branch information
iAJTin committed Feb 15, 2020
1 parent 0b1ca91 commit 399802b
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/test/iSMBIOS.ConsoleApp/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,16 @@ static void Main(string[] args)

foreach (DmiStructure structure in structures)
{
Console.WriteLine();
Console.WriteLine(@" ——————————————————————————————————————————————————————————————");
Console.WriteLine($@" {(int)structure.Class:D3}-{structure.FriendlyClassName} structure detail");
Console.WriteLine(@" ——————————————————————————————————————————————————————————————");
DmiClassCollection elements = structure.Elements;
foreach (DmiClass element in elements)
{
Console.WriteLine();
Console.WriteLine(element.ImplementedVersion == DmiStructureVersion.Latest
? $@" ———————————————————————————————————————————————————— {element.ImplementedVersion} ——"
: $@" ——————————————————————————————————————————————————————— {element.ImplementedVersion} ——");
Console.WriteLine($@" {(int)structure.Class:D3}-{structure.FriendlyClassName} structure detail");
Console.WriteLine(@" ——————————————————————————————————————————————————————————————");

DmiClassPropertiesTable elementProperties = element.Properties;
foreach (KeyValuePair<IPropertyKey, object> property in elementProperties)
{
Expand Down Expand Up @@ -66,7 +69,9 @@ static void Main(string[] args)
}
else if (value is ushort)
{
Console.WriteLine($@" > {friendlyName} > {value} {unit} [{value:X4}h]");
Console.WriteLine(key.Equals(DmiProperty.MemoryDevice.ConfiguredMemoryClockSpeed)
? $@" > {friendlyName} > {value} {(int.Parse(DMI.Instance.SmbiosVersion) > 300 ? PropertyUnit.MTs : PropertyUnit.MHz)} [{value:X4}h]"
: $@" > {friendlyName} > {value} {unit} [{value:X4}h]");
}
else if (value is int)
{
Expand Down Expand Up @@ -123,7 +128,7 @@ static void Main(string[] args)
string biosVendor = structures.GetProperty<string>(DmiProperty.Bios.Vendor);
Console.WriteLine($@" > BIOS Vendor > {biosVendor}");

int currentSpeed = structures.GetProperty<int>(DmiProperty.Processor.CurrentSpeed);
ushort currentSpeed = structures.GetProperty<ushort>(DmiProperty.Processor.CurrentSpeed);
Console.WriteLine($@" > Current Speed > {currentSpeed:N0} {DmiProperty.Processor.CurrentSpeed.PropertyUnit}");

string processorManufacturer = structures.GetProperty<string>(DmiProperty.Processor.ProcessorManufacturer);
Expand Down

0 comments on commit 399802b

Please sign in to comment.