in TPM Parser/Tpm2Lib/Globs.cs [251:290]
public static object FromBytes(Type t, byte[] data)
{
//return NetToHostValue(t, ReverseByteOrder(data));
if (t == typeof(byte))
{
return data[0];
}
if (t == typeof(ushort))
{
return BitConverter.ToUInt16(data, 0);
}
if (t == typeof(uint))
{
return BitConverter.ToUInt32(data, 0);
}
if (t == typeof(ulong))
{
return BitConverter.ToUInt64(data, 0);
}
if (t == typeof(short))
{
return BitConverter.ToInt16(data, 0);
}
if (t == typeof(int))
{
return BitConverter.ToInt32(data, 0);
}
if (t == typeof(long))
{
return BitConverter.ToInt64(data, 0);
}
if (t == typeof(sbyte))
{
return (sbyte)data[0];
}
// Unsupported type
Globs.Throw<ArgumentException>("Globs.FromBytes(): Unsupported type " + t);
return 0;
}