/// <summary> /// Сархивировать файлы в MemoryStream /// </summary> /// <param name="attachments">Список файлов</param> /// <returns>Поток данных</returns> public static MemoryStream CreateZipAttachement(List<string> attachments) { _progressZip = FormProgressBar.GetInstance ("Packing log file..."); MemoryStream st = new MemoryStream (); ZipFile zip = new ZipFile (); lock (_progressZip) { foreach (string file in attachments) try { zip.AddFile (file, ""); } catch { } _progressZip.ShowProgressBar (delegate() { zip.Save (st); }); } _progressZip.Dispose (); _progressZip = null; return st; }
/// <summary> /// Сархивировать файлы в MemoryStream /// </summary> /// <param name="attachments">Список файлов</param> /// <returns>Поток данных</returns> public static MemoryStream CreateZipAttachement(List <string> attachments) { _progressZip = FormProgressBar.GetInstance("Packing log file..."); MemoryStream st = new MemoryStream(); ZipFile zip = new ZipFile(); lock (_progressZip) { foreach (string file in attachments) { try { zip.AddFile(file, ""); } catch { } } _progressZip.ShowProgressBar(delegate() { zip.Save(st); }); } _progressZip.Dispose(); _progressZip = null; return(st); }
public void Dispose() { mainProgressBar.Dispose(); }
private void ProgressBarDispose() => _progressBar?.Dispose();