From 6c6c6be7a05bbf8b90bcf8b2f0dc6f8f2dab006a Mon Sep 17 00:00:00 2001 From: morkt Date: Thu, 19 Nov 2015 11:35:56 +0400 Subject: [PATCH] (ArcView.ReadBytes): new method. --- GameRes/ArcView.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/GameRes/ArcView.cs b/GameRes/ArcView.cs index d5e76d9e..10093ca5 100644 --- a/GameRes/ArcView.cs +++ b/GameRes/ArcView.cs @@ -365,6 +365,18 @@ namespace GameRes return total; } + /// + /// Read bytes starting from into byte array and return that array. + /// Returned array could be less than bytes length if end of the mapped file was reached. + /// + public byte[] ReadBytes (long offset, uint count) + { + count = Math.Min (count, Reserve (offset, count)); + var data = new byte[count]; + Read (offset, data, 0, count); + return data; + } + public byte ReadByte (long offset) { Reserve (offset, 1);