From 7f4b01b7ca6285f4f379308d5cb18ac6166e349d Mon Sep 17 00:00:00 2001 From: morkt Date: Tue, 2 Jun 2015 22:53:20 +0400 Subject: [PATCH] (ArcFile.OpenSeekableEntry): new public method. --- GameRes/ArcFile.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/GameRes/ArcFile.cs b/GameRes/ArcFile.cs index 80957ac8..59633b79 100644 --- a/GameRes/ArcFile.cs +++ b/GameRes/ArcFile.cs @@ -143,6 +143,22 @@ namespace GameRes return m_interface.OpenEntry (this, entry); } + /// + /// Open specified as a seekable Stream. + /// + public Stream OpenSeekableEntry (Entry entry) + { + var input = OpenEntry (entry); + if (input.CanSeek) + return input; + using (input) + { + var copy = new MemoryStream ((int)entry.Size); + input.CopyTo (copy); + return copy; + } + } + /// /// Create file corresponding to within current directory and open /// it for writing.