如何将文件从隔离存储复制到手机存储WP8? [英] How to copy a file from Isolated Storage to Phone Storage WP8?
问题描述
我正在创建一个创建文本文件并将该文件存储在Isolated Storage中的应用程序。          
if(!myFile.FileExists(sFile))
{
IsolatedStorageFileStream dataFile = myFile.CreateFile(sFile);
dataFile.Close();
}
StreamReader reader = new StreamReader(new IsolatedStorageFileStream(sFile,FileMode.Open,myFile));
string rawData = reader.ReadToEnd();
reader.Close();
StreamWriter sw = new StreamWriter(new IsolatedStorageFileStream(sFile,FileMode.Append,myFile));
string [] hello = new string [] {" av"," vd"," dbg" };
for(int i = 0; i< hello.Length; i ++)
{
sw.WriteLine(hello [i]);
}
sw.Close();
$
&NBSP; &NBSP; &NBSP; &NBSP;
我需要将存储在隔离存储中的文件移动到手机存储中。如何在Windows Phone 8应用程序中实现此目的?
最好的方法是使用FileSavePicker,它将为您提供一个可以打开的文件句柄,将文件中包含的数据存储到。从IsolatedStorage到操作系统中的KnownFolder的一个命令副本 - 至少据我所知 - 是不可能的。
有关FileSavePicker的信息,请参阅此处:
http ://msdn.microsoft.com/library/windows/apps/windows.storage.pickers.filesavepicker.aspx
I was creating an application which creates a text file and storing that file in Isolated Storage.
if (!myFile.FileExists(sFile)) { IsolatedStorageFileStream dataFile = myFile.CreateFile(sFile); dataFile.Close(); } StreamReader reader = new StreamReader(new IsolatedStorageFileStream(sFile, FileMode.Open, myFile)); string rawData = reader.ReadToEnd(); reader.Close(); StreamWriter sw = new StreamWriter(new IsolatedStorageFileStream(sFile, FileMode.Append, myFile)); string[] hello = new string[] { "av", "vd", "dbg" }; for (int i = 0; i < hello.Length; i++) { sw.WriteLine(hello[i]); } sw.Close();
I need to move that file stored in Isolated Storage to the Phone Storage. How to achieve this in Windows Phone 8 application?
The best way is to use the FileSavePicker which will give you a file handle that you can open and store the data contained in the file to. A one-command-copy from IsolatedStorage to a KnownFolder in the OS is - at least to my knowledge - not possible.
For information on the FileSavePicker see here: http://msdn.microsoft.com/library/windows/apps/windows.storage.pickers.filesavepicker.aspx
这篇关于如何将文件从隔离存储复制到手机存储WP8?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!