Esempio n. 1
0
        internal static Stream CreateDecoderStream(CMethodId id, Stream[] inStreams, byte[] info, IPasswordProvider pass,
                                                   long limit)
        {
            switch (id.Id)
            {
            case k_Copy:
                if (info != null)
                {
                    throw new NotSupportedException();
                }
                return(inStreams.Single());

            case k_LZMA:
            case k_LZMA2:
                return(new LzmaStream(info, inStreams.Single(), -1, limit));

#if !NO_CRYPTO
            case CMethodId.kAESId:
                return(new AesDecoderStream(inStreams.Single(), info, pass, limit));
#endif
            case k_BCJ2:
                return(new Bcj2DecoderStream(inStreams, info, limit));

            default:
                throw new NotSupportedException();
            }
        }
Esempio n. 2
0
        internal static Stream CreateDecoderStream(CMethodId id, Stream[] inStreams, byte[] info, IPasswordProvider pass, long limit)
        {
            switch (id.Id)
            {
            case 0L:
                if (info != null)
                {
                    throw new NotSupportedException();
                }
                return(Enumerable.Single <Stream>(inStreams));

            case 0x21L:
            case 0x30101L:
                return(new LzmaStream(info, Enumerable.Single <Stream>(inStreams), -1L, limit));

            case 0x3030103L:
                return(new BCJFilter(false, Enumerable.Single <Stream>(inStreams)));

            case 0x303011bL:
                return(new Bcj2DecoderStream(inStreams, info, limit));

            case 0x30401L:
                return(new PpmdStream(new PpmdProperties(info), Enumerable.Single <Stream>(inStreams), false));

            case 0x40202L:
                return(new BZip2Stream(Enumerable.Single <Stream>(inStreams), CompressionMode.Decompress, true, false));
            }
            throw new NotSupportedException();
        }
Esempio n. 3
0
        internal static Stream CreateDecoderStream(CMethodId id, Stream[] inStreams, byte[] info, IPasswordProvider pass,
                                                   long limit)
        {
            switch (id._id)
            {
            case K_COPY:
                if (info != null)
                {
                    throw new NotSupportedException();
                }
                return(inStreams.Single());

            case K_LZMA:
            case K_LZMA2:
                return(new LzmaStream(info, inStreams.Single(), -1, limit));

#if !NO_CRYPTO
            case CMethodId.K_AES_ID:
                return(new AesDecoderStream(inStreams.Single(), info, pass, limit));
#endif
            case K_BCJ:
                return(new BCJFilter(false, inStreams.Single()));

            case K_BCJ2:
                return(new Bcj2DecoderStream(inStreams, info, limit));

            case K_B_ZIP2:
                return(new BZip2Stream(inStreams.Single(), CompressionMode.Decompress, true));

            case K_PPMD:
                return(new PpmdStream(new PpmdProperties(info), inStreams.Single(), false));

            case K_DEFLATE:
                return(new DeflateStream(inStreams.Single(), CompressionMode.Decompress));

            default:
                throw new NotSupportedException();
            }
        }
Esempio n. 4
0
        internal static Stream CreateDecoderStream(CMethodId id, Stream[] inStreams, byte[] info, IPasswordProvider pass,
                                                   long limit)
        {
            switch (id.Id)
            {
            case k_Copy:
                if (info != null)
                {
                    throw new NotSupportedException();
                }
                return(inStreams.Single());

            case k_LZMA:
            case k_LZMA2:
                return(new LzmaStream(info, inStreams.Single(), -1, limit));

#if !PORTABLE && !NETFX_CORE
            case CMethodId.kAESId:
                return(new AesDecoderStream(inStreams.Single(), info, pass, limit));
#endif
            case k_BCJ:
                return(new BCJFilter(false, inStreams.Single()));

            case k_BCJ2:
                return(new Bcj2DecoderStream(inStreams, info, limit));

            case k_BZip2:
                return(new BZip2Stream(inStreams.Single(), CompressionMode.Decompress, true));

            case k_PPMD:
                return(new PpmdStream(new PpmdProperties(info), inStreams.Single(), false));

            default:
                throw new NotSupportedException();
            }
        }
Esempio n. 5
0
 public bool Equals(CMethodId other)
 {
     return(_id == other._id);
 }
Esempio n. 6
0
 public bool Equals(CMethodId other)
 {
     return Id == other.Id;
 }
Esempio n. 7
0
 public bool Equals(CMethodId other)
 {
     return(Id == other.Id);
 }