如何在Windows应用商店应用中访问文件! [英] How Can I Access File In Windows Store App!
问题描述
嗨! Hi! 这篇关于如何在Windows应用商店应用中访问文件!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
如何在不使用FileOpenPicker控件的Windows应用商店中访问文件。
在c#中这样:
< pre lang =c#> string [] filelist = Directory.GetFiles( @ d:\跨度>);
FileStream fs = new FileStream( @ D:\ab.jpg,FileMode.OpenOrCreate,FileAccess.ReadWrite);
FileStream fs2 = new FileStream(filelist [ 0 ],FileMode.OpenOrCreate,FileAccess.ReadWrite );
谢谢!我想您可以尝试访问appData下LocalFolder下的选项。例如,有一些方法,如CreateFile,GetFileAsync,OpenFileAsync等。
等待ApplicationData.Current.LocalFolder.CreateFileAsync(fileName,CreationCollisionOption.ReplaceExisting);
尝试使用GetFileAsync并根据您是否获得有效的o / p或命中异常,您可以继续前进。
请查看 http://msdn.microsoft.com/ en-us / library / windows / apps / windows.storage.applicationdata.aspx [ ^ ]了解有关应用数据的更多信息
How can i access file in Windows store app not using the FileOpenPicker control.
Like this in c#:
string [] filelist = Directory.GetFiles(@"d:\");
FileStream fs = new FileStream(@"D:\ab.jpg", FileMode.OpenOrCreate, FileAccess.ReadWrite);
FileStream fs2 = new FileStream(filelist[0], FileMode.OpenOrCreate, FileAccess.ReadWrite);
Thank you!I think you can try accessing options under the LocalFolder under your appData. For example there are methods like CreateFile, GetFileAsync, OpenFileAsync etc.
await ApplicationData.Current.LocalFolder.CreateFileAsync(fileName, CreationCollisionOption.ReplaceExisting);
Try using GetFileAsync and based whether you get a valid o/p or hit exceptions you can move forward with what you want to do.
Do check http://msdn.microsoft.com/en-us/library/windows/apps/windows.storage.applicationdata.aspx[^] for more information on Application Data