gpt4 book ai didi

microsoft-metro - 如何在 Windows 8 Metro 应用程序中获取设备 ID

转载 作者:行者123 更新时间:2023-12-01 21:15:43 29 4
gpt4 key购买 nike

如何获取Windows应用商店应用(Metro应用)中的唯一设备?

我们可以使用:

Windows.System.Profile.HardwareIdentification.GetPackageSpecificToken(null);

 Windows.System.Profile.HardwareToken hToke = Windows.System.Profile.HardwareIdentification.GetPackageSpecificToken(null);
IBuffer hardwareId = hToke.Id;
IBuffer signature = hToke.Signature;
IBuffer certificate = hToke.Certificate;
DataReader reader = Windows.Storage.Streams.DataReader.FromBuffer(hardwareId);
byte[] ar = new Byte[hardwareId.Length];
reader.ReadBytes(ar);
string i = ar.ToString();
string id = System.Text.Encoding.Unicode.GetString(ar, 0, ar.Length);
System.Diagnostics.Debug.WriteLine("ID" + Convert.ToBase64String(ar));

找到的第一个网络适配器的网络适配器 ID

IReadOnlyCollection<Windows.Networking.Connectivity.ConnectionProfile> profiles =
Windows.Networking.Connectivity.NetworkInformation.GetConnectionProfiles();
Windows.Networking.Connectivity.NetworkAdapter na = profiles.First<Windows.Networking.Connectivity.ConnectionProfile>().NetworkAdapter;
string nid = na.NetworkAdapterId.ToString();

最佳答案

是的,这是 suggested方式:

   private string GetHardwareId()
{
var token = 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);
}

或者,您对这种方法有疑问吗?

关于microsoft-metro - 如何在 Windows 8 Metro 应用程序中获取设备 ID,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12893637/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com