diff --git a/GBM/Forms/frmGameManager.vb b/GBM/Forms/frmGameManager.vb index 9d2694f..19a475d 100644 --- a/GBM/Forms/frmGameManager.vb +++ b/GBM/Forms/frmGameManager.vb @@ -1558,6 +1558,7 @@ Public Class frmGameManager Private Sub TriggerSelectedImportBackup() Dim sDefaultFolder As String = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) Dim oBackup As New mgrBackup + Dim sConfirm As String = frmGameManager_ConfirmBackupImport Dim sFile As String Dim sFiles As String() @@ -1580,7 +1581,16 @@ Public Class frmGameManager End If Next - If mgrCommon.ShowMessage(frmGameManager_ConfirmBackupImport, oCurrentGame.CroppedName, MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then + If sFiles.Length > 1 And Not CurrentGame.AppendTimeStamp Then + mgrCommon.ShowMessage(frmGameManager_WarningImportBackupSaveMulti, MsgBoxStyle.Exclamation) + Exit Sub + End If + + If sFiles.Length = 1 And Not CurrentGame.AppendTimeStamp And mgrManifest.DoManifestCheck(CurrentGame.ID, mgrSQLite.Database.Remote) Then + sConfirm = frmGameManager_ConfirmBackupImportOverwriteSingle + End If + + If mgrCommon.ShowMessage(sConfirm, oCurrentGame.CroppedName, MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then Me.TriggerImportBackup = True Me.Close() End If @@ -1944,11 +1954,7 @@ Public Class frmGameManager End Sub Private Sub btnImportBackup_Click(sender As Object, e As EventArgs) Handles btnImportBackup.Click - If CurrentGame.AppendTimeStamp Then - TriggerSelectedImportBackup() - Else - mgrCommon.ShowMessage(frmGameManager_WarningImportBackupSaveMulti, MsgBoxStyle.Information) - End If + TriggerSelectedImportBackup() End Sub Private Sub chkFolderSave_CheckedChanged(sender As Object, e As EventArgs) Handles chkFolderSave.CheckedChanged diff --git a/GBM/Forms/frmSettings.Designer.vb b/GBM/Forms/frmSettings.Designer.vb index 1b21cb5..cdb6c0d 100644 --- a/GBM/Forms/frmSettings.Designer.vb +++ b/GBM/Forms/frmSettings.Designer.vb @@ -517,9 +517,9 @@ Partial Class frmSettings Me.chkShowResolvedPaths.AutoSize = True Me.chkShowResolvedPaths.Location = New System.Drawing.Point(6, 65) Me.chkShowResolvedPaths.Name = "chkShowResolvedPaths" - Me.chkShowResolvedPaths.Size = New System.Drawing.Size(154, 17) + Me.chkShowResolvedPaths.Size = New System.Drawing.Size(238, 17) Me.chkShowResolvedPaths.TabIndex = 2 - Me.chkShowResolvedPaths.Text = "Show resolved save paths " + Me.chkShowResolvedPaths.Text = "Show resolved save paths in Game Manager" Me.chkShowResolvedPaths.UseVisualStyleBackColor = True ' 'chkSessionTracking diff --git a/GBM/Managers/mgrBackup.vb b/GBM/Managers/mgrBackup.vb index 8d3eb30..cdb129a 100644 --- a/GBM/Managers/mgrBackup.vb +++ b/GBM/Managers/mgrBackup.vb @@ -215,6 +215,7 @@ Public Class mgrBackup Public Sub ImportBackupFiles(ByVal hshImportList As Hashtable) Dim oGame As clsGame + Dim bOverwriteCurrent As Boolean = False Dim bContinue As Boolean = True Dim sFileToImport As String Dim sBackupFile As String @@ -223,9 +224,13 @@ Public Class mgrBackup For Each de As DictionaryEntry In hshImportList sFileToImport = CStr(de.Key) oGame = DirectCast(de.Value, clsGame) - If File.Exists(sFileToImport) Then + 'Enter overwite mode if we are importing a single backup and "Save Multiple Backups" is not enabled. + If hshImportList.Count = 1 And Not oGame.AppendTimeStamp Then bOverwriteCurrent = True + + If File.Exists(sFileToImport) Then sBackupFile = oSettings.BackupFolder + If oSettings.CreateSubFolder Then sBackupFile = sBackupFile & Path.DirectorySeparatorChar & GetFileName(oGame) bContinue = HandleSubFolder(oGame, sBackupFile) @@ -236,14 +241,32 @@ Public Class mgrBackup oBackup.MonitorID = oGame.ID oBackup.DateUpdated = File.GetLastWriteTime(sFileToImport) oBackup.UpdatedBy = mgrBackup_ImportedFile - sBackupFile = sBackupFile & Path.DirectorySeparatorChar & GetFileName(oGame) & BuildFileTimeStamp(oBackup.DateUpdated) & ".7z" - oBackup.FileName = sBackupFile.Replace(Settings.BackupFolder & Path.DirectorySeparatorChar, String.Empty) - If mgrCommon.CopyFile(sFileToImport, sBackupFile, False) Then - oBackup.CheckSum = mgrHash.Generate_SHA256_Hash(sBackupFile) - mgrManifest.DoManifestAdd(oBackup, mgrSQLite.Database.Remote) - RaiseEvent UpdateLog(mgrCommon.FormatString(mgrBackup_ImportSuccess, New String() {sFileToImport, oGame.Name}), False, ToolTipIcon.Error, True) + If bOverwriteCurrent Then + sBackupFile = sBackupFile & Path.DirectorySeparatorChar & GetFileName(oGame) & ".7z" Else - RaiseEvent UpdateLog(mgrCommon.FormatString(mgrBackup_ErrorImportBackupCopy, sFileToImport), False, ToolTipIcon.Error, True) + sBackupFile = sBackupFile & Path.DirectorySeparatorChar & GetFileName(oGame) & BuildFileTimeStamp(oBackup.DateUpdated) & ".7z" + End If + + oBackup.FileName = sBackupFile.Replace(Settings.BackupFolder & Path.DirectorySeparatorChar, String.Empty) + + If bOverwriteCurrent Then + If mgrCommon.CopyFile(sFileToImport, sBackupFile, True) Then + oBackup.CheckSum = mgrHash.Generate_SHA256_Hash(sBackupFile) + If Not mgrManifest.DoUpdateLatestManifest(oBackup, mgrSQLite.Database.Remote) Then + mgrManifest.DoManifestAdd(oBackup, mgrSQLite.Database.Remote) + End If + RaiseEvent UpdateLog(mgrCommon.FormatString(mgrBackup_ImportSuccess, New String() {sFileToImport, oGame.Name}), False, ToolTipIcon.Info, True) + Else + RaiseEvent UpdateLog(mgrCommon.FormatString(mgrBackup_ErrorImportBackupCopy, sFileToImport), False, ToolTipIcon.Error, True) + End If + Else + If mgrCommon.CopyFile(sFileToImport, sBackupFile, False) Then + oBackup.CheckSum = mgrHash.Generate_SHA256_Hash(sBackupFile) + mgrManifest.DoManifestAdd(oBackup, mgrSQLite.Database.Remote) + RaiseEvent UpdateLog(mgrCommon.FormatString(mgrBackup_ImportSuccess, New String() {sFileToImport, oGame.Name}), False, ToolTipIcon.Info, True) + Else + RaiseEvent UpdateLog(mgrCommon.FormatString(mgrBackup_ErrorImportBackupCopy, sFileToImport), False, ToolTipIcon.Error, True) + End If End If End If End If diff --git a/GBM/My Project/Resources.Designer.vb b/GBM/My Project/Resources.Designer.vb index b409610..3758a8c 100644 --- a/GBM/My Project/Resources.Designer.vb +++ b/GBM/My Project/Resources.Designer.vb @@ -1887,6 +1887,15 @@ Namespace My.Resources End Get End Property + ''' + ''' Looks up a localized string similar to Importing this backup file will overwrite the current backup file for [PARAM].[BR][BR]Do you want to continue? This will close the form.. + ''' + Friend ReadOnly Property frmGameManager_ConfirmBackupImportOverwriteSingle() As String + Get + Return ResourceManager.GetString("frmGameManager_ConfirmBackupImportOverwriteSingle", resourceCulture) + End Get + End Property + ''' ''' Looks up a localized string similar to Are you sure you want to delete [PARAM]? This cannot be undone.[BR][BR]This will not delete any backup files that already exist for this game.. ''' @@ -2473,7 +2482,7 @@ Namespace My.Resources End Property ''' - ''' Looks up a localized string similar to The "Save multiple backups" option must be enabled on this configuration to import backup files.. + ''' Looks up a localized string similar to The "Save multiple backups" option must be enabled on this configuration to import multiple backup files.. ''' Friend ReadOnly Property frmGameManager_WarningImportBackupSaveMulti() As String Get @@ -4651,7 +4660,7 @@ Namespace My.Resources End Property ''' - ''' Looks up a localized string similar to Show resolved save paths. + ''' Looks up a localized string similar to Show resolved save paths in Game Manager. ''' Friend ReadOnly Property frmSettings_chkShowResolvedPaths() As String Get diff --git a/GBM/My Project/Resources.resx b/GBM/My Project/Resources.resx index 7ab3bcf..00d9bcd 100644 --- a/GBM/My Project/Resources.resx +++ b/GBM/My Project/Resources.resx @@ -2222,7 +2222,7 @@ An error occured while building a list of environment variables.[BR][BR][PARAM] - Show resolved save paths + Show resolved save paths in Game Manager 7-Zip @@ -2255,7 +2255,7 @@ [PARAM] is a reserved variable, you must enter a different name. - The "Save multiple backups" option must be enabled on this configuration to import backup files. + The "Save multiple backups" option must be enabled on this configuration to import multiple backup files. &Linux... @@ -2266,4 +2266,7 @@ Official Windows configurations can be used in Linux for games running in Wine or Proton.[BR][BR]You do not need to modify these configurations, GBM will automatically do any required path conversions the first time the game is detected.[BR][BR]This message will only be shown once. + + Importing this backup file will overwrite the current backup file for [PARAM].[BR][BR]Do you want to continue? This will close the form. + \ No newline at end of file diff --git a/GBM/readme.txt b/GBM/readme.txt index a618210..7769888 100644 --- a/GBM/readme.txt +++ b/GBM/readme.txt @@ -2,7 +2,7 @@ Game Backup Monitor v1.1.5 Readme http://mikemaximus.github.io/gbm-web/ gamebackupmonitor@gmail.com -October 1st, 2018 +October 4th, 2018 New in 1.1.5 @@ -24,14 +24,14 @@ All Platforms: - GBM will no longer allow the creation of variables using reserved names, such as APPDATA. - Your configurations will be automatically updated to these new formats when upgrading to v1.1.5. - These changes will break game list compatability with other versions of GBM. Archived lists are available at http://mikemaximus.github.io/gbm-web/archive.html for those that wish to stay on an older version. -- Added a new setting, "Show resolved save paths". +- Added a new setting, "Show resolved save paths in Game Manager". - This new setting is enabled by default. - - When enabled, GBM will display resolved save paths on the Game Manager. This is how GBM displayed paths prior to v1.1.5. + - When enabled, GBM will display resolved save paths in the Game Manager. This is how GBM displayed paths prior to v1.1.5. - When disabled, GBM will display save paths with their variables when applicable. - Added a tooltip to applicable "Path" fields on the Game Manager. - This tooltip either displays either a resolved or unresolved path. - The behaviour is toggled by the "Show resolved save paths" setting. --Added "Import Backup Files" feature to the Game Manager. +- Added "Import Backup Files" feature to the Game Manager. - This feature allows you to import one or more backup files for a specific game configuration. - This is useful if you lost your GBM database(s), but not the backup files. It also can be used to easily move compatible saved game backups between Windows and Linux. - GBM cannot verify that the backups being imported are compatible with the current configuration. This is up to the user!