为什么 makepri.exe 创建多个 Resources.pri 文件?

ktb*_*bee 3 windows-10 uwp

我正在尝试创建一个 Resources.pri 文件,以便 Windows 10 知道在不同分辨率下将哪些图像用于我的开始磁贴。我正在执行下面链接的 MSDN 文档的第 6 步:

https://msdn.microsoft.com/en-us/library/windows/apps/dn393983.aspx#Specify_images_for_scaling__localization__and_high_contrast

我所有的徽标图像都根据其比例进行了标记。这些是我的资产文件夹中的名称:

70x70Logo.scale-80.png
70x70Logo.scale-100.png
70x70Logo.scale-140.png
70x70Logo.scale-180.png
150x150Logo.scale-80.png
150x150Logo.scale-100.png
150x150Logo.scale-140.png
150x150Logo.scale-180.png
Run Code Online (Sandbox Code Playgroud)

当我手动使用 makepri.exe 时,它​​会创建三个 Resources.pri 文件,而不是仅一个包含我想要的所有缩放信息的文件。这些是生成的文件:

Resources.pri
Resources.scale-140.pri
Resources.scale-180.pri
Run Code Online (Sandbox Code Playgroud)

Resources.pri 包含 80% 和 100% 比例的信息,但其他两个文件包含 140% 和 180% 比例的信息。知道为什么较大的比例被分成单独的文件吗?我在下面包含了我的 TestAppConfig.xml 文件以及我用来生成文件的命令。

测试应用配置.xml

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<resources targetOsVersion="10.0.0" majorVersion="1">
    <packaging>
        <autoResourcePackage qualifier="Language"/>
        <autoResourcePackage qualifier="Scale"/>
        <autoResourcePackage qualifier="DXFeatureLevel"/>
    </packaging>
    <index root="\" startIndexAt="\">
        <default>
            <qualifier name="Language" value="en-US"/>
            <qualifier name="scale" value="100"/>
        </default>
        <indexer-config type="folder" foldernameAsQualifier="true" filenameAsQualifier="true" qualifierDelimiter="."/>
        <indexer-config type="resw" convertDotsToSlashes="true" initialPath=""/>
        <indexer-config type="resjson" initialPath=""/>
        <indexer-config type="PRI"/>
    </index>
    <!--<index startIndexAt="Start Index Here" root="Root Here">-->
    <!--        <indexer-config type="resfiles" qualifierDelimiter="."/>-->
    <!--        <indexer-config type="priinfo" emitStrings="true" emitPaths="true" emitEmbeddedData="true"/>-->
    <!--</index>-->
</resources>
Run Code Online (Sandbox Code Playgroud)

创建 TestAppConfig.xml 的命令

"C:\Program Files (x86)\Windows Kits\10\bin\x86\makepri.exe" createconfig /cf %USERPROFILE%\Documents\TestAppConfig.xml /dq lang-en-US_scale-100_contrast-high /pv 10.0.0
Run Code Online (Sandbox Code Playgroud)

创建 Resources.pri 的命令

"C:\Program Files (x86)\Windows Kits\10\bin\x86\makepri.exe" new /pr %USERPROFILE%\Documents\CreateResources /cf %USERPROFILE%\Documents\TestAppConfig.xml /in TestApp /of %USERPROFILE%\Documents\CreateResources\Resources.pri
Run Code Online (Sandbox Code Playgroud)

任何对此的见解都将不胜感激!如果我可以提供更多详细信息,请告诉我。

ktb*_*bee 5

我最终找到了一种解决方案,尽管我完全确定为什么它可以工作/需要创建一个 Resources.pri 文件。我发现设置所有图像的默认语言允许 makepri.exe 将所有图像比例作为资源候选添加到一个 Resources.pri 文件中。例如,我发现这个文件结构有效:

\Assets
    \en-US
        70x70Logo.scale-80.png
        70x70Logo.scale-100.png
        70x70Logo.scale-140.png
        70x70Logo.scale-180.png
        150x150Logo.scale-80.png
        150x150Logo.scale-100.png
        150x150Logo.scale-140.png
        150x150Logo.scale-180.png
Run Code Online (Sandbox Code Playgroud)

我通过这段文档片段得到了线索:

注意 我们建议您在字符串资源文件(例如 en-US\resources.resw)上标记默认语言,并在图像上标记默认比例(例如 logo.scale-100.png),即使这些文件不会本地化也不提供多种分辨率的图像

https://msdn.microsoft.com/en-us/library/windows/apps/hh965372.aspx

去搞清楚。

我希望其他人觉得这有帮助。如果有人对 makepri.exe 为何以这种方式工作有更多见解,我很想了解更多信息。


Mik*_*son 5

我刚刚在语言而不是图像中遇到了这个问题,但是从自动生成的 makepri 配置中删除这个块为我修复了它:

<packaging>
    <autoResourcePackage qualifier="Language"/>
    <autoResourcePackage qualifier="Scale"/>
    <autoResourcePackage qualifier="DXFeatureLevel"/>
</packaging>
Run Code Online (Sandbox Code Playgroud)