protected override RecordNode DecodeDelegate() { byte[] value = (compressedNode.Values[0] as EsfValueNode <byte[]>).Value; ParentNode parentNode = compressedNode.Children[0]; uint value2 = (parentNode.Values[0] as EsfValueNode <uint>).Value; byte[] value3 = (parentNode.Values[1] as EsfValueNode <byte[]>).Value; Decoder decoder = new Decoder(); decoder.SetDecoderProperties(value3); byte[] array = new byte[value2]; using (MemoryStream inStream = new MemoryStream(value, writable: false)) { using (MemoryStream memoryStream = new MemoryStream(array)) { decoder.Code(inStream, memoryStream, value.Length, value2, null); array = memoryStream.ToArray(); } } AbcaFileCodec abcaFileCodec = new AbcaFileCodec(); EsfNode esfNode = abcaFileCodec.Parse(array); using (BinaryReader reader = new BinaryReader(new MemoryStream(array))) { esfNode = abcaFileCodec.Parse(reader); } return(esfNode as RecordNode); }
// unzip contained 7zip node protected override RecordNode DecodeDelegate() { #if DEBUG Console.WriteLine("decompressing"); #endif List <EsfNode> values = compressedNode.Values; byte[] data = (values[0] as EsfValueNode <byte[]>).Value; ParentNode infoNode = compressedNode.Children[0]; uint size = (infoNode.Values[0] as EsfValueNode <uint>).Value; byte[] decodeProperties = (infoNode.Values[1] as EsfValueNode <byte[]>).Value; LzmaDecoder decoder = new LzmaDecoder(); decoder.SetDecoderProperties(decodeProperties); // DecompressionCodeProgress progress = new DecompressionCodeProgress(this); byte[] outData = new byte[size]; using (MemoryStream inStream = new MemoryStream(data, false), outStream = new MemoryStream(outData)) { decoder.Code(inStream, outStream, data.Length, size, null); outData = outStream.ToArray(); } EsfNode result; AbcaFileCodec codec = new AbcaFileCodec(); result = codec.Parse(outData); using (BinaryReader reader = new BinaryReader(new MemoryStream(outData))) { result = codec.Parse(reader); } return(result as RecordNode); }