我下载了一个文件并用隔离存储保存..我想知道我是否有办法在模拟器的内存中查看该文件..这是某种方式吗?
答案 0 :(得分:2)
从IO的角度来看,仿真器中的隔离存储就像真实设备上的隔离存储一样。例如,要将文本文件保存到隔离存储调用:
IsolatedStorageFile myIsolatedStorage = IsolatedStorageFile.GetUserStoreForApplication();
//create new file
using (StreamWriter writeFile = new StreamWriter(new IsolatedStorageFileStream("myFile.txt", FileMode.Create, FileAccess.Write, myIsolatedStorage)))
{
string someTextData = "This is some text data to be saved in a new text file in the IsolatedStorage!";
writeFile.WriteLine(someTextData);
writeFile.Close();
}
从隔离存储中读取它:
IsolatedStorageFile myIsolatedStorage = IsolatedStorageFile.GetUserStoreForApplication();
IsolatedStorageFileStream fileStream = myIsolatedStorage.OpenFile("myFile.txt", FileMode.Open, FileAccess.Read);
using (StreamReader reader = new StreamReader(fileStream))
{ //Visualize the text data in a TextBlock text
this.text.Text = reader.ReadLine();
}
提供
答案 1 :(得分:1)
在这里,下面这个链接帮助我了解隔离存储的一切。 希望这对你有帮助。