/// <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); }
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); } }
protected abstract void WriteDataToStream(Stream stream, SharedExtractParams extractParams, bool decompress = true);
/// <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);