/// <summary> /// Extract to specific directory, retaining filename /// </summary> public static void WriteToDirectory(this RarArchiveEntry entry, string destinationDirectory, CancellationToken cancellation, IRarExtractionListener listener, ExtractOptions options = ExtractOptions.Overwrite) { string destinationFileName = string.Empty; string file = Path.GetFileName(entry.FilePath); if (options.HasFlag(ExtractOptions.ExtractFullPath)) { string folder = Path.GetDirectoryName(entry.FilePath); destinationDirectory = Path.Combine(destinationDirectory, folder); destinationFileName = Path.Combine(destinationDirectory, file); } else { destinationFileName = Path.Combine(destinationDirectory, file); } if (!Directory.Exists(destinationDirectory)) { Directory.CreateDirectory(destinationDirectory); } entry.WriteToFile(destinationFileName, cancellation, listener, options); }
/// <summary> /// Extract to specific file /// </summary> public static void WriteToFile(this RarArchiveEntry entry, string destinationFileName, CancellationToken cancellation, ExtractOptions options = ExtractOptions.Overwrite) { entry.WriteToFile(destinationFileName, cancellation, new NullRarExtractionListener(), options); }