Fixed renaming backup files and sub-folders

This commit is contained in:
MikeMaximus
2018-07-02 10:05:58 -06:00
parent 2ae705be18
commit b9b959f96c
2 changed files with 20 additions and 8 deletions
+19 -8
View File
@@ -175,15 +175,26 @@ Public Class frmGameManager
Return sPath Return sPath
End Function End Function
Private Sub CheckManifestandUpdate(ByVal oOriginalApp As clsGame, ByVal oNewApp As clsGame) Private Sub CheckManifestandUpdate(ByVal oOriginalApp As clsGame, ByVal oNewApp As clsGame, ByVal bUseGameID As Boolean)
Dim oBackupItems As List(Of clsBackup) Dim oBackupItems As List(Of clsBackup)
Dim sDirectory As String Dim sDirectory As String
Dim sNewDirectory As String Dim sNewDirectory As String
Dim sFileName As String Dim sFileName As String
Dim sNewFileName As String Dim sNewFileName As String
Dim sNewAppItem As String
Dim sOriginalAppItem As String
'If there is a valid change, check and update the manifest
If (oNewApp.ID <> oOriginalApp.ID) Or (oNewApp.FileSafeName <> oOriginalApp.FileSafeName) Then
'Choose how to perform file & folder renames
If bUseGameID Then
sNewAppItem = oNewApp.ID
sOriginalAppItem = oOriginalApp.ID
Else
sNewAppItem = oNewApp.FileSafeName
sOriginalAppItem = oOriginalApp.FileSafeName
End If
'If there is an ID change, check and update the manifest
If oNewApp.ID <> oOriginalApp.ID Then
'Local 'Local
If mgrManifest.DoManifestCheck(oOriginalApp.ID, mgrSQLite.Database.Local) Then If mgrManifest.DoManifestCheck(oOriginalApp.ID, mgrSQLite.Database.Local) Then
oBackupItems = mgrManifest.DoManifestGetByMonitorID(oOriginalApp.ID, mgrSQLite.Database.Local) oBackupItems = mgrManifest.DoManifestGetByMonitorID(oOriginalApp.ID, mgrSQLite.Database.Local)
@@ -193,14 +204,14 @@ Public Class frmGameManager
sFileName = BackupFolder & oBackupItem.FileName sFileName = BackupFolder & oBackupItem.FileName
'Rename Backup File 'Rename Backup File
sNewFileName = Path.GetDirectoryName(sFileName) & Path.DirectorySeparatorChar & Path.GetFileName(sFileName).Replace(oOriginalApp.ID, oNewApp.ID) sNewFileName = Path.GetDirectoryName(sFileName) & Path.DirectorySeparatorChar & Path.GetFileName(sFileName).Replace(sOriginalAppItem, sNewAppItem)
If File.Exists(sFileName) And Not sFileName = sNewFileName Then If File.Exists(sFileName) And Not sFileName = sNewFileName Then
FileSystem.Rename(sFileName, sNewFileName) FileSystem.Rename(sFileName, sNewFileName)
End If End If
'Rename Directory 'Rename Directory
sDirectory = Path.GetDirectoryName(sFileName) sDirectory = Path.GetDirectoryName(sFileName)
sNewDirectory = sDirectory.Replace(oOriginalApp.ID, oNewApp.ID) sNewDirectory = sDirectory.Replace(sOriginalAppItem, sNewAppItem)
If sDirectory <> sNewDirectory Then If sDirectory <> sNewDirectory Then
If Directory.Exists(sDirectory) And Not sDirectory = sNewDirectory Then If Directory.Exists(sDirectory) And Not sDirectory = sNewDirectory Then
FileSystem.Rename(sDirectory, sNewDirectory) FileSystem.Rename(sDirectory, sNewDirectory)
@@ -208,7 +219,7 @@ Public Class frmGameManager
End If End If
oBackupItem.MonitorID = oNewApp.ID oBackupItem.MonitorID = oNewApp.ID
oBackupItem.FileName = oBackupItem.FileName.Replace(oOriginalApp.ID, oNewApp.ID) oBackupItem.FileName = oBackupItem.FileName.Replace(sOriginalAppItem, sNewAppItem)
mgrManifest.DoManifestUpdateByManifestID(oBackupItem, mgrSQLite.Database.Local) mgrManifest.DoManifestUpdateByManifestID(oBackupItem, mgrSQLite.Database.Local)
Next Next
End If End If
@@ -219,7 +230,7 @@ Public Class frmGameManager
For Each oBackupItem As clsBackup In oBackupItems For Each oBackupItem As clsBackup In oBackupItems
oBackupItem.MonitorID = oNewApp.ID oBackupItem.MonitorID = oNewApp.ID
oBackupItem.FileName = oBackupItem.FileName.Replace(oOriginalApp.ID, oNewApp.ID) oBackupItem.FileName = oBackupItem.FileName.Replace(sOriginalAppItem, sNewAppItem)
mgrManifest.DoManifestUpdateByManifestID(oBackupItem, mgrSQLite.Database.Remote) mgrManifest.DoManifestUpdateByManifestID(oBackupItem, mgrSQLite.Database.Remote)
Next Next
End If End If
@@ -1285,7 +1296,7 @@ Public Class frmGameManager
Case eModes.Edit Case eModes.Edit
If CoreValidatation(oApp, False) Then If CoreValidatation(oApp, False) Then
bSuccess = True bSuccess = True
CheckManifestandUpdate(oCurrentGame, oApp) CheckManifestandUpdate(oCurrentGame, oApp, oSettings.UseGameID)
mgrMonitorList.DoListUpdate(oApp, CurrentGame.ID) mgrMonitorList.DoListUpdate(oApp, CurrentGame.ID)
eCurrentMode = eModes.View eCurrentMode = eModes.View
End If End If
+1
View File
@@ -17,6 +17,7 @@ All Platforms:
- GBM now displays the full path of the detected process when multiple configurations are triggered. - GBM now displays the full path of the detected process when multiple configurations are triggered.
- Fixed an issue that could cause the certain controls to become enabled incorrectly on the Game Manager. - Fixed an issue that could cause the certain controls to become enabled incorrectly on the Game Manager.
- Fixed an issue that caused GBM not to remove empty sub-folders unless the "Use Game ID for files and folders" setting was enabled when the folder was created. - Fixed an issue that caused GBM not to remove empty sub-folders unless the "Use Game ID for files and folders" setting was enabled when the folder was created.
- Fixed an issue that caused GBM not to rename backup files or sub-folders unless the "Use Game ID for files and folders" setting was enabled.
- GBM no longer displays a sync warning when the user deletes all game configurations from the Game Manager. - GBM no longer displays a sync warning when the user deletes all game configurations from the Game Manager.
The entire version history of GBM releases is available at http://mikemaximus.github.io/gbm-web/versionhistory.html The entire version history of GBM releases is available at http://mikemaximus.github.io/gbm-web/versionhistory.html