質問

私は私のアプリにSkyDriveバックアップを実装しようとしています。私が簡単にストリームを簡単に閉じる方法を絶縁的なStorarageに簡単に保存する方法を知らない以外はすべてうまく機能しています。

私は私がストリームを脱退してそれを保存するよりも脱気することができることを知っていますが、不必要に複雑になるでしょう。

だから、これが私の問題です:

SkyDriveからファイルを含むストリームを持っていて、ファイル 'settings.xml'としてそれを独自のストレージに保存する必要があります。

基本的に、私は絶縁ストレージのsettings.xmlファイルに 'stream'を書く必要があります

        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?

                }
            }
        }...
.

ありがとう!

役に立ちましたか?

解決

Steamのcopyto()メソッドを使用します - > http://msdn.microsoft。COM / ja-us / library / DD782932.aspx

using (IsolatedStorageFileStream fileStream = myIsolatedStorage.OpenFile(saveToPath, FileMode.Create))    
{    
  stream.CopyTo(fileStream);
} 
.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top