public void DeleteBackup(BackupDefenition bs) { if (bs == null) { return; } try { if (Backups.ContainsKey(bs.Name)) { Backups.Remove(bs.Name); } foreach (XmlElement xmlElement in _backupXml.ChildNodes) { if (xmlElement.GetAttribute("name").Equals(bs.Name)) { _backupXml.RemoveChild(xmlElement); } } _backupXml.Save(_backupXmlPath); } catch (Exception ex) { Logger.Log(LogLevel.Severe, "Backupmanager", "Severe error in deleteBackup(bs)!", ex.Message); } if (BackupsLoaded != null) { BackupsLoaded(); } }
public void RemoveBackup(string filePath) { var backup = Backups.FirstOrDefault(b => b.OriginalFilePath == filePath); if (backup is null) { BackupLogger.GetInstance().Error( $"Backup for the file {filePath} does not exist in the current backup system."); return; } Backups.Remove(backup); BackupLogger.GetInstance().Info($"Backup for the file {filePath} was removed from the current backup system."); }