示例#1
0
        /// <summary>
        /// Returns a <see cref="MemoryStream"/> of the raw data.
        /// </summary>
        public MemoryStream GetRawDataStream(SharedExtractParams extractParams)
        {
            var ms = new MemoryStream();

            this.WriteDataToStream(ms, extractParams, false);

            ms.Seek(0, SeekOrigin.Begin);
            return(ms);
        }
示例#2
0
        public void Extract(string destination, bool preserveFolder, string newName, SharedExtractParams extractParams)
        {
            string path = preserveFolder ? this.Folder : string.Empty;

            path = Path.Combine(path, newName);

            if (!string.IsNullOrEmpty(destination))
            {
                path = Path.Combine(destination, path);
            }

            if (!Directory.Exists(Path.GetDirectoryName(path)))
            {
                Directory.CreateDirectory(Path.GetDirectoryName(path));
            }

            using (var fs = File.Create(path))
                this.WriteDataToStream(fs, extractParams);

            if (this.Archive.MatchLastWriteTime)
            {
                File.SetLastWriteTime(path, this.Archive.LastWriteTime);
            }
        }
示例#3
0
 protected abstract void WriteDataToStream(Stream stream, SharedExtractParams extractParams, bool decompress = true);
示例#4
0
 /// <summary>
 /// Returns exact size off entry in <see cref="Archive"/>, which can used to read into <see cref="Stream"/> with <see cref="Offset"/> for example.
 /// </summary>
 public abstract ulong GetSizeInArchive(SharedExtractParams extractParams);