public static Task <IEnumerable <string> > CompressAndSplit (string filePath, double maxPartSizeMB) { if (maxPartSizeMB <= 0) { throw new ArgumentOutOfRangeException(nameof(maxPartSizeMB), maxPartSizeMB, $"“{nameof(maxPartSizeMB)}” must be greater than zero."); } var tcs = new TaskCompletionSource <IEnumerable <string> >(); var tmp7z = Path.GetTempFileName(); var zpr = GetUltra7z2Compressor(); zpr.CompressionFinished += (s, e) => { var parts = FileChunker1.Split(tmp7z, Path .GetTempPath(), maxPartSizeMB); File.Delete(tmp7z); tcs.SetResult(parts); }; zpr.BeginCompressFiles(tmp7z, filePath); return(tcs.Task); }
public static async Task <IEnumerable <string> > DecompressFromSplit (IEnumerable <string> orderedPartsPaths, string outputDir) { var oneBigF = Path.GetTempFileName(); FileChunker1.WriteOneBigFile(oneBigF, orderedPartsPaths); var list = await ExtractArchive(oneBigF, outputDir); File.Delete(oneBigF); return(list); }