예제 #1
0
 internal override void Write(IEnumerable <FilePart> parts, Stream writeStream)
 {
     using (Stream input = new MultiVolumeReadOnlyStream(parts.Cast <RarFilePart>(), Listener))
     {
         RarReaderEntry entry = Entry as RarReaderEntry;
         Unpack         pack  = new Unpack(entry.FileHeader, input, writeStream);
         pack.doUnpack(entry.IsSolid);
     }
 }
예제 #2
0
        protected override EntryStream GetEntryStream()
        {
            var stream = new MultiVolumeReadOnlyStream(CreateFilePartEnumerableForCurrentEntry().Cast <RarFilePart>(), this);

            if (Entry.IsRarV3)
            {
                return(CreateEntryStream(new RarCrcStream(UnpackV1.Value, Entry.FileHeader, stream)));
            }
            return(CreateEntryStream(new RarCrcStream(UnpackV2017.Value, Entry.FileHeader, stream)));
        }
예제 #3
0
 internal override void Skip(IEnumerable <FilePart> parts)
 {
     byte[] buffer = new byte[4096];
     using (Stream s = new MultiVolumeReadOnlyStream(parts.Cast <RarFilePart>(), Listener))
     {
         while (s.Read(buffer, 0, buffer.Length) > 0)
         {
         }
     }
 }
        public void WriteTo(Stream streamToWriteTo, IExtractionListener listener)
        {
            if (IsEncrypted)
            {
                throw new RarExtractionException("Entry is password protected and cannot be extracted.");
            }

            if (IsDirectory)
            {
                throw new RarExtractionException("Entry is a file directory and cannot be extracted.");
            }

            listener.CheckNotNull("listener");
            listener.OnFileEntryExtractionInitialized(FilePath, CompressedSize);
            using (Stream input = new MultiVolumeReadOnlyStream(parts, listener))
            {
                var pack = new Unpack(FileHeader, input, streamToWriteTo);
                pack.doUnpack(Archive.IsSolidArchive());
            }
        }
예제 #5
0
        protected override EntryStream GetEntryStream()
        {
            var stream = new MultiVolumeReadOnlyStream(CreateFilePartEnumerableForCurrentEntry().Cast <RarFilePart>(), this);

            return(CreateEntryStream(new RarCrcStream(pack, Entry.FileHeader, stream)));
        }