Windows 10 获得 DeviceFamilyVersion [英] Windows 10 get DeviceFamilyVersion

查看:20
本文介绍了Windows 10 获得 DeviceFamilyVersion的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 windows 10 10240 Univasal windows 应用程序,当我使用 Windows.System.Profile.AnalyticsInfo.VersionInfo.DeviceFamilyVersion 获取设备版本时,它返回字符串2814750438211605"而不是版本格式(major.minor.修订版.build).谁能告诉我字符串2814750438211605"是什么意思?

I'm working windows 10 10240 Univasal windows app, when i use Windows.System.Profile.AnalyticsInfo.VersionInfo.DeviceFamilyVersion to get deivce version, it return a string "2814750438211605" instead of a version format (major.minor.revision.build). Anyone can tell me what the string "2814750438211605" means?

推荐答案

Windows 10 操作系统版本值位于此字符串属性中:
Windows.System.Profile.AnalyticsInfo.VersionInfo.DeviceFamilyVersion

The Windows 10 OS version value is located in this string property:
Windows.System.Profile.AnalyticsInfo.VersionInfo.DeviceFamilyVersion

它返回类似2814750438211613"的字符串值.
要将这个长数字转换为可读格式,请使用:

It returns string value like "2814750438211613".
To convert this long number to readable format use this:

string sv = AnalyticsInfo.VersionInfo.DeviceFamilyVersion;
ulong v = ulong.Parse(sv);
ulong v1 = (v & 0xFFFF000000000000L) >> 48;
ulong v2 = (v & 0x0000FFFF00000000L) >> 32;
ulong v3 = (v & 0x00000000FFFF0000L) >> 16;
ulong v4 = v & 0x000000000000FFFFL;
string version = $"{v1}.{v2}.{v3}.{v4}"; // == 10.0.10240.16413

这篇关于Windows 10 获得 DeviceFamilyVersion的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆