zoukankan      html  css  js  c++  java
  • 02、获取 win 8 程序包信息

    命名空间:   Windows.ApplicationModel

    1、获取应用程序安装文件夹的路径:

      // This will give the Installed Location.  You can use this location to access files, if you need them.
                Windows.Storage.StorageFolder installedLocation = Package.Current.InstalledLocation;
    txt.Text = String.Format("Installed Location: {0}", installedLocation.Path);

    2、获取包版本信息:

     String versionString(PackageVersion version)
            {
                return String.Format("{0}.{1}.{2}.{3}",
                                     version.Major, version.Minor, version.Build, version.Revision);
            }

    3、获取应用程序所支持的处理器体系结构:

     String architectureString(Windows.System.ProcessorArchitecture architecture)
            {
                switch (architecture)
                {
                    case Windows.System.ProcessorArchitecture.X86:
                        return "x86";
                    case Windows.System.ProcessorArchitecture.Arm:
                        return "arm";
                    case Windows.System.ProcessorArchitecture.X64:
                        return "x64";
                    case Windows.System.ProcessorArchitecture.Neutral:
                        return "neutral";
                    case Windows.System.ProcessorArchitecture.Unknown:
                        return "unknown";
                    default:
                        return "???";
                }
            }

    4、应用程序包信息:

    // 调用 2、 3、 中的方法:

                Package package = Package.Current;
                PackageId packageId = package.Id;
    
                OutputTextBlock.Text = String.Format("Name: \"{0}\"\n" +
                                                     "Version: {1}\n" +
                                                     "Architecture: {2}\n" +
                                                     "ResourceId: \"{3}\"\n" +
                                                     "Publisher: \"{4}\"\n" +
                                                     "PublisherId: \"{5}\"\n" +
                                                     "FullName: \"{6}\"\n" +
                                                     "FamilyName: \"{7}\"\n" +
                                                     "IsFramework: {8}",
                                                     packageId.Name,
                                                     versionString(packageId.Version),
                                                     architectureString(packageId.Architecture),
                                                     packageId.ResourceId,
                                                     packageId.Publisher,
                                                     packageId.PublisherId,
                                                     packageId.FullName,
                                                     packageId.FamilyName,
                                                     package.IsFramework);
  • 相关阅读:
    第21周六
    第21周五
    第21周四
    第21周三
    C/C++中各种类型int、long、double、char表示范围(最大最小值)
    插入排序
    面向对象的5个基本设计原则
    红黑树
    Cocos2d-x学习笔记(六) 定时器Schedule的简单应用
    SNMP协议具体解释
  • 原文地址:https://www.cnblogs.com/hebeiDGL/p/2684726.html
Copyright © 2011-2022 走看看