public static void WriteEntryTo(this RarReader reader, FileInfo filePath, CancellationToken cancellation) { using (Stream stream = filePath.Open(FileMode.Create)) { reader.WriteEntryTo(stream, cancellation); } }
public static void WriteEntryTo(this RarReader reader, string filePath, CancellationToken cancellation) { using (Stream stream = File.Open(filePath, FileMode.Create, FileAccess.Write)) { reader.WriteEntryTo(stream, cancellation); } }
/// <summary> /// Extract to specific file /// </summary> public static void WriteEntryToFile(this RarReader reader, string destinationFileName, CancellationToken cancellation, ExtractOptions options = ExtractOptions.Overwrite) { FileMode fm = FileMode.Create; if (!options.HasFlag(ExtractOptions.Overwrite)) { fm = FileMode.CreateNew; } using (FileStream fs = File.Open(destinationFileName, fm)) { reader.WriteEntryTo(fs, cancellation); } }