public void Backup(string filePath, string srcFolder, byte[] archHeader) { Initializing?.Invoke(); FilesBag bag = CreateBag(srcFolder); FileStream fsDest = null; try { fsDest = File.Create(filePath); var writer = new RawDataWriter(fsDest, Encoding.UTF8); writer.Write(Signature); writer.Write(DateTime.Now); writer.Write(archHeader.Length); writer.Write(archHeader); Compressing?.Invoke(); bag.Compress(fsDest); Done?.Invoke(); } catch { if (fsDest != null) { fsDest.Dispose(); File.Delete(filePath); } throw; } }
private void OnCompressing(ProgressEventArgs e) { Compressing?.Invoke(this, e); }