(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>
Entry FindFile (string filename);
/// <summary>
/// System.IO.File.Exists() analog.
/// </summary>
bool FileExists (string filename);
/// <summary>
/// Open file for reading as stream.
/// </summary>
@ -104,6 +109,11 @@ namespace GameRes
return EntryFromFileInfo (new FileInfo (filename));
}
public bool FileExists (string filename)
{
return File.Exists (filename);
}
public IEnumerable<Entry> GetFiles ()
{
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)
{
return m_arc.OpenEntry (entry);
@ -529,6 +544,11 @@ namespace GameRes
return m_vfs.Top.FindFile (filename);
}
public static bool FileExists (string filename)
{
return m_vfs.Top.FileExists (filename);
}
public static Stream OpenStream (Entry entry)
{
return m_vfs.Top.OpenStream (entry);
@ -544,6 +564,21 @@ namespace GameRes
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)
{
m_vfs.ChDir (entry);