File tree Expand file tree Collapse file tree 1 file changed +11
-5
lines changed
Expand file tree Collapse file tree 1 file changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -139,6 +139,16 @@ Public Module Extensions
139139 Return New StreamReader(pack.OpenBlock(file), encoding.CodePage).ReadToEnd
140140 End Function
141141
142+ <Extension>
143+ Public Function LoadStream(pack As StreamPack, file As StreamBlock) As MemoryStream
144+ Dim s As Stream = pack.OpenBlock(file)
145+ Dim ms As New MemoryStream
146+ Call s.CopyTo(ms)
147+ Call ms.Flush()
148+ Call ms.Seek(Scan0, SeekOrigin.Begin)
149+ Return ms
150+ End Function
151+
142152 ''' <summary>
143153 ''' Get in-memory stream buffer data from the archive
144154 ''' </summary>
@@ -154,11 +164,7 @@ Public Module Extensions
154164 If pack.GetObject(filename) Is Nothing Then
155165 Return Nothing
156166 Else
157- Dim s As Stream = pack.OpenBlock(filename)
158- Dim ms As New MemoryStream
159- Call s.CopyTo(ms)
160- Call ms.Flush()
161- Return ms
167+ Return pack.LoadStream(pack.GetObject(filename))
162168 End If
163169 End Function
164170End Module
You can’t perform that action at this time.
0 commit comments