Exemplo n.º 1
0
        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);
        }
Exemplo n.º 3
0
        static EsfCodec CodecFromCode(uint code)
        {
            EsfCodec codec = null;

            switch (code)
            {
            case 0xABCE:
                codec = new AbceCodec();
                break;

            case 0xABCF:
                codec = new AbcfFileCodec();
                break;

            case 0xABCA:
                codec = new AbcaFileCodec();
                break;
            }
            return(codec);
        }
Exemplo n.º 4
0
        private static EsfCodec CodecFromCode(uint code)
        {
            EsfCodec result = null;

            switch (code)
            {
            case 43982u:
                result = new AbceCodec();
                break;

            case 43983u:
                result = new AbcfFileCodec();
                break;

            case 43978u:
                result = new AbcaFileCodec();
                break;
            }

            return(result);
        }