• windows8 开发获得系统 app相关信息代码 c#版本


    /// <summary>
            /// 获取唯一id(网卡id) 替代imei
            /// </summary>
            /// <returns></returns>
            internal static string GetUniqueId()
            {
                try
                {
                    var connectionProfile = NetworkInformation.GetInternetConnectionProfile();
                    var networkAdapter = connectionProfile.NetworkAdapter;
                    return networkAdapter.NetworkAdapterId.ToString();
                }
                catch
                {
                    return "";
                }
            }
    
            /// <summary>
            /// 格林威治时间
            /// </summary>
            /// <returns></returns>
            internal static string GetTime()
            {
                return Decimal.ToInt64(Decimal.Divide(DateTime.UtcNow.Ticks - 621355968000000000, 10000)).ToString();
            }
            /// <summary>
            /// 应用程序包名或程序名称
            /// </summary>
            /// <returns></returns>
            internal static string GetPKG()
            {
                try
                {
                    Package package = Package.Current;
                    PackageId packageId = package.Id;
                    return packageId.Name;
                }
                catch
                {
                    return "";
                }
            }
            /// <summary>
            /// 获得网络类型
            /// </summary>
            /// <returns></returns>
            internal static string GetNettype()
            {
                try
                {
                    //http://msdn.microsoft.com/en-us/library/windows/apps/windows.networking.connectivity.networkadapter.ianainterfacetype.aspx
                    var profile = Windows.Networking.Connectivity.NetworkInformation.GetInternetConnectionProfile();
                    var interfaceType = profile.NetworkAdapter.IanaInterfaceType;
    
                    if (interfaceType == 71)
                    {
                        return "Wifi";
                    }
                    else if (interfaceType == 6)
                    {
                        return "Ethernet";
                    }
                    else
                    {
                        return "other";
                    }
                }
                catch
                {
                    return "";
                }
            }
            /// <summary>
            /// API的版本号
            /// </summary>
            /// <returns></returns>
            internal static string GetApiVersion()
            {
                try
                {
                    AssemblyFileVersionAttribute MyAssemblyFileVersionAttribute = typeof(MainPage).GetTypeInfo().Assembly.GetCustomAttribute<AssemblyFileVersionAttribute>();
                    return MyAssemblyFileVersionAttribute.Version;
                }
                catch
                {
                    return "";
                }
            }
            /// <summary>
            /// 获取设备名称
            /// </summary>
            /// <returns></returns>
            internal static async Task<string> GetModel()
            {
                try
                {
                    if (DeviceModel!=null)
                    {
                        return DeviceModel;
                    }
                    string[] properties = { "System.Devices.ModelName" };
                    var containers = await PnpObject.FindAllAsync(PnpObjectType.DeviceContainer, properties);
                    foreach (PnpObject container in containers)
                    {
                        if (container.Id.Equals("{00000000-0000-0000-FFFF-FFFFFFFFFFFF}"))
                        {
                            DeviceModel = container.Properties["System.Devices.ModelName"].ToString();
                            return DeviceModel;
                        }
                    }
                    return "";
                }
                catch
                {
                    return "";
                }
            }
    
            /// <summary>
            /// 终端屏幕分辨率
            /// </summary>
            /// <returns></returns>
            internal static string GetResolution()
            {
                try
                {
                    Rect ret = Window.Current.CoreWindow.Bounds;
                    return ret.Width + "*" + ret.Height;
                }
                catch
                {
                    return "";
                }
            }
            

    现在没有找到

    1、获得os系统信息的api 

    2、获得app 开启那些权限(如定位,读写文件等权限)信息的api  

    如果你有更好的方式或者有办法还请留言互相交流!~

  • 相关阅读:
    Linux-grep 命令和find 命令 (6)
    第1阶段——u-boot分析之make 100ask24x0_config指令(1)
    shell变量$(CURDIR),$0,$1,$2,$#含义解释
    ln命令详解
    快速解决设置Android 23.0以上版本对SD卡的读写权限无效的问题
    java.io.IOException: Cleartext HTTP traffic to xxx.xxx.xxx.xxx not permitted
    AndroidStudio 3.0中之后无法打开DDMS [Android Device Monitor] 问题
    解决android sdk docs帮助文档打开慢的问题
    Android Intent的使用
    约束布局ConstraintLayout详解
  • 原文地址:https://www.cnblogs.com/piaocz/p/2768038.html
Copyright © 2020-2023  润新知