From a149cab7e645ceafb088d1c2fa7aed74226e2407 Mon Sep 17 00:00:00 2001 From: morkt Date: Tue, 1 Sep 2015 14:13:11 +0400 Subject: [PATCH] (IFileSystem.FileExists): new method. --- GameRes/FileSystem.cs | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/GameRes/FileSystem.cs b/GameRes/FileSystem.cs index 5227f194..eb4f26c9 100644 --- a/GameRes/FileSystem.cs +++ b/GameRes/FileSystem.cs @@ -40,6 +40,11 @@ namespace GameRes /// File is not found. Entry FindFile (string filename); + /// + /// System.IO.File.Exists() analog. + /// + bool FileExists (string filename); + /// /// Open file for reading as stream. /// @@ -104,6 +109,11 @@ namespace GameRes return EntryFromFileInfo (new FileInfo (filename)); } + public bool FileExists (string filename) + { + return File.Exists (filename); + } + public IEnumerable 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);