コード例 #1
0
        /// <summary>
        /// extracts a file from the archive, decompresses it and returns the file information.
        /// </summary>
        /// <param name="fileName"></param>
        /// <returns></returns>
        public ArchiveFile GetFile(String fileName)
        {
            // get the index file:
            ArchiveFileIndex index = _index[fileName];

            // return the archive file object
            return(GetFile(index));
        }
コード例 #2
0
        /// <summary>
        /// extract an archive file from the source stream.
        /// </summary>
        /// <param name="source"></param>
        /// <param name="index"></param>
        /// <returns></returns>
        public static ArchiveFile ExtractArchive(Stream source, ArchiveFileIndex index)
        {
            // seek to the start index of the file:
            source.Seek(index.FileStartIndex, SeekOrigin.Begin);

            // read the block of data:
            byte[] archiveData = ReadBuffer(source, index.FileLength);

            // deserialize the file:
            return(ArchiveFile.FromByteArray(archiveData));
        }
コード例 #3
0
        /// <summary>
        /// extract an archive file from the source stream.
        /// </summary>
        /// <param name="source"></param>
        /// <param name="index"></param>
        /// <returns></returns>
        public static ArchiveFile ExtractArchive(Stream source, ArchiveFileIndex index)
        {
            // seek to the start index of the file:
            source.Seek(index.FileStartIndex, SeekOrigin.Begin);

            // read the block of data:
            byte[] archiveData = ReadBuffer(source, index.FileLength);

            // deserialize the file:
            return ArchiveFile.FromByteArray(archiveData);
        }
コード例 #4
0
 /// <summary>
 /// extracts a file from the archive using the index.
 /// </summary>
 /// <param name="fileIndex"></param>
 /// <returns></returns>
 public ArchiveFile GetFile(ArchiveFileIndex fileIndex)
 {
     using (Stream s = GetStream())
         return fileIndex.ExtractFile(s);
 }
コード例 #5
0
 /// <summary>
 /// extracts a file from the archive using the index.
 /// </summary>
 /// <param name="fileIndex"></param>
 /// <returns></returns>
 public ArchiveFile GetFile(ArchiveFileIndex fileIndex)
 {
     using (Stream s = GetStream())
         return(fileIndex.ExtractFile(s));
 }