我正在尝试在我的应用程序中实施 SkyDrive 备份。一切正常,除了我不知道如何轻松地将流(使用从 SkyDrive 下载的备份)保存到独立存储中。
我知道我可以对流进行去序列化而不是保存它,但这会不必要地复杂化。
所以,这是我的问题:
我有一个来自 SkyDrive 的文件的流,我需要将它作为文件“Settings.XML”保存到独立存储中。
所以基本上我需要将“流”写入隔离存储中的 Settings.xml 文件
static void client_DownloadCompleted(object sender, LiveDownloadCompletedEventArgs e, string saveToPath)
{
Stream stream = e.Result; //Need to write this into IS
try
{
using (IsolatedStorageFile myIsolatedStorage = IsolatedStorageFile.GetUserStoreForApplication())
{
using (IsolatedStorageFileStream fileStream = myIsolatedStorage.OpenFile(saveToPath, FileMode.Create))
{
//How to save it?
}
}
}...
谢谢!