/// <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)); }
/// <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)); }
/// <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); }
/// <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); }
/// <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)); }