/// <summary> /// </summary> /// <param name="backupFile"></param> public void BackupGameFile(BackupFile backupFile) { try { FtpExtensions.DownloadFile(backupFile.LocalPath, backupFile.InstallPath); _ = XtraMessageBox.Show($"Successfully backed up file {backupFile.FileName} from {backupFile.InstallPath}.", "Success"); } catch (Exception ex) { Program.Log.Error(ex, $"Unable to backup game file. Error: {ex.Message}"); _ = DarkMessageBox.ShowError("There was a problem downloading the file. Make sure the file exists on your console.", "Error"); } }
/// <summary> /// Create/store a backup of the specified file, and then downloads it locally to a known path /// </summary> /// <param name="modItem"></param> /// <param name="fileName"></param> /// <param name="installFilePath"></param> public void CreateBackupFile(ModItem modItem, string fileName, string installFilePath) { var fileBackupFolder = GetGameBackupFolder(modItem); _ = Directory.CreateDirectory(fileBackupFolder); var backupFile = new BackupFile { CategoryId = modItem.GameId, FileName = fileName, LocalPath = Path.Combine(fileBackupFolder, fileName), InstallPath = installFilePath }; FtpExtensions.DownloadFile(backupFile.LocalPath, backupFile.InstallPath); BackupFiles.Add(backupFile); }