コード例 #1
0
        // 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);
        }
コード例 #2
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);
        }