IsolatedStorageFile storefile1 = IsolatedStorageFile.GetStore(
IsolatedStorageScope.User |
IsolatedStorageScope.Assembly,
null,
null);
IsolatedStorageFile storefile1 = IsolatedStorageFile.GetStore(
IsolatedStorageScope.User |
IsolatedStorageScope.Assembly |
IsolatedStorageScope.Domain,
null,
null);
IsolatedStorageFile storefile1 = IsolatedStorageFile.GetStore(
IsolatedStorageScope.User |
IsolatedStorageScope.Assembly |
IsolatedStorageScope.Roaming,
null,
null);
IsolatedStorageFile storefile1 = IsolatedStorageFile.GetStore(
IsolatedStorageScope.User |
* IsolatedStorageScope.Assembly |
IsolatedStorageScope.Domain |
IsolatedStorageScope.Roaming,
null,
null);
*/
IsolatedStorageFileStream stream1
=
new
IsolatedStorageFileStream("file1.txt",
FileMode.Create, store1);
StreamWriter writer =
new StreamWriter(stream1);
writer.WriteLine("Hello Isolated
Storage");
writer.Close();
stream1.Close();
store1.Close();
// Read from a file in isolated storage
IsolatedStorageFileStream
stream2 =
new
IsolatedStorageFileStream("file2.txt",
FileMode.Open, store1);
StreamReader reader =
new StreamReader(stream1);
String sb = reader.ReadToEnd();
reader.Close();
stream1.Close();
store1.Close();
// Obtain a store
// Create a directory
store1.CreateDirectory("dir1");
// Create two directories, one inside the
other
store1.CreateDirectory("dir2/dir3");
// Create a directory
store1.CreateDirectory("dir4");
// Delete the directory
store1.DeleteDirectory("dir4");
// Obtain a store
IsolatedStorageFile store2
=
IsolatedStorageFile.GetUserStoreForDomain();
// Create an empty file
IsolatedStorageFileStream
stream3 =
new
IsolatedStorageFileStream("file3.txt",
FileMode.Create, store1);
stream1.Close();
// Delete the file
store1.DeleteFile("file3.txt");
// Find a storage space available
// Obtain a store
IsolatedStorageFile store3
=
IsolatedStorageFile.GetUserStoreForDomain();
// Compute the storage available in the
store
ulong spaceLeft =
store1.MaximumSize - store1.CurrentSize;
// Enumerate files and directories
// Obtain a store
IsolatedStorageFile store4
=
IsolatedStorageFile.GetUserStoreForDomain();
// Get all of the directories in the root
of the store
string[] directories =
store1.GetDirectoryNames("*");
// Get all of the files in the root of the
store
string[] files =
store1.GetFileNames("*");
}
}
}