public ErisaNemesisStream(Stream input, int output_length = 0) : base(input) { m_decoder = new NemesisDecodeContext(); m_decoder.AttachInputFile(input); m_decoder.PrepareToDecodeERISANCode(); m_remaining = output_length > 0 ? output_length : int.MaxValue; }
Stream DecodeNemesis(Stream input) { var decoder = new NemesisDecodeContext(); decoder.AttachInputFile(input); decoder.PrepareToDecodeERISANCode(); var file = new MemoryStream((int)input.Length); var buffer = new byte[0x10000]; for (;;) { int read = (int)decoder.DecodeNemesisCodeBytes(buffer, 0x10000); if (0 == read) { break; } file.Write(buffer, 0, read); } file.Position = 0; return(file); }