public void Save(int tenant) { SetupProgress(tenant); using (var backupWriter = new ZipWriteOperator(backup)) { var doc = new XDocument(new XElement(ROOT, new XAttribute("tenant", tenant))); foreach (var provider in providers.Values) { try { var elements = provider.GetElements(tenant, configs, backupWriter); if (elements != null) { doc.Root.Add(new XElement(provider.Name, elements)); } } catch (Exception ex) { OnProgressError(ex); } } var data = Encoding.UTF8.GetBytes(doc.ToString(SaveOptions.None)); var stream = backupWriter.BeginWriteEntry(XML_NAME); stream.Write(data, 0, data.Length); backupWriter.EndWriteEntry(); } }
public void Save(int tenant) { using (var backupWriter = new ZipWriteOperator(backup)) { var doc = new XDocument(new XElement(ROOT, new XAttribute("tenant", tenant))); foreach (var provider in providers.Values) { var elements = provider.GetElements(tenant, configs, backupWriter); if (elements != null) { doc.Root.Add(new XElement(provider.Name, elements)); } } var data = Encoding.UTF8.GetBytes(doc.ToString(SaveOptions.None)); var stream = backupWriter.BeginWriteEntry(XML_NAME); stream.Write(data, 0, data.Length); backupWriter.EndWriteEntry(); } ProgressChanged(this, new ProgressChangedEventArgs(string.Empty, 100, true)); }