我希望为后端服务(ws)获取唯一设备ID,我找到了以下参考资料:
private string GetDeviceId()
{
var token = Windows.System.Profile.HardwareIdentification.GetPackageSpecificToken(null);
var hardwareId = token.Id;
var dataReader = Windows.Storage.Streams.DataReader.FromBuffer(hardwareId);
byte[] bytes = new byte[hardwareId.Length];
dataReader.ReadBytes(bytes);
return BitConverter.ToString(bytes).Replace("-", "");
}//Note: This function may throw an exception.
但是,我无法理解这段代码,每次我都会得到相同的设备ID(64个字符的字符串),我想知道它是否适用? 我在MSDN上也找不到任何参考资料。
谢谢。
HashAlgorithmNames.Md5
代替硬编码的 *"MD5"*。 - Kristian Vukusic