Windows mobile UWP:File.ReadAllBytes来自资产文件夹中的文件
如何使用Windows mobile UWP:File.ReadAllBytes来自资产文件夹中的文件,windows-mobile,win-universal-app,assets,filepath,Windows Mobile,Win Universal App,Assets,Filepath,如何使用File.ReadAllBytes()将文件从Assets文件夹读入byte[]?因此,我需要一个文件路径。我试过使用msappx-web:///Assets/test.jpg,但这不起作用文件.Exists()返回false 如何获得资产文件夹的绝对路径?此片段应该可以 string fname = @"Assets\test.jpg"; StorageFolder InstallationFolder = Windows.ApplicationModel.Package.Curren
File.ReadAllBytes()
将文件从Assets
文件夹读入byte[]
?因此,我需要一个文件路径。我试过使用msappx-web:///Assets/test.jpg
,但这不起作用<代码>文件.Exists()返回false
如何获得资产文件夹的绝对路径?此片段应该可以
string fname = @"Assets\test.jpg";
StorageFolder InstallationFolder = Windows.ApplicationModel.Package.Current.InstalledLocation;
StorageFile file = await InstallationFolder.GetFileAsync(fname);
if(File.Exists(file.Path))
{
var contents = File.ReadAllBytes(file.Path);
}
文件将被读取两次吗?在这种情况下如何使用
File.Exists()
?