public int[] Decompress(string data, ref int algorithm)
{
// TODO: this is not exactly what the C++ version does
if (algorithm <= 0)
{
algorithm = (int)data[0];
}
int length = ((byte)(data[1]) << 16) | ((byte)(data[2]) << 8) | ((byte)(data[3]));
BitStringReader reader = new BitStringReader(data);
reader.Read(8);
reader.Read(8);
reader.Read(8);
reader.Read(8);
m_result = new List<int>(length);
for (int i = 0; i < length; i++)
{
m_result.Add(-1);
}
reader.Reset();
ReadNormalBits(reader);
reader.Reset();
ReadExceptionBits(reader);
UnpackBits();
// TODO: no list needed?
return m_result.ToArray();
}