// will be slow on lots of data, different aproach is to use Find when the data is needed (returns a Stream but you need to keep the zipped file open) public static Item[] UnzipItems(string Source) { using (ZippedFile zpf = File.Open(Source, FileMode.Open, FileAccess.Read, FileShare.Read)) { return(zpf.GetAllItems()); } }
public static void UnzipFolder(string Folder, string Source) { using (ZippedFile zpf = File.Open(Source, FileMode.Open, FileAccess.Read, FileShare.Read)) { var items = zpf.GetAllItems(); var destf = Folder + @"\" + Path.GetFileNameWithoutExtension(Source); if (!Directory.Exists(destf)) { Directory.CreateDirectory(destf); } foreach (var item in items) { File.WriteAllBytes(destf + @"\" + item.Name, item.Data); // + "." + item.Extension); } } }