2 using System.Collections.Generic;
5 using System.IO.IsolatedStorage;
22 public override bool Exists(
string fileName )
24 var userStore =
FMAssert( IsolatedStorageFile.GetUserStoreForApplication,
false, null );
25 if ( userStore == null )
return false;
27 MakeAbsolute( ref fileName );
28 return FMAssert( userStore.FileExists,
false,
false, fileName );
36 public override bool ChDir(
string path )
38 var userStore =
FMAssert( IsolatedStorageFile.GetUserStoreForApplication,
false, null );
39 if ( userStore == null )
return false;
41 if ( !
FMAssert( userStore.DirectoryExists,
false,
false, path ) )
52 public override void MkDir(
string path )
54 var userStore =
FMAssert( IsolatedStorageFile.GetUserStoreForApplication,
false, null );
55 if ( userStore == null )
return;
57 MakeAbsolute( ref path );
58 FMAssert( userStore.CreateDirectory,
true, path );
65 public override void RmDir(
string path )
67 var userStore =
FMAssert( IsolatedStorageFile.GetUserStoreForApplication,
false, null );
68 if ( userStore == null )
return;
70 MakeAbsolute( ref path );
71 FMAssert( userStore.DeleteDirectory,
true, path );
76 var userStore =
FMAssert( IsolatedStorageFile.GetUserStoreForApplication,
false, null );
77 if ( userStore == null )
return new List<string>();
79 string[] fileList =
FMAssert( userStore.GetFileNames,
false,
new string[] { },
_currentDir +
"\\*" );
80 return fileList.ToList<
string>().AsReadOnly();
91 MakeAbsolute( ref fileName );
92 var stream =
FMAssert( openFileStream, write, null, fileName, write );
96 private Stream openFileStream(
string fileName,
bool write )
98 var userStore = IsolatedStorageFile.GetUserStoreForApplication();
99 FileMode mode = write ? FileMode.Create : FileMode.Open;
100 FileAccess access = write ? FileAccess.ReadWrite : FileAccess.Read;
101 return userStore.OpenFile( fileName, mode, access );
108 public override void Delete(
string fileName )
110 var userStore =
FMAssert( IsolatedStorageFile.GetUserStoreForApplication,
false, null );
111 if ( userStore == null )
return;
113 MakeAbsolute( ref fileName );
114 FMAssert( userStore.DeleteFile,
true, fileName );
void FMAssert(Action func, bool write)
override void Delete(string fileName)
Poistaa tiedoston.
override bool Exists(string fileName)
Kertoo onko tiedosto tai hakemisto olemassa.
override bool ChDir(string path)
Vaihtaa työhakemistoa.
override void MkDir(string path)
Luo uuden hakemiston.
override void RmDir(string path)
Tuhoaa hakemiston. Heittää poikkeuksen jos hakemisto ei ole tyhjä.
override StorageFile Open(string fileName, bool write)
Avaa tiedoston.
override IList< string > GetFileList()