public TempUtils( [NotNull] GlobalVariables globalVariables ) { _tempFolder = globalVariables.TempPath; if (LDirectory.Exists(_tempFolder) && LDirectory.EnumerateFileSystemEntries(_tempFolder).Any()) { LDirectory.Delete(_tempFolder, true); } }
public static void ExtractAll(this ZipFile zip, string folder) { LDirectory.Delete(folder, true); LDirectory.CreateDirectory(folder); foreach (ZipEntry entry in zip) { if (entry.IsDirectory) { continue; } LDirectory.CreateDirectory(Path.Combine(folder, Path.GetDirectoryName(entry.Name) ?? String.Empty)); using (var zipStream = zip.GetInputStream(entry)) using (var outputStream = LFile.Create(Path.Combine(folder, entry.Name))) { zipStream.CopyTo(outputStream, 4096); } } }