如何在 Windows Store App (Metro App) 中获取唯一设备?
我们可以使用:
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();