public StableBackupsManager(WaBackupsViewModel waBackupsViewModel) : base(waBackupsViewModel) { DataDirPath = AppContext.StableDataDir; BackupDirPath = AppContext.WaBackupStableDir; BuildType = AppContext.StableKey; }
public BetaBackupsManager(WaBackupsViewModel waBackupsViewModel) : base(waBackupsViewModel) { DataDirPath = AppContext.BetaDataDir; BackupDirPath = AppContext.WaBackupBetaDir; BuildType = AppContext.BetaKey; }
protected BackupsManager(WaBackupsViewModel waBackupsViewModel) { this.waBackupsViewModel = waBackupsViewModel; }
public ManageWaBackups(WaBackupsViewModel viewModel) { InitializeComponent(); DataContext = viewModel; }
public WaBackup(string filePath, string verificationBuildType, BackupsManager manager, WaBackupsViewModel baseViewModel) { this.manager = manager; this.baseViewModel = baseViewModel; FilePath = filePath; SetNames(verificationBuildType); RestoreCommand = new DelegateCommand(() => { try { Restore(); } catch (Exception exception) { ErrorManager.ShowWarning(exception.Message, exception); } }); DeleteCommand = new DelegateCommand(() => { try { Delete(); } catch (Exception exception) { ErrorManager.ShowWarning(exception.Message, exception); } }); }
public static WaBackup Create(string backupName, string buildType, string sourceDirPath, string targetDirPath, BackupsManager manager, WaBackupsViewModel baseViewModel) { ValidateName(backupName); using (new WurmAssistantGateway(AppContext.WaGatewayErrorMessage)) { using (var tempDirMan = new TempDirManager()) { var tempDir = tempDirMan.GetHandle(); string tempArchiveFilePath = Path.Combine( tempDir.FullName, string.Format("{0}_{1}_{2}.7z", backupName ?? "WurmAssistantBackup", buildType, DateTime.Now.ToStringFormattedForFileEx(highPrecision: true))); var compressor = new SevenZipCompressor() { ArchiveFormat = OutArchiveFormat.SevenZip, CompressionMode = CompressionMode.Create }; compressor.CompressDirectory(sourceDirPath, tempArchiveFilePath); var newBackup = new WaBackup(tempArchiveFilePath, buildType, manager, baseViewModel); var targetFile = new FileInfo(newBackup.FilePath); var targetArchiveFile = new FileInfo(Path.Combine(targetDirPath, targetFile.Name)); if (targetArchiveFile.Exists) { throw new LauncherException("backup with this file name already exists"); } newBackup.MoveInto(targetDirPath); return newBackup; } } }