From c559dbccee705bd8b260efc3164eb002374d51e1 Mon Sep 17 00:00:00 2001 From: morkt Date: Mon, 8 Feb 2016 09:24:02 +0400 Subject: [PATCH] (NsaOpener.OpenEntry): use StreamRegion instead of MemoryStream. --- ArcFormats/NScripter/ArcNSA.cs | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/ArcFormats/NScripter/ArcNSA.cs b/ArcFormats/NScripter/ArcNSA.cs index bd9fe81e..0bc7679b 100644 --- a/ArcFormats/NScripter/ArcNSA.cs +++ b/ArcFormats/NScripter/ArcNSA.cs @@ -173,13 +173,9 @@ namespace GameRes.Formats.NScripter var input = arc.File.CreateStream (entry.Offset, entry.Size); return UnpackEntry (input, entry as NsaEntry); } - var data = new byte[entry.Size]; - using (var input = new EncryptedViewStream (arc.File, nsa_arc.Key)) - { - input.Position = entry.Offset; - input.Read (data, 0, data.Length); - } - return UnpackEntry (new MemoryStream (data), entry as NsaEntry); + var encrypted = new EncryptedViewStream (arc.File, nsa_arc.Key); + var stream = new StreamRegion (encrypted, entry.Offset, entry.Size); + return UnpackEntry (stream, entry as NsaEntry); } protected Stream UnpackEntry (Stream input, NsaEntry nsa_entry)