(IFileSystem.FileExists): new method.

This commit is contained in:
morkt 2015-09-01 14:13:11 +04:00
parent 1db7e865cd
commit a149cab7e6

View File

@ -40,6 +40,11 @@ namespace GameRes
/// <exception cref="FileNotFoundException">File is not found.</exception> /// <exception cref="FileNotFoundException">File is not found.</exception>
Entry FindFile (string filename); Entry FindFile (string filename);
/// <summary>
/// System.IO.File.Exists() analog.
/// </summary>
bool FileExists (string filename);
/// <summary> /// <summary>
/// Open file for reading as stream. /// Open file for reading as stream.
/// </summary> /// </summary>
@ -104,6 +109,11 @@ namespace GameRes
return EntryFromFileInfo (new FileInfo (filename)); return EntryFromFileInfo (new FileInfo (filename));
} }
public bool FileExists (string filename)
{
return File.Exists (filename);
}
public IEnumerable<Entry> GetFiles () public IEnumerable<Entry> GetFiles ()
{ {
var info = new DirectoryInfo (CurrentDirectory); var info = new DirectoryInfo (CurrentDirectory);
@ -192,6 +202,11 @@ namespace GameRes
} }
} }
public bool FileExists (string filename)
{
return m_dir.ContainsKey (filename);
}
public Stream OpenStream (Entry entry) public Stream OpenStream (Entry entry)
{ {
return m_arc.OpenEntry (entry); return m_arc.OpenEntry (entry);
@ -529,6 +544,11 @@ namespace GameRes
return m_vfs.Top.FindFile (filename); return m_vfs.Top.FindFile (filename);
} }
public static bool FileExists (string filename)
{
return m_vfs.Top.FileExists (filename);
}
public static Stream OpenStream (Entry entry) public static Stream OpenStream (Entry entry)
{ {
return m_vfs.Top.OpenStream (entry); return m_vfs.Top.OpenStream (entry);
@ -544,6 +564,21 @@ namespace GameRes
return m_vfs.Top.OpenView (entry); return m_vfs.Top.OpenView (entry);
} }
public static Stream OpenStream (string filename)
{
return m_vfs.Top.OpenStream (m_vfs.Top.FindFile (filename));
}
public static Stream OpenSeekableStream (string filename)
{
return m_vfs.Top.OpenSeekableStream (m_vfs.Top.FindFile (filename));
}
public static ArcView OpenView (string filename)
{
return m_vfs.Top.OpenView (m_vfs.Top.FindFile (filename));
}
public static void ChDir (Entry entry) public static void ChDir (Entry entry)
{ {
m_vfs.ChDir (entry); m_vfs.ChDir (entry);