2 using System.Collections.Generic;
6 using System.Security.Permissions;
13 private string[] pathCandidates;
17 this.pathCandidates = pathCandidates;
25 for (
int i = 0; i < pathCandidates.Length; i++ )
34 if ( !parent.Exists )
continue;
50 public override bool Exists(
string fileName )
53 MakeAbsolute( ref fileName );
54 return FMAssert( File.Exists,
false,
false, fileName ) ||
FMAssert( Directory.Exists,
false,
false, fileName );
62 public override bool ChDir(
string path )
65 MakeAbsolute( ref path );
67 if ( !
FMAssert( Directory.Exists,
false,
false, path ) )
78 public override void MkDir(
string path )
81 MakeAbsolute( ref path );
82 FMAssert( Directory.CreateDirectory,
true, null, path );
90 public override void RmDir(
string path )
93 MakeAbsolute( ref path );
94 FMAssert( Directory.Delete,
true, path );
105 return fileList.ToList<
string>().AsReadOnly();
117 MakeAbsolute( ref fileName );
118 Stream stream =
FMAssert( openFileStream, write, null, fileName, write );
122 private Stream openFileStream(
string fileName,
bool write)
124 FileMode mode = write ? FileMode.Create : FileMode.Open;
125 FileAccess access = write ? FileAccess.ReadWrite : FileAccess.Read;
126 return new FileStream( fileName, mode, access );
134 public override void Delete(
string fileName )
137 MakeAbsolute( ref fileName );
138 FMAssert( File.Delete,
true, fileName );
150 public static readonly
string MyDocuments = Environment.GetFolderPath( Environment.SpecialFolder.MyDocuments );
155 public static readonly
string MyMusic = Environment.GetFolderPath( Environment.SpecialFolder.MyMusic );
160 public static readonly
string MyPictures = Environment.GetFolderPath( Environment.SpecialFolder.MyPictures );
165 public static readonly
string MyVideos = Environment.GetFolderPath( Environment.SpecialFolder.MyVideos );
170 public static readonly
string ExePath = Path.GetDirectoryName( Application.ExecutablePath );
175 public static readonly
string DataPath = Path.Combine( Path.GetDirectoryName( Application.ExecutablePath ),
"Data" );
180 public static readonly
string ContentPath = Path.Combine( Path.GetDirectoryName( Application.ExecutablePath ),
"Content" );
void FMAssert(Action func, bool write)
override IList< string > GetFileList()
Antaa listan nykyisessä hakemistossa olevista tiedostoista.
override void Delete(string fileName)
Poistaa tiedoston. Ei heitä poikkeusta, jos tiedostoa ei ole olemassa.
override void MkDir(string path)
Luo uuden hakemiston.
override void RmDir(string path)
Tuhoaa hakemiston. Heittää poikkeuksen jos hakemisto ei ole tyhjä. Ei heitä poikkeusta, jos hakemistoa ei ole olemassa.
WindowsFileManager(params string[] pathCandidates)
override StorageFile Open(string fileName, bool write)
Avaa tiedoston.
override bool Exists(string fileName)
Kertoo onko tiedosto tai hakemisto olemassa.
override void Initialize()
Peliluokka reaaliaikaisille peleille.
override bool ChDir(string path)
Vaihtaa työhakemistoa.
Usein käytettyjä polkuja Windowsissa.