tes*_*ing 7 assets windows-mobile filepath win-universal-app
如何使用File.ReadAllBytes()从Assets文件夹中读取文件到byte[]?因此我需要一个文件路径.我试过了ms-appx-web:///Assets/test.jpg,但那没用.File.Exists()返回false.
如何获取assets文件夹的绝对路径?
Sou*_*jan 12
这个片段应该做,
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);
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2314 次 |
| 最近记录: |