use*_*885 10 c# windows powershell wack uwp-xaml
我搜索并搜索过,似乎在这里碰了一堵砖墙.我正在开发一个生成音频指纹的应用程序,以自动搜索音频数据库以获取正确的艺术家和标题,并相应地重命名文件.
我的问题是,没有支持的C#和UWP库(据我所知)可以生成声学指纹.我发现的唯一的东西是Chromaprint,它允许我运行命令,如"fpcalc.exe mymp3file.mp3> generatedfingerprint.txt",并将指纹抓取到文本文件中.
因此,当您看到抓取指纹并不是真正的问题时,问题是我无法使用传统方法(例如Winforms应用程序中使用的那些)从UWP应用程序中运行EXE文件.我也无法启动命令提示符从UWP执行文件,因此我无法从我的应用程序中生成指纹.
所以我的问题是,有没有人有任何解决方法.我知道我可以使用Powershell,因为XboxOne支持PowerShell,但是如果我使用以下代码:
using (PowerShell PowerShellInstance = PowerShell.Create())
{
PowerShellInstance.AddCommand(".\fpcalc.exe " + file.Path + " > out.txt");
}
Run Code Online (Sandbox Code Playgroud)
构建时出现以下错误:
Cannot find type System.SystemException in module CommonLanguageRuntimeLibrary
Run Code Online (Sandbox Code Playgroud)
那么有谁知道我可以做什么来从我的应用程序中启动此fpcalc.exe文件?我真的不介意应用程序是否只支持Windows PC和桌面,但最终的应用程序必须能够通过WACK并允许在Microsoft Store上(可以免费下载BTW).
在此先感谢任何帮助:)
use*_*885 17
整个晚上我一直在撞墙撞墙,但在网上数百页之后,我可能想出了解决问题的方法.
通过引用"参考>通用Windows>扩展"下的"Windows桌面扩展UWP v10.0.14393.0",我可以使用:
await FullTrustProcessLauncher.LaunchFullTrustProcessForCurrentAppAsync();
Run Code Online (Sandbox Code Playgroud)
LaunchFullTrustProcess允许我从我自己的应用程序中启动受信任的应用程序.然后,我修改了Package Manifest XML文件并在"capabilities"下添加了以下内容
<rescap:Capability
xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities"
Name="runFullTrust" />
Run Code Online (Sandbox Code Playgroud)
然后我将以下内容添加到XML中的"应用程序"中
<Extensions
xmlns:desktop="http://schemas.microsoft.com/appx/manifest/desktop/windows10">
<desktop:Extension
Category="windows.fullTrustProcess"
Executable="fpcalc.exe" />
</Extensions>
Run Code Online (Sandbox Code Playgroud)
然后我修改了依赖项以使我的应用程序在Windows桌面计算机上运行
<Dependencies>
<TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.14393.0" MaxVersionTested="10.0.14393.0" />
</Dependencies>
Run Code Online (Sandbox Code Playgroud)
然后我就可以启动该应用程序了.一旦我完成代码编写,我将测试它并发布正确的解决方案以供将来参考.