From ace287f42a3ce2c8206175769756342bbeb1a3cc Mon Sep 17 00:00:00 2001 From: "Michael J. Seiferling" Date: Fri, 14 Sep 2018 09:01:56 -0600 Subject: [PATCH] Fixed restore path display issue with multiple backups for #152 --- GBM/Forms/frmGameManager.vb | 69 ++++++++++++++++++++----------------- 1 file changed, 37 insertions(+), 32 deletions(-) diff --git a/GBM/Forms/frmGameManager.vb b/GBM/Forms/frmGameManager.vb index d11137b..3ea59db 100644 --- a/GBM/Forms/frmGameManager.vb +++ b/GBM/Forms/frmGameManager.vb @@ -712,25 +712,6 @@ Public Class frmGameManager End Sub - Private Sub UpdateBackupInfo(ByVal sManifestID As String) - Dim sFileName As String - - If sManifestID <> String.Empty Then - CurrentBackupItem = mgrManifest.DoManifestGetByManifestID(sManifestID, mgrSQLite.Database.Remote) - - sFileName = BackupFolder & CurrentBackupItem.FileName - - If File.Exists(sFileName) Then - lblBackupFileData.Text = Path.GetFileName(CurrentBackupItem.FileName) & " (" & mgrCommon.FormatDiskSpace(mgrCommon.GetFileSize(sFileName)) & ")" - Else - lblBackupFileData.Text = frmGameManager_ErrorNoBackupExists - End If - - lblRestorePathData.Text = CurrentBackupItem.RestorePath - End If - - End Sub - Public Sub VerifyBackups(ByVal oApp As clsGame) Dim oCurrentBackup As clsBackup Dim oCurrentBackups As List(Of clsBackup) @@ -761,6 +742,23 @@ Public Class frmGameManager Cursor.Current = Cursors.Default End Sub + Private Sub SetBackupRestorePath(ByVal oApp As clsGame) + Dim sttRestorePath As String + + If Not CurrentBackupItem.AbsolutePath And oApp.ProcessPath <> String.Empty Then + lblRestorePathData.Text = oApp.ProcessPath & Path.DirectorySeparatorChar & CurrentBackupItem.RestorePath + Else + If oSettings.ShowResolvedPaths Then + lblRestorePathData.Text = CurrentBackupItem.RestorePath + sttRestorePath = CurrentBackupItem.TruePath + Else + lblRestorePathData.Text = CurrentBackupItem.TruePath + sttRestorePath = CurrentBackupItem.RestorePath + End If + If CurrentBackupItem.AbsolutePath Then ttFullPath.SetToolTip(lblRestorePathData, sttRestorePath) + End If + End Sub + Private Sub GetBackupInfo(ByVal oApp As clsGame) Dim oBackupInfo As clsBackup Dim oCurrentBackup As clsBackup @@ -769,7 +767,7 @@ Public Class frmGameManager Dim oComboItems As New List(Of KeyValuePair(Of String, String)) Dim bLocalData As Boolean = False Dim bRemoteData As Boolean = False - Dim sttRestorePath As String + 'cboRemoteBackup cboRemoteBackup.ValueMember = "Key" @@ -798,18 +796,7 @@ Public Class frmGameManager lblBackupFileData.Text = frmGameManager_ErrorNoBackupExists End If - If Not CurrentBackupItem.AbsolutePath And oApp.ProcessPath <> String.Empty Then - lblRestorePathData.Text = oApp.ProcessPath & Path.DirectorySeparatorChar & CurrentBackupItem.RestorePath - Else - If oSettings.ShowResolvedPaths Then - lblRestorePathData.Text = CurrentBackupItem.RestorePath - sttRestorePath = CurrentBackupItem.TruePath - Else - lblRestorePathData.Text = CurrentBackupItem.TruePath - sttRestorePath = CurrentBackupItem.RestorePath - End If - If CurrentBackupItem.AbsolutePath Then ttFullPath.SetToolTip(lblRestorePathData, sttRestorePath) - End If + SetBackupRestorePath(oApp) Else oComboItems.Add(New KeyValuePair(Of String, String)(String.Empty, frmGameManager_None)) lblBackupFileData.Text = String.Empty @@ -846,6 +833,24 @@ Public Class frmGameManager End Sub + Private Sub UpdateBackupInfo(ByVal sManifestID As String) + Dim sFileName As String + + If sManifestID <> String.Empty Then + CurrentBackupItem = mgrManifest.DoManifestGetByManifestID(sManifestID, mgrSQLite.Database.Remote) + + sFileName = BackupFolder & CurrentBackupItem.FileName + + If File.Exists(sFileName) Then + lblBackupFileData.Text = Path.GetFileName(CurrentBackupItem.FileName) & " (" & mgrCommon.FormatDiskSpace(mgrCommon.GetFileSize(sFileName)) & ")" + Else + lblBackupFileData.Text = frmGameManager_ErrorNoBackupExists + End If + + SetBackupRestorePath(CurrentGame) + End If + End Sub + Private Sub DeleteAllBackups() Dim oBackupData As List(Of clsBackup) Dim oBackup As clsBackup