public DebArchiveInputStream(Stream inputStream)
            : base(inputStream)
        {
            this.arIn = new ArArchiveInputStream (inputStream);

            ArArchiveEntry binary = arIn.GetNextArEntry ();
            if (!binary.Name.Equals ("debian-binary"))
            {
                // TODO Customize
                throw new IOException ("Invalid name, expected debian-binary, readed:" + binary.Name);
            }
            ArArchiveEntry control = arIn.GetNextArEntry ();
            if (!control.Name.Equals ("control.tar.gz"))
            {
                throw new IOException ("Invalid name, expected control.tar.gz, readed:" + control.Name);
            }
            ArArchiveEntry data = arIn.GetNextArEntry ();
            Stream compressedStream = null;
            if (data.Name.Equals ("data.tar.gz"))
            {
                compressedStream = new GZipStream (arIn, CompressionMode.Decompress);

            }
            else if (data.Name.Equals ("data.tar.bz2"))
            {
                compressedStream = new BZip2InputStream (arIn);
            }
            else if (data.Name.Equals ("data.tar.bz2"))
            {
                compressedStream = new LZMAInputStream (arIn);

            }
            else if (data.Name.Equals ("data.tar"))
            {
                compressedStream = arIn;
            }
            else
            {
                throw new IOException ("Unsupported compressed data:" + data.Name);
            }
            this.tarStream = new TarInputStream (compressedStream);
        }
Exemple #2
0
 protected override void _Unir(string fichero, string dirDest)
 {
     ArArchiveInputStream instream = new ArArchiveInputStream (File.OpenRead (fichero));
     ArchiveExtractor.Extract (instream, dirDest, this, new FileInfo (fichero).Length);
 }