in TpmRcDecoder/TpmRcDecoder.Universal/Manufacturers.xaml.cs [105:146]
private void ManufacturerCode_TextChanged(object sender, TextChangedEventArgs e)
{
string inStr = ManufacturerCode.Text.Trim();
uint manufacturerCode = ~0u;
if (inStr.StartsWith("0x", StringComparison.CurrentCultureIgnoreCase))
{
try
{
manufacturerCode = UInt32.Parse(inStr.Substring(2).Trim(), NumberStyles.HexNumber);
}
catch (FormatException)
{ }
}
else
{
try
{
manufacturerCode = UInt32.Parse(inStr, NumberStyles.Integer);
}
catch (FormatException)
{ }
}
if (manufacturerCode == ~0u)
{
SetIndex(-1, 0, "", m_InvalidCommandDescription);
return;
}
int index = 0;
foreach (TPMManufacturerDescription descr in m_Manufacturers)
{
if (manufacturerCode == descr.ID)
{
SetIndex(index, descr.ID, descr.Name, descr.Description);
return;
}
index++;
}
// no matching command found, set defaults
SetIndex(-1, 0, "", m_InvalidCommandDescription);
}