I am stuck at this problem - obviously, I am doing something wrong.
First, I download a zip file via WebClient and storing it into IsolatedStorage:
using (var isf = IsolatedStorageFile.GetUserStoreForApplication())
{
if (!isf.DirectoryExists("AppData")) isf.CreateDirectory("AppData");
using (StreamWriter sw = new StreamWriter(new IsolatedStorageFileStream("AppData\\" + FileName, FileMode.OpenOrCreate, isf)))
{
sw.Write(new StreamReader(e.Result).ReadToEnd());
}
}
Next, I extract one specific file out of the WebClient response (the zip file):
Uri fileUri = new Uri("content.txt", UriKind.Relative);
StreamResourceInfo info = new StreamResourceInfo(e.Result, null);
StreamResourceInfo streamInfo = System.Windows.Application.GetResourceStream(info, fileUri);
This works as expected. Later on, I want to extract the "content.txt" from the zip file in IsolatedStorage with this:
using (IsolatedStorageFileStream isfs = isf.OpenFile("AppData\\" + FileName, FileMode.Open, FileAccess.Read))
{
if (myIsolatedStorage.FileExists("AppData\\" + FileName))
{
Uri fileUri = new Uri("content.txt", UriKind.Relative);
StreamResourceInfo info = new StreamResourceInfo(isfs, null);
StreamResourceInfo streamInfo = System.Windows.Application.GetResourceStream(info, fileUri);
}
}
Although the zip archive can be found, streamInfo is always null. What am I doing wrong?