Initial commit
This commit is contained in:
commit
0f86b0434b
38 changed files with 2370 additions and 0 deletions
29
LibDgf/Utils.cs
Normal file
29
LibDgf/Utils.cs
Normal file
|
@ -0,0 +1,29 @@
|
|||
using LibDgf.Aqualead;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
|
||||
namespace LibDgf
|
||||
{
|
||||
public static class Utils
|
||||
{
|
||||
public static Stream CheckDecompress(Stream stream, bool keepOpen = false)
|
||||
{
|
||||
BinaryReader br = new BinaryReader(stream);
|
||||
if (new string(br.ReadChars(4)) == "ALLZ")
|
||||
{
|
||||
stream.Seek(-4, SeekOrigin.Current);
|
||||
var decoder = new AlLzDecoder();
|
||||
byte[] decoded = decoder.Decode(stream);
|
||||
if (!keepOpen) stream.Close();
|
||||
stream = new MemoryStream(decoded);
|
||||
}
|
||||
else
|
||||
{
|
||||
stream.Seek(-4, SeekOrigin.Current);
|
||||
}
|
||||
return stream;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue