From d07fc57dad3b1335069045f0126d038bf4eef97a Mon Sep 17 00:00:00 2001 From: MikeMaximus Date: Thu, 1 Mar 2018 10:11:32 -0600 Subject: [PATCH 01/38] Core changes for games and backup manifest --- GBM/Classes/clsBackup.vb | 18 +++--- GBM/Classes/clsGame.vb | 28 +-------- GBM/Forms/frmAddWizard.vb | 2 +- GBM/Forms/frmGameManager.vb | 109 ++++++++++++--------------------- GBM/Forms/frmMain.vb | 5 +- GBM/Managers/mgrBackup.vb | 28 ++++----- GBM/Managers/mgrCommon.vb | 9 +-- GBM/Managers/mgrManifest.vb | 103 ++++++++++++------------------- GBM/Managers/mgrMonitorList.vb | 22 +++++-- GBM/Managers/mgrRestore.vb | 42 +++++-------- GBM/Managers/mgrSQLite.vb | 70 ++++++++++++++++++--- GBM/Managers/mgrXML.vb | 2 +- GBM/My Project/AssemblyInfo.vb | 4 +- 13 files changed, 206 insertions(+), 236 deletions(-) diff --git a/GBM/Classes/clsBackup.vb b/GBM/Classes/clsBackup.vb index 34174d0..36ca950 100644 --- a/GBM/Classes/clsBackup.vb +++ b/GBM/Classes/clsBackup.vb @@ -1,5 +1,6 @@ Public Class clsBackup Private sBackupID As String = Guid.NewGuid.ToString + Private sMonitorID As String = String.Empty Private sName As String = String.Empty Private sFileName As String = String.Empty Private sRestorePath As String = String.Empty @@ -9,7 +10,7 @@ Private sUpdatedBy As String = String.Empty Private sCheckSum As String = String.Empty - Property ID As String + Property ManifestID As String Get Return sBackupID End Get @@ -18,6 +19,15 @@ End Set End Property + Property MonitorID As String + Get + Return sMonitorID + End Get + Set(value As String) + sMonitorID = value + End Set + End Property + Property Name As String Get Return sName @@ -27,12 +37,6 @@ End Set End Property - ReadOnly Property SafeName As String - Get - Return mgrPath.ValidateForFileSystem(sName) - End Get - End Property - ReadOnly Property CroppedName As String Get If Name.Length > 40 Then diff --git a/GBM/Classes/clsGame.vb b/GBM/Classes/clsGame.vb index b638b26..17f5822 100644 --- a/GBM/Classes/clsGame.vb +++ b/GBM/Classes/clsGame.vb @@ -22,7 +22,6 @@ Public Class clsGame Private sComments As String = String.Empty Private bIsRegEx As Boolean = False Private bDuplicate As Boolean = False - Private bTempGame As Boolean = False Private oImportTags As New List(Of Tag) Public Enum eOptionalSyncFields @@ -37,7 +36,7 @@ Public Class clsGame Property ID As String Set(value As String) - sGameID = value + sGameID = mgrPath.ValidateForFileSystem(value) End Set Get Return sGameID @@ -46,7 +45,7 @@ Public Class clsGame ReadOnly Property CompoundKey As String Get - Return ProcessName & ":" & KeySafeName + Return ProcessName & ":" & ID End Get End Property @@ -69,18 +68,6 @@ Public Class clsGame End Get End Property - ReadOnly Property FileSafeName As String - Get - Return mgrPath.ValidateForFileSystem(sGameName) - End Get - End Property - - ReadOnly Property KeySafeName As String - Get - Return sGameName.Replace(":", "_") - End Get - End Property - Property ProcessName As String Set(value As String) sProcessName = value @@ -273,15 +260,6 @@ Public Class clsGame End Get End Property - Property Temporary As Boolean - Get - Return bTempGame - End Get - Set(value As Boolean) - bTempGame = value - End Set - End Property - Property ImportTags As List(Of Tag) Get Return oImportTags @@ -406,7 +384,7 @@ Public Class clsGame If oGame Is Nothing Then Return False Else - If Name <> oGame.Name Then + If ID <> oGame.ID Then Return False End If If ProcessName <> oGame.ProcessName Then diff --git a/GBM/Forms/frmAddWizard.vb b/GBM/Forms/frmAddWizard.vb index e294c18..2740b5d 100644 --- a/GBM/Forms/frmAddWizard.vb +++ b/GBM/Forms/frmAddWizard.vb @@ -265,7 +265,7 @@ Public Class frmAddWizard Private Sub DoSave() Dim hshDupeCheck As New Hashtable - Dim sNewGame As String = oGameToSave.ProcessName & ":" & oGameToSave.KeySafeName + Dim sNewGame As String = oGameToSave.CompoundKey For Each o As clsGame In GameData.Values hshDupeCheck.Add(o.CompoundKey, String.Empty) diff --git a/GBM/Forms/frmGameManager.vb b/GBM/Forms/frmGameManager.vb index 77ee63c..bf45b3f 100644 --- a/GBM/Forms/frmGameManager.vb +++ b/GBM/Forms/frmGameManager.vb @@ -173,45 +173,45 @@ Public Class frmGameManager Dim sNewFileName As String 'If there is a name change, check and update the manifest - If oNewApp.Name <> oOriginalApp.Name Then + If oNewApp.ID <> oOriginalApp.ID Then 'Local - If mgrManifest.DoManifestNameCheck(oOriginalApp.Name, mgrSQLite.Database.Local) Then - oBackupItems = mgrManifest.DoManifestGetByName(oOriginalApp.Name, mgrSQLite.Database.Local) + If mgrManifest.DoManifestCheck(oOriginalApp.ID, mgrSQLite.Database.Local) Then + oBackupItems = mgrManifest.DoManifestGetByMonitorID(oOriginalApp.ID, mgrSQLite.Database.Local) 'The local manifest will only have one entry per game, therefore this runs only once For Each oBackupItem As clsBackup In oBackupItems 'Rename Current Backup File & Folder sFileName = BackupFolder & oBackupItem.FileName 'Rename Backup File - sNewFileName = Path.GetDirectoryName(sFileName) & Path.DirectorySeparatorChar & Path.GetFileName(sFileName).Replace(oOriginalApp.FileSafeName, oNewApp.FileSafeName) + sNewFileName = Path.GetDirectoryName(sFileName) & Path.DirectorySeparatorChar & Path.GetFileName(sFileName).Replace(oOriginalApp.ID, oNewApp.ID) If File.Exists(sFileName) And Not sFileName = sNewFileName Then FileSystem.Rename(sFileName, sNewFileName) End If 'Rename Directory sDirectory = Path.GetDirectoryName(sFileName) - sNewDirectory = sDirectory.Replace(oOriginalApp.FileSafeName, oNewApp.FileSafeName) + sNewDirectory = sDirectory.Replace(oOriginalApp.ID, oNewApp.ID) If sDirectory <> sNewDirectory Then If Directory.Exists(sDirectory) And Not sDirectory = sNewDirectory Then FileSystem.Rename(sDirectory, sNewDirectory) End If End If - oBackupItem.Name = oNewApp.Name - oBackupItem.FileName = oBackupItem.FileName.Replace(oOriginalApp.FileSafeName, oNewApp.FileSafeName) - mgrManifest.DoManifestUpdateByID(oBackupItem, mgrSQLite.Database.Local) + oBackupItem.MonitorID = oNewApp.ID + oBackupItem.FileName = oBackupItem.FileName.Replace(oOriginalApp.ID, oNewApp.ID) + mgrManifest.DoManifestUpdateByManifestID(oBackupItem, mgrSQLite.Database.Local) Next oLocalBackupData = mgrManifest.ReadLatestManifest(mgrSQLite.Database.Local) End If 'Remote - If mgrManifest.DoManifestNameCheck(oOriginalApp.Name, mgrSQLite.Database.Remote) Then - oBackupItems = mgrManifest.DoManifestGetByName(oOriginalApp.Name, mgrSQLite.Database.Remote) + If mgrManifest.DoManifestCheck(oOriginalApp.ID, mgrSQLite.Database.Remote) Then + oBackupItems = mgrManifest.DoManifestGetByMonitorID(oOriginalApp.ID, mgrSQLite.Database.Remote) For Each oBackupItem As clsBackup In oBackupItems - oBackupItem.Name = oNewApp.Name - oBackupItem.FileName = oBackupItem.FileName.Replace(oOriginalApp.FileSafeName, oNewApp.FileSafeName) - mgrManifest.DoManifestUpdateByID(oBackupItem, mgrSQLite.Database.Remote) + oBackupItem.MonitorID = oNewApp.ID + oBackupItem.FileName = oBackupItem.FileName.Replace(oOriginalApp.ID, oNewApp.ID) + mgrManifest.DoManifestUpdateByManifestID(oBackupItem, mgrSQLite.Database.Remote) Next oRemoteBackupData = mgrManifest.ReadLatestManifest(mgrSQLite.Database.Remote) End If @@ -221,7 +221,6 @@ Public Class frmGameManager Private Sub LoadData(Optional ByVal bRetainFilter As Boolean = True) Dim oRestoreData As New SortedList Dim oGame As clsGame - Dim oBackup As clsBackup Dim frm As frmFilter If optCustom.Checked Then @@ -264,10 +263,10 @@ Public Class frmGameManager Dim oTemporaryList As OrderedDictionary = mgrCommon.GenericClone(GameData) For Each de As DictionaryEntry In oTemporaryList oGame = DirectCast(de.Value, clsGame) - If Not oRestoreData.ContainsKey(oGame.Name) Then + If Not oRestoreData.ContainsKey(oGame.ID) Then GameData.Remove(de.Key) Else - oRestoreData.Remove(oGame.Name) + oRestoreData.Remove(oGame.ID) End If Next ElseIf optBackupData.Checked Then @@ -277,24 +276,14 @@ Public Class frmGameManager For Each de As DictionaryEntry In oTemporaryList oGame = DirectCast(de.Value, clsGame) - If Not oRemoteBackupData.ContainsKey(oGame.Name) Then + If Not oRemoteBackupData.ContainsKey(oGame.ID) Then GameData.Remove(de.Key) Else - oRestoreData.Remove(oGame.Name) + oRestoreData.Remove(oGame.ID) End If Next End If - 'Handle any orphaned backup files and add them to list - If oRestoreData.Count <> 0 Then - For Each oBackup In oRestoreData.Values - oGame = New clsGame - oGame.Name = oBackup.Name - oGame.Temporary = True - GameData.Add(oGame.ID, oGame) - Next - End If - lstGames.DataSource = Nothing FormatAndFillList() End Sub @@ -598,7 +587,7 @@ Public Class frmGameManager Dim sFileName As String If sManifestID <> String.Empty Then - CurrentBackupItem = mgrManifest.DoManifestGetByID(sManifestID, mgrSQLite.Database.Remote) + CurrentBackupItem = mgrManifest.DoManifestGetByManifestID(sManifestID, mgrSQLite.Database.Remote) sFileName = BackupFolder & CurrentBackupItem.FileName @@ -608,7 +597,6 @@ Public Class frmGameManager lblBackupFileData.Text = frmGameManager_ErrorNoBackupExists End If - mgrRestore.DoPathOverride(CurrentBackupItem, CurrentGame) lblRestorePathData.Text = CurrentBackupItem.RestorePath End If @@ -627,15 +615,15 @@ Public Class frmGameManager cboRemoteBackup.ValueMember = "Key" cboRemoteBackup.DisplayMember = "Value" - If oRemoteBackupData.Contains(oApp.Name) Then + If oRemoteBackupData.Contains(oApp.ID) Then bRemoteData = True - oCurrentBackups = mgrManifest.DoManifestGetByName(oApp.Name, mgrSQLite.Database.Remote) + oCurrentBackups = mgrManifest.DoManifestGetByMonitorID(oApp.ID, mgrSQLite.Database.Remote) For Each oCurrentBackup In oCurrentBackups - oComboItems.Add(New KeyValuePair(Of String, String)(oCurrentBackup.ID, mgrCommon.FormatString(frmGameManager_BackupTimeAndName, New String() {oCurrentBackup.DateUpdated, oCurrentBackup.UpdatedBy}))) + oComboItems.Add(New KeyValuePair(Of String, String)(oCurrentBackup.ManifestID, mgrCommon.FormatString(frmGameManager_BackupTimeAndName, New String() {oCurrentBackup.DateUpdated, oCurrentBackup.UpdatedBy}))) Next - CurrentBackupItem = DirectCast(oRemoteBackupData(oApp.Name), clsBackup) + CurrentBackupItem = DirectCast(oRemoteBackupData(oApp.ID), clsBackup) sFileName = BackupFolder & CurrentBackupItem.FileName @@ -650,7 +638,6 @@ Public Class frmGameManager lblBackupFileData.Text = frmGameManager_ErrorNoBackupExists End If - mgrRestore.DoPathOverride(CurrentBackupItem, oApp) lblRestorePathData.Text = CurrentBackupItem.RestorePath Else oComboItems.Add(New KeyValuePair(Of String, String)(String.Empty, frmGameManager_None)) @@ -664,9 +651,9 @@ Public Class frmGameManager cboRemoteBackup.DataSource = oComboItems - If oLocalBackupData.Contains(oApp.Name) Then + If oLocalBackupData.Contains(oApp.ID) Then bLocalData = True - oBackupInfo = DirectCast(oLocalBackupData(oApp.Name), clsBackup) + oBackupInfo = DirectCast(oLocalBackupData(oApp.ID), clsBackup) lblLocalBackupData.Text = mgrCommon.FormatString(frmGameManager_BackupTimeAndName, New String() {oBackupInfo.DateUpdated, oBackupInfo.UpdatedBy}) Else lblLocalBackupData.Text = frmGameManager_Unknown @@ -693,11 +680,11 @@ Public Class frmGameManager Dim oBackup As clsBackup If mgrCommon.ShowMessage(frmGameManager_ConfirmBackupDeleteAll, CurrentGame.Name, MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then - oBackupData = mgrManifest.DoManifestGetByName(CurrentGame.Name, mgrSQLite.Database.Remote) + oBackupData = mgrManifest.DoManifestGetByMonitorID(CurrentGame.ID, mgrSQLite.Database.Remote) For Each oBackup In oBackupData 'Delete the specific remote manifest entry - mgrManifest.DoManifestDeletebyID(oBackup, mgrSQLite.Database.Remote) + mgrManifest.DoManifestDeletebyManifestID(oBackup, mgrSQLite.Database.Remote) 'Delete referenced backup file from the backup folder mgrCommon.DeleteFile(BackupFolder & oBackup.FileName) 'Check for sub-directory and delete if empty (we need to do this every pass just in case the user had a mix of settings at one point) @@ -705,28 +692,21 @@ Public Class frmGameManager Next 'Delete local manifest entry - mgrManifest.DoManifestDeletebyName(CurrentBackupItem, mgrSQLite.Database.Local) + mgrManifest.DoManifestDeletebyMonitorID(CurrentBackupItem, mgrSQLite.Database.Local) LoadBackupData() - - If oCurrentGame.Temporary Then - LoadData() - eCurrentMode = eModes.Disabled - ModeChange() - Else - FillData() - End If + FillData() End If End Sub Private Sub DeleteBackup() If mgrCommon.ShowMessage(frmGameManager_ConfirmBackupDelete, Path.GetFileName(CurrentBackupItem.FileName), MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then 'Delete the specific remote manifest entry - mgrManifest.DoManifestDeletebyID(CurrentBackupItem, mgrSQLite.Database.Remote) + mgrManifest.DoManifestDeleteByManifestID(CurrentBackupItem, mgrSQLite.Database.Remote) 'If a remote manifest entry no longer exists for this game, delete the local entry - If Not mgrManifest.DoGlobalManifestCheck(CurrentBackupItem.Name, mgrSQLite.Database.Remote) Then - mgrManifest.DoManifestDeletebyName(CurrentBackupItem, mgrSQLite.Database.Local) + If Not mgrManifest.DoManifestCheck(CurrentBackupItem.MonitorID, mgrSQLite.Database.Remote) Then + mgrManifest.DoManifestDeleteByMonitorID(CurrentBackupItem, mgrSQLite.Database.Local) End If 'Delete referenced backup file from the backup folder @@ -736,14 +716,7 @@ Public Class frmGameManager mgrCommon.DeleteDirectoryByBackup(BackupFolder, CurrentBackupItem) LoadBackupData() - - If oCurrentGame.Temporary Then - LoadData() - eCurrentMode = eModes.Disabled - ModeChange() - Else - FillData() - End If + FillData() End If End Sub @@ -796,12 +769,6 @@ Public Class frmGameManager 'Set Current CurrentGame = oApp - 'Change view to temporary if we only have backup data for the game - If CurrentGame.Temporary Then - eCurrentMode = eModes.ViewTemp - ModeChange() - End If - IsLoading = False End Sub @@ -1340,8 +1307,8 @@ Public Class frmGameManager If oMarkList.Count = 1 Then If mgrCommon.ShowMessage(frmGameManager_ConfirmMark, oMarkList(0).Name, MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then bWasUpdated = True - If mgrManifest.DoGlobalManifestCheck(oMarkList(0).Name, mgrSQLite.Database.Local) Then - mgrManifest.DoManifestUpdateByName(oMarkList(0), mgrSQLite.Database.Local) + If mgrManifest.DoManifestCheck(oMarkList(0).MonitorID, mgrSQLite.Database.Local) Then + mgrManifest.DoManifestUpdateByMonitorID(oMarkList(0), mgrSQLite.Database.Local) Else mgrManifest.DoManifestAdd(oMarkList(0), mgrSQLite.Database.Local) End If @@ -1350,8 +1317,8 @@ Public Class frmGameManager If mgrCommon.ShowMessage(frmGameManager_ConfirmMultiMark, oMarkList.Count, MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then bWasUpdated = True For Each oGameBackup In oMarkList - If mgrManifest.DoGlobalManifestCheck(oGameBackup.Name, mgrSQLite.Database.Local) Then - mgrManifest.DoManifestUpdateByName(oGameBackup, mgrSQLite.Database.Local) + If mgrManifest.DoManifestCheck(oGameBackup.MonitorID, mgrSQLite.Database.Local) Then + mgrManifest.DoManifestUpdateByMonitorID(oGameBackup, mgrSQLite.Database.Local) Else mgrManifest.DoManifestAdd(oGameBackup, mgrSQLite.Database.Local) End If @@ -1428,9 +1395,9 @@ Public Class frmGameManager For Each oData In lstGames.SelectedItems - If oRemoteBackupData.Contains(oData.Value) Then + If oRemoteBackupData.Contains(oData.Key) Then oGame = DirectCast(GameData(oData.Key), clsGame) - oBackup = DirectCast(oRemoteBackupData(oData.Value), clsBackup) + oBackup = DirectCast(oRemoteBackupData(oData.Key), clsBackup) If Not oGame.MonitorOnly Then RestoreList.Add(oGame, oBackup) End If Next diff --git a/GBM/Forms/frmMain.vb b/GBM/Forms/frmMain.vb index 93caea0..303cb91 100644 --- a/GBM/Forms/frmMain.vb +++ b/GBM/Forms/frmMain.vb @@ -406,7 +406,6 @@ Public Class frmMain hshGames = mgrMonitorList.DoListGetbyName(de.Key) If hshGames.Count = 1 Then oGame = DirectCast(hshGames(0), clsGame) - mgrRestore.DoPathOverride(oBackup, oGame) If oGame.ProcessPath <> String.Empty Then oBackup.RelativeRestorePath = oGame.ProcessPath & Path.DirectorySeparatorChar & oBackup.RestorePath End If @@ -420,8 +419,8 @@ Public Class frmMain If Not Directory.Exists(sExtractPath) Then If oSettings.AutoMark Then - If mgrManifest.DoGlobalManifestCheck(de.Key, mgrSQLite.Database.Local) Then - mgrManifest.DoManifestUpdateByName(de.Value, mgrSQLite.Database.Local) + If mgrManifest.DoManifestCheck(de.Key, mgrSQLite.Database.Local) Then + mgrManifest.DoManifestUpdateByMonitorID(de.Value, mgrSQLite.Database.Local) Else mgrManifest.DoManifestAdd(de.Value, mgrSQLite.Database.Local) End If diff --git a/GBM/Managers/mgrBackup.vb b/GBM/Managers/mgrBackup.vb index 6094ce3..9f10866 100644 --- a/GBM/Managers/mgrBackup.vb +++ b/GBM/Managers/mgrBackup.vb @@ -40,25 +40,23 @@ Public Class mgrBackup Dim oItem As New clsBackup 'Create manifest item - oItem.Name = oGameInfo.Name + oItem.MonitorID = oGameInfo.ID 'Keep the path relative to the manifest location oItem.FileName = sBackupFile.Replace(Path.GetDirectoryName(mgrPath.RemoteDatabaseLocation) & Path.DirectorySeparatorChar, "") - oItem.RestorePath = oGameInfo.TruePath - oItem.AbsolutePath = oGameInfo.AbsolutePath oItem.DateUpdated = dTimeStamp oItem.UpdatedBy = My.Computer.Name oItem.CheckSum = sCheckSum 'Save Remote Manifest If mgrManifest.DoSpecificManifestCheck(oItem, mgrSQLite.Database.Remote) Then - mgrManifest.DoManifestUpdateByID(oItem, mgrSQLite.Database.Remote) + mgrManifest.DoManifestUpdateByManifestID(oItem, mgrSQLite.Database.Remote) Else mgrManifest.DoManifestAdd(oItem, mgrSQLite.Database.Remote) End If 'Save Local Manifest - If mgrManifest.DoGlobalManifestCheck(oItem.Name, mgrSQLite.Database.Local) Then - mgrManifest.DoManifestUpdateByName(oItem, mgrSQLite.Database.Local) + If mgrManifest.DoManifestCheck(oItem.MonitorID, mgrSQLite.Database.Local) Then + mgrManifest.DoManifestUpdateByMonitorID(oItem, mgrSQLite.Database.Local) Else mgrManifest.DoManifestAdd(oItem, mgrSQLite.Database.Local) End If @@ -107,8 +105,8 @@ Public Class mgrBackup Dim lAvailableSpace As Long Dim lFolderSize As Long - If oSettings.CreateSubFolder Then sBackupFile = sBackupFile & Path.DirectorySeparatorChar & oGame.FileSafeName - sBackupFile = sBackupFile & Path.DirectorySeparatorChar & oGame.FileSafeName & ".7z" + If oSettings.CreateSubFolder Then sBackupFile = sBackupFile & Path.DirectorySeparatorChar & oGame.ID + sBackupFile = sBackupFile & Path.DirectorySeparatorChar & oGame.ID & ".7z" 'Verify saved game path sSavePath = VerifySavePath(oGame) @@ -130,7 +128,7 @@ Public Class mgrBackup End If End If - If mgrRestore.CheckManifest(oGame.Name) Then + If mgrRestore.CheckManifest(oGame.ID) Then If mgrCommon.ShowMessage(mgrBackup_ConfirmManifestConflict, oGame.Name, MsgBoxStyle.YesNo) = MsgBoxResult.No Then RaiseEvent UpdateLog(mgrBackup_ErrorManifestConflict, False, ToolTipIcon.Error, True) Return False @@ -148,7 +146,7 @@ Public Class mgrBackup End Function Private Sub CheckOldBackups(ByVal oGame As clsGame) - Dim oGameBackups As List(Of clsBackup) = mgrManifest.DoManifestGetByName(oGame.Name, mgrSQLite.Database.Remote) + Dim oGameBackups As List(Of clsBackup) = mgrManifest.DoManifestGetByMonitorID(oGame.ID, mgrSQLite.Database.Remote) Dim oGameBackup As clsBackup Dim sOldBackup As String Dim iBackupCount As Integer = oGameBackups.Count @@ -164,8 +162,8 @@ Public Class mgrBackup oGameBackup = oGameBackups(oGameBackups.Count - i) sOldBackup = Settings.BackupFolder & Path.DirectorySeparatorChar & oGameBackup.FileName - mgrManifest.DoManifestDeletebyID(oGameBackup, mgrSQLite.Database.Remote) - mgrManifest.DoManifestDeletebyID(oGameBackup, mgrSQLite.Database.Local) + mgrManifest.DoManifestDeleteByManifestID(oGameBackup, mgrSQLite.Database.Remote) + mgrManifest.DoManifestDeleteByManifestID(oGameBackup, mgrSQLite.Database.Local) mgrCommon.DeleteFile(sOldBackup) mgrCommon.DeleteDirectoryByBackup(Settings.BackupFolder & Path.DirectorySeparatorChar, oGameBackup) @@ -199,7 +197,7 @@ Public Class mgrBackup RaiseEvent UpdateBackupInfo(oGame) If oSettings.CreateSubFolder Then - sBackupFile = sBackupFile & Path.DirectorySeparatorChar & oGame.FileSafeName + sBackupFile = sBackupFile & Path.DirectorySeparatorChar & oGame.ID Try If Not Directory.Exists(sBackupFile) Then Directory.CreateDirectory(sBackupFile) @@ -212,9 +210,9 @@ Public Class mgrBackup If oGame.AppendTimeStamp Then CheckOldBackups(oGame) - sBackupFile = sBackupFile & Path.DirectorySeparatorChar & oGame.FileSafeName & sTimeStamp & ".7z" + sBackupFile = sBackupFile & Path.DirectorySeparatorChar & oGame.ID & sTimeStamp & ".7z" Else - sBackupFile = sBackupFile & Path.DirectorySeparatorChar & oGame.FileSafeName & ".7z" + sBackupFile = sBackupFile & Path.DirectorySeparatorChar & oGame.ID & ".7z" End If If bDoBackup Then diff --git a/GBM/Managers/mgrCommon.vb b/GBM/Managers/mgrCommon.vb index de91b3b..e38f0d5 100644 --- a/GBM/Managers/mgrCommon.vb +++ b/GBM/Managers/mgrCommon.vb @@ -202,11 +202,6 @@ Public Class mgrCommon Dim sExemptList As String() = {"dosbox", "scummvm"} Dim bFound As Boolean = False - 'We can't search if we don't have a configuration - If oGame.Temporary Then - Return True - End If - For Each s As String In sExemptList If oGame.ProcessName.ToLower.Contains(s) Then bFound = True Next @@ -430,10 +425,10 @@ Public Class mgrCommon 'Delete a sub-folder based on the provided backup information Public Shared Sub DeleteDirectoryByBackup(ByVal sBackupFolder As String, ByVal oBackup As clsBackup) Dim oDir As DirectoryInfo - Dim sDir As String = sBackupFolder & oBackup.SafeName + Dim sDir As String = sBackupFolder & oBackup.MonitorID 'Delete sub directory if it's empty - If oBackup.FileName.StartsWith(oBackup.SafeName & Path.DirectorySeparatorChar) Then + If oBackup.FileName.StartsWith(oBackup.MonitorID & Path.DirectorySeparatorChar) Then If Directory.Exists(sDir) Then 'Check if there's any sub-directories or files remaining oDir = New DirectoryInfo(sDir) diff --git a/GBM/Managers/mgrManifest.vb b/GBM/Managers/mgrManifest.vb index f9d182c..f0be577 100644 --- a/GBM/Managers/mgrManifest.vb +++ b/GBM/Managers/mgrManifest.vb @@ -4,10 +4,11 @@ Dim oBackupItem As clsBackup oBackupItem = New clsBackup - oBackupItem.ID = CStr(dr("ManifestID")) + oBackupItem.ManifestID = CStr(dr("ManifestID")) + oBackupItem.MonitorID = CStr(dr("MonitorID")) oBackupItem.Name = CStr(dr("Name")) oBackupItem.FileName = CStr(dr("FileName")) - oBackupItem.RestorePath = CStr(dr("RestorePath")) + oBackupItem.RestorePath = CStr(dr("Path")) oBackupItem.AbsolutePath = CBool(dr("AbsolutePath")) oBackupItem.DateUpdated = mgrCommon.UnixToDate(dr("DateUpdated")) oBackupItem.UpdatedBy = CStr(dr("UpdatedBy")) @@ -19,11 +20,9 @@ Private Shared Function SetCoreParameters(ByVal oBackupItem As clsBackup) As Hashtable Dim hshParams As New Hashtable - hshParams.Add("ID", oBackupItem.ID) - hshParams.Add("Name", oBackupItem.Name) + hshParams.Add("ManifestID", oBackupItem.ManifestID) + hshParams.Add("MonitorID", oBackupItem.MonitorID) hshParams.Add("FileName", oBackupItem.FileName) - hshParams.Add("Path", oBackupItem.TruePath) - hshParams.Add("AbsolutePath", oBackupItem.AbsolutePath) hshParams.Add("DateUpdated", oBackupItem.DateUpdatedUnix) hshParams.Add("UpdatedBy", oBackupItem.UpdatedBy) hshParams.Add("CheckSum", oBackupItem.CheckSum) @@ -38,12 +37,12 @@ Dim oBackupItem As clsBackup Dim slList As New SortedList - sSQL = "SELECT * from manifest ORDER BY Name Asc" + sSQL = "SELECT * from manifest NATURAL JOIN monitorlist ORDER BY Name Asc" oData = oDatabase.ReadParamData(sSQL, New Hashtable) For Each dr As DataRow In oData.Tables(0).Rows oBackupItem = MapToObject(dr) - slList.Add(oBackupItem.ID, oBackupItem) + slList.Add(oBackupItem.ManifestID, oBackupItem) Next Return slList @@ -57,19 +56,19 @@ Dim oBackupItem As clsBackup Dim slList As New SortedList - sSQL = "SELECT ManifestID, Name, FileName, RestorePath, AbsolutePath, Max(DateUpdated) As DateUpdated, UpdatedBy, CheckSum FROM manifest GROUP BY Name ORDER By Name ASC" + sSQL = "SELECT ManifestID, MonitorID, Name, FileName, Path, AbsolutePath, Max(DateUpdated) As DateUpdated, UpdatedBy, CheckSum FROM manifest NATURAL JOIN monitorlist GROUP BY Name ORDER By Name ASC" oData = oDatabase.ReadParamData(sSQL, New Hashtable) For Each dr As DataRow In oData.Tables(0).Rows oBackupItem = MapToObject(dr) - slList.Add(oBackupItem.Name, oBackupItem) + slList.Add(oBackupItem.MonitorID, oBackupItem) Next Return slList End Function - Public Shared Function DoManifestGetByName(ByVal sName As String, ByVal iSelectDB As mgrSQLite.Database) As List(Of clsBackup) + Public Shared Function DoManifestGetByMonitorID(ByVal sMonitorID As String, ByVal iSelectDB As mgrSQLite.Database) As List(Of clsBackup) Dim oDatabase As New mgrSQLite(iSelectDB) Dim oData As DataSet Dim sSQL As String @@ -78,10 +77,10 @@ Dim oList As New List(Of clsBackup) - sSQL = "SELECT * from manifest " - sSQL &= "WHERE Name = @Name ORDER BY DateUpdated Desc" + sSQL = "SELECT * FROM manifest NATURAL JOIN monitorlist " + sSQL &= "WHERE MonitorID = @MonitorID ORDER BY DateUpdated Desc" - hshParams.Add("Name", sName) + hshParams.Add("MonitorID", sMonitorID) oData = oDatabase.ReadParamData(sSQL, hshParams) @@ -93,7 +92,7 @@ Return oList End Function - Public Shared Function DoManifestGetByID(ByVal sID As String, ByVal iSelectDB As mgrSQLite.Database) As clsBackup + Public Shared Function DoManifestGetByManifestID(ByVal sManifestID As String, ByVal iSelectDB As mgrSQLite.Database) As clsBackup Dim oDatabase As New mgrSQLite(iSelectDB) Dim oData As DataSet Dim sSQL As String @@ -101,10 +100,10 @@ Dim oBackupItem As New clsBackup Dim oList As New List(Of clsBackup) - sSQL = "SELECT * from manifest " - sSQL &= "WHERE ManifestID = @ID ORDER BY DateUpdated Desc" + sSQL = "SELECT * FROM manifest NATURAL JOIN monitorlist " + sSQL &= "WHERE ManifestID = @ManifestID ORDER BY DateUpdated Desc" - hshParams.Add("ID", sID) + hshParams.Add("ManifestID", sManifestID) oData = oDatabase.ReadParamData(sSQL, hshParams) @@ -122,17 +121,17 @@ Dim sSQL As String Dim hshParams As New Hashtable - sSQL = "SELECT * from manifest " - sSQL &= "WHERE Name = @Name AND FileName = @FileName" + sSQL = "SELECT * FROM manifest NATURAL JOIN monitorlist " + sSQL &= "WHERE MonitorID = @MonitorID AND FileName = @FileName" - hshParams.Add("Name", oItem.Name) + hshParams.Add("MonitorID", oItem.MonitorID) hshParams.Add("FileName", oItem.FileName) oData = oDatabase.ReadParamData(sSQL, hshParams) If oData.Tables(0).Rows.Count > 0 Then For Each dr As DataRow In oData.Tables(0).Rows - oItem.ID = CStr(dr("ManifestID")) + oItem.ManifestID = CStr(dr("ManifestID")) Next Return True Else @@ -141,38 +140,16 @@ End Function - 'This should only be used to update entries in the local manifest - Public Shared Function DoGlobalManifestCheck(ByVal sName As String, ByVal iSelectDB As mgrSQLite.Database) As Boolean + Public Shared Function DoManifestCheck(ByVal sMonitorID As String, ByVal iSelectDB As mgrSQLite.Database) As Boolean Dim oDatabase As New mgrSQLite(iSelectDB) Dim oData As DataSet Dim sSQL As String Dim hshParams As New Hashtable - sSQL = "SELECT * from manifest " - sSQL &= "WHERE Name = @Name" + sSQL = "SELECT * FROM manifest " + sSQL &= "WHERE MonitorID = @MonitorID" - hshParams.Add("Name", sName) - - oData = oDatabase.ReadParamData(sSQL, hshParams) - - If oData.Tables(0).Rows.Count > 0 Then - Return True - Else - Return False - End If - - End Function - - Public Shared Function DoManifestNameCheck(ByVal sName As String, ByVal iSelectDB As mgrSQLite.Database) As Boolean - Dim oDatabase As New mgrSQLite(iSelectDB) - Dim oData As DataSet - Dim sSQL As String - Dim hshParams As New Hashtable - - sSQL = "SELECT * from manifest " - sSQL &= "WHERE Name = @Name" - - hshParams.Add("Name", sName) + hshParams.Add("MonitorID", sMonitorID) oData = oDatabase.ReadParamData(sSQL, hshParams) @@ -189,63 +166,63 @@ Dim sSQL As String Dim hshParams As Hashtable - sSQL = "INSERT INTO manifest VALUES (@ID, @Name, @FileName, @Path, @AbsolutePath, @DateUpdated, @UpdatedBy, @CheckSum)" + sSQL = "INSERT INTO manifest VALUES (@ManifestID, @MonitorID, @FileName, @DateUpdated, @UpdatedBy, @CheckSum)" hshParams = SetCoreParameters(oBackupItem) oDatabase.RunParamQuery(sSQL, hshParams) End Sub - Public Shared Sub DoManifestUpdateByName(ByVal oBackupItem As clsBackup, ByVal iSelectDB As mgrSQLite.Database) + Public Shared Sub DoManifestUpdateByMonitorID(ByVal oBackupItem As clsBackup, ByVal iSelectDB As mgrSQLite.Database) Dim oDatabase As New mgrSQLite(iSelectDB) Dim sSQL As String Dim hshParams As Hashtable - sSQL = "UPDATE manifest SET Name = @Name, FileName = @FileName, RestorePath = @Path, AbsolutePath = @AbsolutePath, " - sSQL &= "DateUpdated = @DateUpdated, UpdatedBy = @UpdatedBy, CheckSum = @CheckSum WHERE Name = @QueryName" + sSQL = "UPDATE manifest SET MonitorID = @MonitorID, FileName = @FileName, DateUpdated = @DateUpdated, " + sSQL &= "UpdatedBy = @UpdatedBy, CheckSum = @CheckSum WHERE MonitorID = @QueryID" hshParams = SetCoreParameters(oBackupItem) - hshParams.Add("QueryName", oBackupItem.Name) + hshParams.Add("QueryID", oBackupItem.MonitorID) oDatabase.RunParamQuery(sSQL, hshParams) End Sub - Public Shared Sub DoManifestUpdateByID(ByVal oBackupItem As clsBackup, ByVal iSelectDB As mgrSQLite.Database) + Public Shared Sub DoManifestUpdateByManifestID(ByVal oBackupItem As clsBackup, ByVal iSelectDB As mgrSQLite.Database) Dim oDatabase As New mgrSQLite(iSelectDB) Dim sSQL As String Dim hshParams As Hashtable - sSQL = "UPDATE manifest SET Name = @Name, FileName = @FileName, RestorePath = @Path, AbsolutePath = @AbsolutePath, " - sSQL &= "DateUpdated = @DateUpdated, UpdatedBy = @UpdatedBy, CheckSum = @CheckSum WHERE ManifestID = @QueryID" + sSQL = "UPDATE manifest SET MonitorID = @MonitorID, FileName = @FileName, DateUpdated = @DateUpdated, " + sSQL &= "UpdatedBy = @UpdatedBy, CheckSum = @CheckSum WHERE ManifestID = @QueryID" hshParams = SetCoreParameters(oBackupItem) - hshParams.Add("QueryID", oBackupItem.ID) + hshParams.Add("QueryID", oBackupItem.ManifestID) oDatabase.RunParamQuery(sSQL, hshParams) End Sub - Public Shared Sub DoManifestDeletebyName(ByVal oBackupItem As clsBackup, ByVal iSelectDB As mgrSQLite.Database) + Public Shared Sub DoManifestDeleteByMonitorID(ByVal oBackupItem As clsBackup, ByVal iSelectDB As mgrSQLite.Database) Dim oDatabase As New mgrSQLite(iSelectDB) Dim sSQL As String Dim hshParams As New Hashtable sSQL = "DELETE FROM manifest " - sSQL &= "WHERE Name = @Name" + sSQL &= "WHERE MonitorID = @MonitorID" - hshParams.Add("Name", oBackupItem.Name) + hshParams.Add("MonitorID", oBackupItem.MonitorID) oDatabase.RunParamQuery(sSQL, hshParams) End Sub - Public Shared Sub DoManifestDeletebyID(ByVal oBackupItem As clsBackup, ByVal iSelectDB As mgrSQLite.Database) + Public Shared Sub DoManifestDeleteByManifestID(ByVal oBackupItem As clsBackup, ByVal iSelectDB As mgrSQLite.Database) Dim oDatabase As New mgrSQLite(iSelectDB) Dim sSQL As String Dim hshParams As New Hashtable sSQL = "DELETE FROM manifest " - sSQL &= "WHERE ManifestID = @ID" + sSQL &= "WHERE ManifestID = @ManifestID" - hshParams.Add("ID", oBackupItem.ID) + hshParams.Add("ManifestID", oBackupItem.ManifestID) oDatabase.RunParamQuery(sSQL, hshParams) End Sub diff --git a/GBM/Managers/mgrMonitorList.vb b/GBM/Managers/mgrMonitorList.vb index 6dbe92a..fcb8bc3 100644 --- a/GBM/Managers/mgrMonitorList.vb +++ b/GBM/Managers/mgrMonitorList.vb @@ -86,7 +86,7 @@ Public Class mgrMonitorList Select Case eListType Case eListTypes.FullList 'Don't wrap this, if it fails there's a problem with the database - hshList.Add(oGame.ProcessName & ":" & oGame.KeySafeName, oGame) + hshList.Add(oGame.CompoundKey, oGame) Case eListTypes.ScanList For Each de As DictionaryEntry In hshList bIsDupe = False @@ -116,7 +116,7 @@ Public Class mgrMonitorList If bIsDupe Then DirectCast(hshList.Item(oCompareGame.ProcessName), clsGame).Duplicate = True - oGame.ProcessName = oGame.ProcessName & ":" & oGame.KeySafeName + oGame.ProcessName = oGame.CompoundKey oGame.Duplicate = True End If Next @@ -190,7 +190,9 @@ Public Class mgrMonitorList Dim sSQL As String Dim hshParams As New Hashtable - sSQL = "DELETE FROM gametags " + sSQL = "DELETE FROM manifest " + sSQL &= "WHERE MonitorID = @MonitorID;" + sSQL &= "DELETE FROM gametags " sSQL &= "WHERE MonitorID = @MonitorID;" If iSelectDB = mgrSQLite.Database.Local Then sSQL &= "DELETE FROM sessions " @@ -211,7 +213,19 @@ Public Class mgrMonitorList Dim hshParams As New Hashtable Dim iCounter As Integer - sSQL = "DELETE FROM gametags " + sSQL = "DELETE FROM manifest " + sSQL &= "WHERE MonitorID IN (" + + For Each s As String In sMonitorIDs + sSQL &= "@MonitorID" & iCounter & "," + hshParams.Add("MonitorID" & iCounter, s) + iCounter += 1 + Next + + sSQL = sSQL.TrimEnd(",") + sSQL &= ");" + + sSQL &= "DELETE FROM gametags " sSQL &= "WHERE MonitorID IN (" For Each s As String In sMonitorIDs diff --git a/GBM/Managers/mgrRestore.vb b/GBM/Managers/mgrRestore.vb index 9b91118..1484ef5 100644 --- a/GBM/Managers/mgrRestore.vb +++ b/GBM/Managers/mgrRestore.vb @@ -28,25 +28,11 @@ Public Class mgrRestore Public Event UpdateRestoreInfo(oRestoreInfo As clsBackup) Public Event SetLastAction(sMessage As String) - Public Shared Sub DoPathOverride(ByRef oCheckBackup As clsBackup, ByVal oCheckGame As clsGame) - 'Always override the manifest restore path with the current configuration path if possible - If Not oCheckGame.Temporary Then - If Path.IsPathRooted(oCheckGame.Path) Then - oCheckBackup.AbsolutePath = True - Else - oCheckBackup.AbsolutePath = False - End If - oCheckBackup.RestorePath = oCheckGame.Path - End If - End Sub - Public Shared Function CheckPath(ByRef oRestoreInfo As clsBackup, ByVal oGame As clsGame, ByRef bTriggerReload As Boolean) As Boolean Dim sProcess As String Dim sRestorePath As String Dim bNoAuto As Boolean - DoPathOverride(oRestoreInfo, oGame) - If Not oRestoreInfo.AbsolutePath Then If oGame.ProcessPath <> String.Empty Then oRestoreInfo.RelativeRestorePath = oGame.ProcessPath & Path.DirectorySeparatorChar & oRestoreInfo.RestorePath @@ -72,7 +58,7 @@ Public Class mgrRestore Return True End Function - Public Shared Function CheckManifest(ByVal sAppName As String) As Boolean + Public Shared Function CheckManifest(ByVal sMonitorID As String) As Boolean Dim slLocalManifest As SortedList Dim slRemoteManifest As SortedList Dim oLocalItem As New clsBackup @@ -83,13 +69,13 @@ Public Class mgrRestore slLocalManifest = mgrManifest.ReadLatestManifest(mgrSQLite.Database.Local) slRemoteManifest = mgrManifest.ReadLatestManifest(mgrSQLite.Database.Remote) - If slLocalManifest.Contains(sAppName) Then - oLocalItem = DirectCast(slLocalManifest(sAppName), clsBackup) + If slLocalManifest.Contains(sMonitorID) Then + oLocalItem = DirectCast(slLocalManifest(sMonitorID), clsBackup) bLocal = True End If - If slRemoteManifest.Contains(sAppName) Then - oRemoteItem = DirectCast(slRemoteManifest(sAppName), clsBackup) + If slRemoteManifest.Contains(sMonitorID) Then + oRemoteItem = DirectCast(slRemoteManifest(sMonitorID), clsBackup) bRemote = True End If @@ -119,14 +105,14 @@ Public Class mgrRestore slRemoteManifest = mgrManifest.ReadLatestManifest(mgrSQLite.Database.Remote) For Each oItem As clsBackup In slRemoteManifest.Values - If slLocalManifest.Contains(oItem.Name) Then - oLocalItem = DirectCast(slLocalManifest(oItem.Name), clsBackup) + If slLocalManifest.Contains(oItem.MonitorID) Then + oLocalItem = DirectCast(slLocalManifest(oItem.MonitorID), clsBackup) If oItem.DateUpdated > oLocalItem.DateUpdated Then - slRestoreItems.Add(oItem.Name, oItem) + slRestoreItems.Add(oItem.MonitorID, oItem) End If Else - slRestoreItems.Add(oItem.Name, oItem) + slRestoreItems.Add(oItem.MonitorID, oItem) End If Next @@ -142,9 +128,9 @@ Public Class mgrRestore slRemoteManifest = mgrManifest.ReadLatestManifest(mgrSQLite.Database.Remote) For Each oItem As clsBackup In slLocalManifest.Values - If Not slRemoteManifest.Contains(oItem.Name) Then - slRemovedItems.Add(oItem.Name, oItem) - mgrManifest.DoManifestDeletebyName(oItem, mgrSQLite.Database.Local) + If Not slRemoteManifest.Contains(oItem.MonitorID) Then + slRemovedItems.Add(oItem.MonitorID, oItem) + mgrManifest.DoManifestDeleteByMonitorID(oItem, mgrSQLite.Database.Local) End If Next @@ -262,8 +248,8 @@ Public Class mgrRestore If bRestoreCompleted Then 'Save Local Manifest - If mgrManifest.DoGlobalManifestCheck(oBackupInfo.Name, mgrSQLite.Database.Local) Then - mgrManifest.DoManifestUpdateByName(oBackupInfo, mgrSQLite.Database.Local) + If mgrManifest.DoManifestCheck(oBackupInfo.MonitorID, mgrSQLite.Database.Local) Then + mgrManifest.DoManifestUpdateByMonitorID(oBackupInfo, mgrSQLite.Database.Local) Else mgrManifest.DoManifestAdd(oBackupInfo, mgrSQLite.Database.Local) End If diff --git a/GBM/Managers/mgrSQLite.vb b/GBM/Managers/mgrSQLite.vb index 252842f..1e3651d 100644 --- a/GBM/Managers/mgrSQLite.vb +++ b/GBM/Managers/mgrSQLite.vb @@ -80,10 +80,10 @@ Public Class mgrSQLite sSql &= "CREATE TABLE savedpath (PathName TEXT NOT NULL PRIMARY KEY, Path TEXT NOT NULL);" 'Add Tables (Monitor List) - sSql &= "CREATE TABLE monitorlist (MonitorID TEXT NOT NULL UNIQUE, Name TEXT NOT NULL, Process TEXT NOT NULL, Path TEXT, " & + sSql &= "CREATE TABLE monitorlist (MonitorID TEXT NOT NULL PRIMARY KEY, Name TEXT NOT NULL, Process TEXT NOT NULL, Path TEXT, " & "AbsolutePath BOOLEAN NOT NULL, FolderSave BOOLEAN NOT NULL, FileType TEXT, TimeStamp BOOLEAN NOT NULL, ExcludeList TEXT NOT NULL, " & "ProcessPath TEXT, Icon TEXT, Hours REAL, Version TEXT, Company TEXT, Enabled BOOLEAN NOT NULL, MonitorOnly BOOLEAN NOT NULL, " & - "BackupLimit INTEGER NOT NULL, CleanFolder BOOLEAN NOT NULL, Parameter TEXT, Comments TEXT, IsRegEx BOOLEAN NOT NULL, PRIMARY KEY(Name, Process));" + "BackupLimit INTEGER NOT NULL, CleanFolder BOOLEAN NOT NULL, Parameter TEXT, Comments TEXT, IsRegEx BOOLEAN NOT NULL);" 'Add Tables (Tags) sSql &= "CREATE TABLE tags (TagID TEXT NOT NULL UNIQUE, Name TEXT NOT NULL PRIMARY KEY); " @@ -95,8 +95,8 @@ Public Class mgrSQLite sSql &= "CREATE TABLE variables (VariableID TEXT NOT NULL UNIQUE, Name TEXT NOT NULL PRIMARY KEY, Path TEXT NOT NULL);" 'Add Tables (Local Manifest) - sSql &= "CREATE TABLE manifest (ManifestID TEXT NOT NULL PRIMARY KEY, Name TEXT NOT NULL, FileName TEXT NOT NULL, RestorePath TEXT NOT NULL, " & - "AbsolutePath BOOLEAN NOT NULL, DateUpdated TEXT NOT NULL, UpdatedBy TEXT NOT NULL, CheckSum TEXT);" + sSql &= "CREATE TABLE manifest (ManifestID TEXT NOT NULL PRIMARY KEY, MonitorID TEXT NOT NULL, FileName TEXT NOT NULL, " & + "DateUpdated TEXT NOT NULL, UpdatedBy TEXT NOT NULL, CheckSum TEXT);" 'Add Tables (Sessions) sSql &= "CREATE TABLE sessions (MonitorID TEXT NOT NULL, Start INTEGER NOT NULL, End INTEGER NOT NULL, PRIMARY KEY(MonitorID, Start));" @@ -120,14 +120,14 @@ Public Class mgrSQLite SqliteConnection.CreateFile(sDatabaseLocation) 'Add Tables (Remote Monitor List) - sSql = "CREATE TABLE monitorlist (MonitorID TEXT NOT NULL UNIQUE, Name TEXT NOT NULL, Process TEXT NOT NULL, Path TEXT, " & + sSql = "CREATE TABLE monitorlist (MonitorID TEXT NOT NULL PRIMARY KEY, Name TEXT NOT NULL, Process TEXT NOT NULL, Path TEXT, " & "AbsolutePath BOOLEAN NOT NULL, FolderSave BOOLEAN NOT NULL, FileType TEXT, TimeStamp BOOLEAN NOT NULL, ExcludeList TEXT NOT NULL, " & "ProcessPath TEXT, Icon TEXT, Hours REAL, Version TEXT, Company TEXT, Enabled BOOLEAN NOT NULL, MonitorOnly BOOLEAN NOT NULL, " & - "BackupLimit INTEGER NOT NULL, CleanFolder BOOLEAN NOT NULL, Parameter TEXT, Comments TEXT, IsRegEx BOOLEAN NOT NULL, PRIMARY KEY(Name, Process));" + "BackupLimit INTEGER NOT NULL, CleanFolder BOOLEAN NOT NULL, Parameter TEXT, Comments TEXT, IsRegEx BOOLEAN NOT NULL);" 'Add Tables (Remote Manifest) - sSql &= "CREATE TABLE manifest (ManifestID TEXT NOT NULL PRIMARY KEY, Name TEXT NOT NULL, FileName TEXT NOT NULL, RestorePath TEXT NOT NULL, " & - "AbsolutePath BOOLEAN NOT NULL, DateUpdated TEXT NOT NULL, UpdatedBy TEXT NOT NULL, CheckSum TEXT);" + sSql &= "CREATE TABLE manifest (ManifestID TEXT NOT NULL PRIMARY KEY, MonitorID TEXT NOT NULL, FileName TEXT NOT NULL, " & + "DateUpdated TEXT NOT NULL, UpdatedBy TEXT NOT NULL, CheckSum TEXT);" 'Add Tables (Remote Tags) sSql &= "CREATE TABLE tags (TagID TEXT NOT NULL UNIQUE, Name TEXT NOT NULL PRIMARY KEY); " @@ -267,7 +267,7 @@ Public Class mgrSQLite Dim oResult As New Object Connect() - Command = New SqliteCommand(sSQL, db) + command = New SqliteCommand(sSQL, db) BuildParams(command, hshParams) Try @@ -759,6 +759,58 @@ Public Class mgrSQLite RunParamQuery(sSQL, New Hashtable) End If End If + + '1.10 Upgrade + If GetDatabaseVersion() < 110 Then + If eDatabase = Database.Local Then + 'Backup DB before starting + BackupDB("v108") + + 'Overhaul Tables + sSQL = "CREATE TABLE monitorlist_new (MonitorID TEXT NOT NULL PRIMARY KEY, Name TEXT NOT NULL, Process TEXT NOT NULL, Path TEXT, " & + "AbsolutePath BOOLEAN NOT NULL, FolderSave BOOLEAN NOT NULL, FileType TEXT, TimeStamp BOOLEAN NOT NULL, ExcludeList TEXT NOT NULL, " & + "ProcessPath TEXT, Icon TEXT, Hours REAL, Version TEXT, Company TEXT, Enabled BOOLEAN NOT NULL, MonitorOnly BOOLEAN NOT NULL, " & + "BackupLimit INTEGER NOT NULL, CleanFolder BOOLEAN NOT NULL, Parameter TEXT, Comments TEXT, IsRegEx BOOLEAN NOT NULL);" + sSQL &= "INSERT INTO monitorlist_new (MonitorID, Name, Process, Path, AbsolutePath, FolderSave, FileType, TimeStamp, ExcludeList, " & + "ProcessPath, Icon, Hours, Version, Company, Enabled, MonitorOnly, BackupLimit, CleanFolder, Parameter, Comments, IsRegEx)" & + "SELECT MonitorID, Name, Process, Path, AbsolutePath, FolderSave, FileType, TimeStamp, ExcludeList, " & + "ProcessPath, Icon, Hours, Version, Company, Enabled, MonitorOnly, BackupLimit, CleanFolder, Parameter, Comments, IsRegEx FROM monitorlist;" & + "DROP TABLE monitorlist; ALTER TABLE monitorlist_new RENAME TO monitorlist;" + sSQL &= "CREATE TABLE manifest_new (ManifestID TEXT NOT NULL PRIMARY KEY, MonitorID TEXT NOT NULL, FileName TEXT NOT NULL, " & + "DateUpdated TEXT NOT NULL, UpdatedBy TEXT NOT NULL, CheckSum TEXT);" + sSQL &= "INSERT INTO manifest_new (ManifestID, MonitorID, FileName, DateUpdated, UpdatedBy, CheckSum) " & + "SELECT ManifestID, MonitorID, FileName, DateUpdated, UpdatedBy, CheckSum FROM manifest NATURAL JOIN monitorlist;" & + "DROP TABLE manifest; ALTER TABLE manifest_new RENAME TO manifest;" + + sSQL &= "PRAGMA user_version=110" + + RunParamQuery(sSQL, New Hashtable) + End If + If eDatabase = Database.Remote Then + 'Backup DB before starting + BackupDB("v108") + + 'Overhaul Tables + sSQL = "CREATE TABLE monitorlist_new (MonitorID TEXT NOT NULL PRIMARY KEY, Name TEXT NOT NULL, Process TEXT NOT NULL, Path TEXT, " & + "AbsolutePath BOOLEAN NOT NULL, FolderSave BOOLEAN NOT NULL, FileType TEXT, TimeStamp BOOLEAN NOT NULL, ExcludeList TEXT NOT NULL, " & + "ProcessPath TEXT, Icon TEXT, Hours REAL, Version TEXT, Company TEXT, Enabled BOOLEAN NOT NULL, MonitorOnly BOOLEAN NOT NULL, " & + "BackupLimit INTEGER NOT NULL, CleanFolder BOOLEAN NOT NULL, Parameter TEXT, Comments TEXT, IsRegEx BOOLEAN NOT NULL);" + sSQL &= "INSERT INTO monitorlist_new (MonitorID, Name, Process, Path, AbsolutePath, FolderSave, FileType, TimeStamp, ExcludeList, " & + "ProcessPath, Icon, Hours, Version, Company, Enabled, MonitorOnly, BackupLimit, CleanFolder, Parameter, Comments, IsRegEx)" & + "SELECT MonitorID, Name, Process, Path, AbsolutePath, FolderSave, FileType, TimeStamp, ExcludeList, " & + "ProcessPath, Icon, Hours, Version, Company, Enabled, MonitorOnly, BackupLimit, CleanFolder, Parameter, Comments, IsRegEx FROM monitorlist;" & + "DROP TABLE monitorlist; ALTER TABLE monitorlist_new RENAME TO monitorlist;" + sSQL &= "CREATE TABLE manifest_new (ManifestID TEXT NOT NULL PRIMARY KEY, MonitorID TEXT NOT NULL, FileName TEXT NOT NULL, " & + "DateUpdated TEXT NOT NULL, UpdatedBy TEXT NOT NULL, CheckSum TEXT);" + sSQL &= "INSERT INTO manifest_new (ManifestID, MonitorID, FileName, DateUpdated, UpdatedBy, CheckSum) " & + "SELECT ManifestID, MonitorID, FileName, DateUpdated, UpdatedBy, CheckSum FROM manifest NATURAL JOIN monitorlist;" & + "DROP TABLE manifest; ALTER TABLE manifest_new RENAME TO manifest;" + + sSQL &= "PRAGMA user_version=110" + + RunParamQuery(sSQL, New Hashtable) + End If + End If End Sub Public Function GetDBSize() As Long diff --git a/GBM/Managers/mgrXML.vb b/GBM/Managers/mgrXML.vb index d904bf7..baf385f 100644 --- a/GBM/Managers/mgrXML.vb +++ b/GBM/Managers/mgrXML.vb @@ -42,7 +42,7 @@ Public Class mgrXML 'This should be wrapped just in case we get some bad data Try - hshList.Add(oGame.ProcessName & ":" & oGame.KeySafeName, oGame) + hshList.Add(oGame.CompoundKey, oGame) Catch e As Exception 'Do Nothing End Try diff --git a/GBM/My Project/AssemblyInfo.vb b/GBM/My Project/AssemblyInfo.vb index 053293a..ab5fda0 100644 --- a/GBM/My Project/AssemblyInfo.vb +++ b/GBM/My Project/AssemblyInfo.vb @@ -33,7 +33,7 @@ Imports System.Runtime.InteropServices ' by using the '*' as shown below: ' - - + + \ No newline at end of file From 848679c1b1650e40f366a3abe382ea76db47f123 Mon Sep 17 00:00:00 2001 From: MikeMaximus Date: Thu, 1 Mar 2018 13:42:26 -0600 Subject: [PATCH 02/38] Fixed manifest issues with auto-restore and game manager --- GBM/Forms/frmGameManager.vb | 6 +++++- GBM/Forms/frmMain.vb | 39 +++++++++++++++++----------------- GBM/Managers/mgrMonitorList.vb | 6 +++--- GBM/Managers/mgrRestore.vb | 11 ++++++++++ 4 files changed, 39 insertions(+), 23 deletions(-) diff --git a/GBM/Forms/frmGameManager.vb b/GBM/Forms/frmGameManager.vb index bf45b3f..386c7fb 100644 --- a/GBM/Forms/frmGameManager.vb +++ b/GBM/Forms/frmGameManager.vb @@ -172,7 +172,7 @@ Public Class frmGameManager Dim sFileName As String Dim sNewFileName As String - 'If there is a name change, check and update the manifest + 'If there is an ID change, check and update the manifest If oNewApp.ID <> oOriginalApp.ID Then 'Local If mgrManifest.DoManifestCheck(oOriginalApp.ID, mgrSQLite.Database.Local) Then @@ -625,6 +625,9 @@ Public Class frmGameManager CurrentBackupItem = DirectCast(oRemoteBackupData(oApp.ID), clsBackup) + 'Override Path + CurrentBackupItem.RestorePath = oApp.Path + sFileName = BackupFolder & CurrentBackupItem.FileName btnOpenBackupFile.Enabled = True @@ -638,6 +641,7 @@ Public Class frmGameManager lblBackupFileData.Text = frmGameManager_ErrorNoBackupExists End If + mgrRestore.DoPathOverride(CurrentBackupItem, oApp) lblRestorePathData.Text = CurrentBackupItem.RestorePath Else oComboItems.Add(New KeyValuePair(Of String, String)(String.Empty, frmGameManager_None)) diff --git a/GBM/Forms/frmMain.vb b/GBM/Forms/frmMain.vb index 303cb91..0271255 100644 --- a/GBM/Forms/frmMain.vb +++ b/GBM/Forms/frmMain.vb @@ -365,9 +365,9 @@ Public Class frmMain Private Sub AutoRestoreCheck() Dim slRestoreData As SortedList = mgrRestore.CompareManifests() - Dim sNotReady As New List(Of String) - Dim sNotInstalled As New List(Of String) - Dim sNoCheckSum As New List(Of String) + Dim oNotReady As New List(Of clsBackup) + Dim oNotInstalled As New List(Of clsBackup) + Dim oNoCheckSum As New List(Of clsBackup) Dim oBackup As clsBackup Dim sFileName As String Dim sExtractPath As String @@ -395,15 +395,15 @@ Public Class frmMain If oBackup.CheckSum <> String.Empty Then sFileName = oSettings.BackupFolder & Path.DirectorySeparatorChar & oBackup.FileName If mgrHash.Generate_SHA256_Hash(sFileName) <> oBackup.CheckSum Then - sNotReady.Add(de.Key) + oNotReady.Add(oBackup) bFinished = False End If Else - sNoCheckSum.Add(de.Key) + oNoCheckSum.Add(oBackup) End If 'Check if the restore location exists, if not we assume the game is not installed and should be auto-marked. - hshGames = mgrMonitorList.DoListGetbyName(de.Key) + hshGames = mgrMonitorList.DoListGetbyMonitorID(de.Key) If hshGames.Count = 1 Then oGame = DirectCast(hshGames(0), clsGame) If oGame.ProcessPath <> String.Empty Then @@ -425,28 +425,28 @@ Public Class frmMain mgrManifest.DoManifestAdd(de.Value, mgrSQLite.Database.Local) End If End If - sNotInstalled.Add(de.Key) + oNotInstalled.Add(oBackup) End If Next 'Remove any backup files that are not ready - For Each s As String In sNotReady - slRestoreData.Remove(s) - UpdateLog(mgrCommon.FormatString(frmMain_RestoreNotReady, s), False, ToolTipIcon.Info, True) + For Each o As clsBackup In oNotReady + slRestoreData.Remove(o.MonitorID) + UpdateLog(mgrCommon.FormatString(frmMain_RestoreNotReady, o.Name), False, ToolTipIcon.Info, True) Next 'Remove any backup files that should not be automatically restored - For Each s As String In sNotInstalled - slRestoreData.Remove(s) + For Each o As clsBackup In oNotInstalled + slRestoreData.Remove(o.MonitorID) If oSettings.AutoMark Then - UpdateLog(mgrCommon.FormatString(frmMain_AutoMark, s), False, ToolTipIcon.Info, True) + UpdateLog(mgrCommon.FormatString(frmMain_AutoMark, o.Name), False, ToolTipIcon.Info, True) Else - UpdateLog(mgrCommon.FormatString(frmMain_NoAutoMark, s), False, ToolTipIcon.Info, True) + UpdateLog(mgrCommon.FormatString(frmMain_NoAutoMark, o.Name), False, ToolTipIcon.Info, True) End If Next - For Each s As String In sNoCheckSum - slRestoreData.Remove(s) - UpdateLog(mgrCommon.FormatString(frmMain_NoCheckSum, s), False, ToolTipIcon.Info, True) + For Each o As clsBackup In oNoCheckSum + slRestoreData.Remove(o.MonitorID) + UpdateLog(mgrCommon.FormatString(frmMain_NoCheckSum, o.Name), False, ToolTipIcon.Info, True) Next 'Automatically restore backup files @@ -455,13 +455,14 @@ Public Class frmMain hshRestore = New Hashtable sGame = String.Empty For Each de As DictionaryEntry In slRestoreData - hshGames = mgrMonitorList.DoListGetbyName(de.Key) + oBackup = DirectCast(de.Value, clsBackup) + hshGames = mgrMonitorList.DoListGetbyMonitorID(de.Key) If hshGames.Count = 1 Then oGame = DirectCast(hshGames(0), clsGame) sGame = oGame.CroppedName hshRestore.Add(oGame, de.Value) Else - UpdateLog(mgrCommon.FormatString(frmMain_AutoRestoreFailure, de.Key), False, ToolTipIcon.Info, True) + UpdateLog(mgrCommon.FormatString(frmMain_AutoRestoreFailure, oBackup.Name), False, ToolTipIcon.Info, True) End If Next diff --git a/GBM/Managers/mgrMonitorList.vb b/GBM/Managers/mgrMonitorList.vb index fcb8bc3..da957a2 100644 --- a/GBM/Managers/mgrMonitorList.vb +++ b/GBM/Managers/mgrMonitorList.vb @@ -287,7 +287,7 @@ Public Class mgrMonitorList Return oGame End Function - Public Shared Function DoListGetbyName(ByVal sName As String, Optional ByVal iSelectDB As mgrSQLite.Database = mgrSQLite.Database.Local) As Hashtable + Public Shared Function DoListGetbyMonitorID(ByVal sMonitorID As String, Optional ByVal iSelectDB As mgrSQLite.Database = mgrSQLite.Database.Local) As Hashtable Dim oDatabase As New mgrSQLite(iSelectDB) Dim sSQL As String Dim oData As DataSet @@ -297,9 +297,9 @@ Public Class mgrMonitorList Dim iCounter As Integer = 0 sSQL = "SELECT * from monitorlist " - sSQL &= "WHERE Name = @Name" + sSQL &= "WHERE MonitorID = @MonitorID" - hshParams.Add("Name", sName) + hshParams.Add("MonitorID", sMonitorID) oData = oDatabase.ReadParamData(sSQL, hshParams) diff --git a/GBM/Managers/mgrRestore.vb b/GBM/Managers/mgrRestore.vb index 1484ef5..a863415 100644 --- a/GBM/Managers/mgrRestore.vb +++ b/GBM/Managers/mgrRestore.vb @@ -28,6 +28,17 @@ Public Class mgrRestore Public Event UpdateRestoreInfo(oRestoreInfo As clsBackup) Public Event SetLastAction(sMessage As String) + 'This should only be needed by the Game Manager after v1.1.0 + Public Shared Sub DoPathOverride(ByRef oCheckBackup As clsBackup, ByVal oCheckGame As clsGame) + If Path.IsPathRooted(oCheckGame.Path) Then + oCheckBackup.AbsolutePath = True + Else + oCheckBackup.AbsolutePath = False + End If + + oCheckBackup.RestorePath = oCheckGame.Path + End Sub + Public Shared Function CheckPath(ByRef oRestoreInfo As clsBackup, ByVal oGame As clsGame, ByRef bTriggerReload As Boolean) As Boolean Dim sProcess As String Dim sRestorePath As String From b7b23cba4a1988e324322c43a7f75182d7328323 Mon Sep 17 00:00:00 2001 From: MikeMaximus Date: Thu, 1 Mar 2018 20:45:43 -0600 Subject: [PATCH 03/38] Updated Import / Export / Sync with game id changes --- GBM/Classes/XML Serialize Classes/Game.vb | 10 ++++++ GBM/Classes/clsGame.vb | 41 +++++++++++++++++++++++ GBM/Forms/frmAdvancedImport.vb | 9 +++-- GBM/Managers/mgrMonitorList.vb | 34 ++++++++++--------- GBM/Managers/mgrTags.vb | 2 +- GBM/Managers/mgrXML.vb | 3 +- 6 files changed, 79 insertions(+), 20 deletions(-) diff --git a/GBM/Classes/XML Serialize Classes/Game.vb b/GBM/Classes/XML Serialize Classes/Game.vb index 73bd512..dea9b41 100644 --- a/GBM/Classes/XML Serialize Classes/Game.vb +++ b/GBM/Classes/XML Serialize Classes/Game.vb @@ -1,4 +1,5 @@ Public Class Game + Private sGameID As String Private sGameName As String Private sProcessName As String Private sParameter As String @@ -12,6 +13,15 @@ Private bIsRegEx As Boolean Private oTags As List(Of Tag) + Property ID As String + Set(value As String) + sGameID = value + End Set + Get + Return sGameID + End Get + End Property + Property Name As String Set(value As String) sGameName = value diff --git a/GBM/Classes/clsGame.vb b/GBM/Classes/clsGame.vb index 17f5822..cebeae3 100644 --- a/GBM/Classes/clsGame.vb +++ b/GBM/Classes/clsGame.vb @@ -23,6 +23,7 @@ Public Class clsGame Private bIsRegEx As Boolean = False Private bDuplicate As Boolean = False Private oImportTags As New List(Of Tag) + Private bImportUpdate As Boolean = False Public Enum eOptionalSyncFields None = 0 @@ -269,6 +270,15 @@ Public Class clsGame End Set End Property + Property ImportUpdate As Boolean + Get + Return bImportUpdate + End Get + Set(value As Boolean) + bImportUpdate = value + End Set + End Property + ReadOnly Property IncludeArray As String() Get If FileType = String.Empty Then @@ -384,12 +394,43 @@ Public Class clsGame If oGame Is Nothing Then Return False Else + 'Core Fields If ID <> oGame.ID Then Return False End If + If Name <> oGame.Name Then + Return False + End If If ProcessName <> oGame.ProcessName Then Return False End If + If Parameter <> oGame.Parameter Then + Return False + End If + If Path <> oGame.Path Then + Return False + End If + If FileType <> oGame.FileType Then + Return False + End If + If ExcludeList <> oGame.ExcludeList Then + Return False + End If + If AbsolutePath <> oGame.AbsolutePath Then + Return False + End If + If FolderSave <> oGame.FolderSave Then + Return False + End If + If MonitorOnly <> oGame.MonitorOnly Then + Return False + End If + If Comments <> oGame.Comments Then + Return False + End If + If IsRegEx <> oGame.IsRegEx Then + Return False + End If Return True End If End Function diff --git a/GBM/Forms/frmAdvancedImport.vb b/GBM/Forms/frmAdvancedImport.vb index f71dec8..2ec181d 100644 --- a/GBM/Forms/frmAdvancedImport.vb +++ b/GBM/Forms/frmAdvancedImport.vb @@ -82,9 +82,9 @@ Public Class frmAdvancedImport sTags = sTags.TrimEnd(New Char() {",", " "}) oListViewItem = New ListViewItem(New String() {oApp.Name, oApp.TrueProcess, sTags}) - oListViewItem.Tag = oApp.CompoundKey + oListViewItem.Tag = oApp.ID - If FinalData.ContainsKey(oApp.CompoundKey) Then + If FinalData.ContainsKey(oApp.ID) Then oListViewItem.Checked = True Else oListViewItem.Checked = False @@ -103,6 +103,11 @@ Public Class frmAdvancedImport End If End If + If oApp.ImportUpdate Then + oListViewItem.ForeColor = Color.Red + oListViewItem.Checked = True + End If + If sFilter = String.Empty Then bAddItem = True Else diff --git a/GBM/Managers/mgrMonitorList.vb b/GBM/Managers/mgrMonitorList.vb index da957a2..eb1b16e 100644 --- a/GBM/Managers/mgrMonitorList.vb +++ b/GBM/Managers/mgrMonitorList.vb @@ -78,15 +78,14 @@ Public Class mgrMonitorList Dim oCompareGame As clsGame Dim bIsDupe As Boolean - sSQL = "Select * from monitorlist ORDER BY Name Asc" + sSQL = "Select * FROM monitorlist ORDER BY Name Asc" oData = oDatabase.ReadParamData(sSQL, New Hashtable) For Each dr As DataRow In oData.Tables(0).Rows oGame = MapToObject(dr) Select Case eListType Case eListTypes.FullList - 'Don't wrap this, if it fails there's a problem with the database - hshList.Add(oGame.CompoundKey, oGame) + hshList.Add(oGame.ID, oGame) Case eListTypes.ScanList For Each de As DictionaryEntry In hshList bIsDupe = False @@ -521,10 +520,10 @@ Public Class mgrMonitorList hshSyncItems = hshCompareFrom.Clone For Each oFromItem In hshCompareFrom.Values - If hshCompareTo.Contains(oFromItem.CompoundKey) Then - oToItem = DirectCast(hshCompareTo(oFromItem.CompoundKey), clsGame) + If hshCompareTo.Contains(oFromItem.ID) Then + oToItem = DirectCast(hshCompareTo(oFromItem.ID), clsGame) If oFromItem.SyncEquals(oToItem, eSyncFields) Then - hshSyncItems.Remove(oFromItem.CompoundKey) + hshSyncItems.Remove(oFromItem.ID) End If End If Next @@ -551,10 +550,10 @@ Public Class mgrMonitorList hshDeleteItems = hshCompareTo.Clone For Each oToItem In hshCompareTo.Values - If hshCompareFrom.Contains(oToItem.CompoundKey) Then - oFromItem = DirectCast(hshCompareFrom(oToItem.CompoundKey), clsGame) + If hshCompareFrom.Contains(oToItem.ID) Then + oFromItem = DirectCast(hshCompareFrom(oToItem.ID), clsGame) If oToItem.MinimalEquals(oFromItem) Then - hshDeleteItems.Remove(oToItem.CompoundKey) + hshDeleteItems.Remove(oToItem.ID) End If End If Next @@ -749,7 +748,6 @@ Public Class mgrMonitorList Dim oDatabase As New mgrSQLite(iSelectDB) Dim oData As DataSet Dim sSQL As String = String.Empty - Dim sID As String Dim oList As New List(Of Game) Dim oGame As Game Dim hshParams As New Hashtable @@ -760,7 +758,7 @@ Public Class mgrMonitorList For Each dr As DataRow In oData.Tables(0).Rows oGame = New Game - sID = CStr(dr("MonitorID")) + oGame.ID = CStr(dr("MonitorID")) oGame.Name = CStr(dr("Name")) oGame.ProcessName = CStr(dr("Process")) If Not IsDBNull(dr("Path")) Then oGame.Path = CStr(dr("Path")) @@ -772,7 +770,7 @@ Public Class mgrMonitorList If Not IsDBNull(dr("Parameter")) Then oGame.Parameter = CStr(dr("Parameter")) If Not IsDBNull(dr("Comments")) Then oGame.Comments = CStr(dr("Comments")) oGame.IsRegEx = CBool(dr("IsRegEx")) - oGame.Tags = mgrGameTags.GetTagsByGameForExport(sID) + oGame.Tags = mgrGameTags.GetTagsByGameForExport(oGame.ID) oList.Add(oGame) Next @@ -818,10 +816,14 @@ Public Class mgrMonitorList hshSyncItems = hshCompareFrom.Clone For Each oFromItem In hshCompareFrom.Values - If hshCompareTo.Contains(oFromItem.CompoundKey) Then - oToItem = DirectCast(hshCompareTo(oFromItem.CompoundKey), clsGame) - If oFromItem.CoreEquals(oToItem) Then - hshSyncItems.Remove(oFromItem.CompoundKey) + If hshCompareTo.Contains(oFromItem.ID) Then + oToItem = DirectCast(hshCompareTo(oFromItem.ID), clsGame) + If oFromItem.MinimalEquals(oToItem) Then + If oFromItem.CoreEquals(oToItem) Then + hshSyncItems.Remove(oFromItem.ID) + Else + DirectCast(hshSyncItems(oFromItem.ID), clsGame).ImportUpdate = True + End If End If End If Next diff --git a/GBM/Managers/mgrTags.vb b/GBM/Managers/mgrTags.vb index 95c84fa..9b5f80c 100644 --- a/GBM/Managers/mgrTags.vb +++ b/GBM/Managers/mgrTags.vb @@ -153,7 +153,7 @@ Dim hshParams As Hashtable Dim oParamList As New List(Of Hashtable) - sSQL = "INSERT OR REPLACE INTO tags VALUES (COALESCE((SELECT TagID FROM tags WHERE Name = @Name), @ID), @Name); INSERT INTO gametags VALUES ((SELECT TagID from tags WHERE Name=@Name), @MonitorID);" + sSQL = "INSERT OR REPLACE INTO tags VALUES (COALESCE((SELECT TagID FROM tags WHERE Name = @Name), @ID), @Name); INSERT OR REPLACE INTO gametags VALUES ((SELECT TagID from tags WHERE Name=@Name), @MonitorID);" For Each oGame As clsGame In hshTags.Values sMonitorID = oGame.ID For Each t As Tag In oGame.ImportTags diff --git a/GBM/Managers/mgrXML.vb b/GBM/Managers/mgrXML.vb index baf385f..5b1e91e 100644 --- a/GBM/Managers/mgrXML.vb +++ b/GBM/Managers/mgrXML.vb @@ -25,6 +25,7 @@ Public Class mgrXML For Each g As Game In oList oGame = New clsGame + oGame.ID = g.ID oGame.Name = g.Name oGame.ProcessName = g.ProcessName oGame.AbsolutePath = g.AbsolutePath @@ -42,7 +43,7 @@ Public Class mgrXML 'This should be wrapped just in case we get some bad data Try - hshList.Add(oGame.CompoundKey, oGame) + hshList.Add(oGame.ID, oGame) Catch e As Exception 'Do Nothing End Try From c2a752573ace0685f580cb4957d48462d8e59d5e Mon Sep 17 00:00:00 2001 From: MikeMaximus Date: Thu, 1 Mar 2018 21:15:33 -0600 Subject: [PATCH 04/38] Fixed import crash when importing old xml files --- GBM/Classes/clsGame.vb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/GBM/Classes/clsGame.vb b/GBM/Classes/clsGame.vb index cebeae3..ddaf18a 100644 --- a/GBM/Classes/clsGame.vb +++ b/GBM/Classes/clsGame.vb @@ -37,7 +37,9 @@ Public Class clsGame Property ID As String Set(value As String) - sGameID = mgrPath.ValidateForFileSystem(value) + If Not value Is Nothing Then + sGameID = mgrPath.ValidateForFileSystem(value) + End If End Set Get Return sGameID From 609ee09cfa85a76caf06e4c3239f4cdaee97943a Mon Sep 17 00:00:00 2001 From: MikeMaximus Date: Fri, 2 Mar 2018 12:00:00 -0600 Subject: [PATCH 05/38] Added ability to edit game ID and updated validation --- GBM/Forms/frmAddWizard.vb | 19 ++------- GBM/Forms/frmGameManager.Designer.vb | 48 +++++++++++++-------- GBM/Forms/frmGameManager.vb | 63 ++++++++++++++++++++++++---- GBM/Managers/mgrMonitorList.vb | 28 +++++++------ GBM/My Project/Resources.Designer.vb | 29 ++++++++++++- GBM/My Project/Resources.resx | 11 ++++- 6 files changed, 143 insertions(+), 55 deletions(-) diff --git a/GBM/Forms/frmAddWizard.vb b/GBM/Forms/frmAddWizard.vb index 2740b5d..57bbe29 100644 --- a/GBM/Forms/frmAddWizard.vb +++ b/GBM/Forms/frmAddWizard.vb @@ -264,22 +264,11 @@ Public Class frmAddWizard End Function Private Sub DoSave() - Dim hshDupeCheck As New Hashtable - Dim sNewGame As String = oGameToSave.CompoundKey - - For Each o As clsGame In GameData.Values - hshDupeCheck.Add(o.CompoundKey, String.Empty) - Next - - If hshDupeCheck.Contains(sNewGame) Then - mgrCommon.ShowMessage(frmAddWizard_ErrorGameDupe, MsgBoxStyle.Exclamation) - Else - mgrMonitorList.DoListAdd(oGameToSave) - If mgrCommon.ShowMessage(frmAddWizard_ConfirmSaveTags, New String() {oGameToSave.Name, oGameToSave.Name}, MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then - OpenTags(oGameToSave) - End If - Me.Close() + mgrMonitorList.DoListAdd(oGameToSave) + If mgrCommon.ShowMessage(frmAddWizard_ConfirmSaveTags, New String() {oGameToSave.Name, oGameToSave.Name}, MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then + OpenTags(oGameToSave) End If + Me.Close() End Sub Private Sub ValidateBack() diff --git a/GBM/Forms/frmGameManager.Designer.vb b/GBM/Forms/frmGameManager.Designer.vb index e69e342..b2c2604 100644 --- a/GBM/Forms/frmGameManager.Designer.vb +++ b/GBM/Forms/frmGameManager.Designer.vb @@ -101,6 +101,7 @@ Partial Class frmGameManager Me.cmsDeleteBackup = New System.Windows.Forms.ContextMenuStrip(Me.components) Me.cmsDeleteOne = New System.Windows.Forms.ToolStripMenuItem() Me.cmsDeleteAll = New System.Windows.Forms.ToolStripMenuItem() + Me.btnGameID = New System.Windows.Forms.Button() Me.grpConfig.SuspendLayout() CType(Me.nudLimit, System.ComponentModel.ISupportInitialize).BeginInit() Me.grpExtra.SuspendLayout() @@ -157,6 +158,7 @@ Partial Class frmGameManager 'grpConfig ' Me.grpConfig.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.grpConfig.Controls.Add(Me.btnGameID) Me.grpConfig.Controls.Add(Me.chkRegEx) Me.grpConfig.Controls.Add(Me.lblComments) Me.grpConfig.Controls.Add(Me.txtComments) @@ -194,7 +196,7 @@ Partial Class frmGameManager Me.chkRegEx.Location = New System.Drawing.Point(402, 46) Me.chkRegEx.Name = "chkRegEx" Me.chkRegEx.Size = New System.Drawing.Size(117, 17) - Me.chkRegEx.TabIndex = 5 + Me.chkRegEx.TabIndex = 6 Me.chkRegEx.Text = "Regular Expression" Me.chkRegEx.UseVisualStyleBackColor = True ' @@ -204,7 +206,7 @@ Partial Class frmGameManager Me.lblComments.Location = New System.Drawing.Point(7, 181) Me.lblComments.Name = "lblComments" Me.lblComments.Size = New System.Drawing.Size(59, 13) - Me.lblComments.TabIndex = 18 + Me.lblComments.TabIndex = 19 Me.lblComments.Text = "Comments:" ' 'txtComments @@ -214,14 +216,14 @@ Partial Class frmGameManager Me.txtComments.Name = "txtComments" Me.txtComments.ScrollBars = System.Windows.Forms.ScrollBars.Vertical Me.txtComments.Size = New System.Drawing.Size(413, 71) - Me.txtComments.TabIndex = 19 + Me.txtComments.TabIndex = 20 ' 'txtParameter ' Me.txtParameter.Location = New System.Drawing.Point(70, 71) Me.txtParameter.Name = "txtParameter" Me.txtParameter.Size = New System.Drawing.Size(414, 20) - Me.txtParameter.TabIndex = 7 + Me.txtParameter.TabIndex = 8 ' 'lblParameter ' @@ -229,7 +231,7 @@ Partial Class frmGameManager Me.lblParameter.Location = New System.Drawing.Point(7, 74) Me.lblParameter.Name = "lblParameter" Me.lblParameter.Size = New System.Drawing.Size(58, 13) - Me.lblParameter.TabIndex = 6 + Me.lblParameter.TabIndex = 7 Me.lblParameter.Text = "Parameter:" ' 'chkCleanFolder @@ -248,7 +250,7 @@ Partial Class frmGameManager Me.lblLimit.Location = New System.Drawing.Point(376, 157) Me.lblLimit.Name = "lblLimit" Me.lblLimit.Size = New System.Drawing.Size(68, 13) - Me.lblLimit.TabIndex = 17 + Me.lblLimit.TabIndex = 18 Me.lblLimit.Text = "Backup Limit" Me.lblLimit.Visible = False ' @@ -258,7 +260,7 @@ Partial Class frmGameManager Me.nudLimit.Minimum = New Decimal(New Integer() {2, 0, 0, 0}) Me.nudLimit.Name = "nudLimit" Me.nudLimit.Size = New System.Drawing.Size(40, 20) - Me.nudLimit.TabIndex = 16 + Me.nudLimit.TabIndex = 17 Me.nudLimit.Value = New Decimal(New Integer() {2, 0, 0, 0}) Me.nudLimit.Visible = False ' @@ -267,7 +269,7 @@ Partial Class frmGameManager Me.btnExclude.Location = New System.Drawing.Point(10, 152) Me.btnExclude.Name = "btnExclude" Me.btnExclude.Size = New System.Drawing.Size(175, 23) - Me.btnExclude.TabIndex = 12 + Me.btnExclude.TabIndex = 15 Me.btnExclude.Text = "E&xclude Items..." Me.btnExclude.UseVisualStyleBackColor = True ' @@ -276,14 +278,14 @@ Partial Class frmGameManager Me.btnInclude.Location = New System.Drawing.Point(10, 123) Me.btnInclude.Name = "btnInclude" Me.btnInclude.Size = New System.Drawing.Size(175, 23) - Me.btnInclude.TabIndex = 11 + Me.btnInclude.TabIndex = 12 Me.btnInclude.Text = "In&clude Items..." Me.btnInclude.UseVisualStyleBackColor = True ' 'txtID ' Me.txtID.Enabled = False - Me.txtID.Location = New System.Drawing.Point(489, 19) + Me.txtID.Location = New System.Drawing.Point(489, 180) Me.txtID.Name = "txtID" Me.txtID.Size = New System.Drawing.Size(30, 20) Me.txtID.TabIndex = 0 @@ -295,7 +297,7 @@ Partial Class frmGameManager Me.btnSavePathBrowse.Location = New System.Drawing.Point(490, 97) Me.btnSavePathBrowse.Name = "btnSavePathBrowse" Me.btnSavePathBrowse.Size = New System.Drawing.Size(30, 20) - Me.btnSavePathBrowse.TabIndex = 10 + Me.btnSavePathBrowse.TabIndex = 11 Me.btnSavePathBrowse.Text = "..." Me.btnSavePathBrowse.UseVisualStyleBackColor = True ' @@ -304,7 +306,7 @@ Partial Class frmGameManager Me.btnProcessBrowse.Location = New System.Drawing.Point(366, 44) Me.btnProcessBrowse.Name = "btnProcessBrowse" Me.btnProcessBrowse.Size = New System.Drawing.Size(30, 20) - Me.btnProcessBrowse.TabIndex = 4 + Me.btnProcessBrowse.TabIndex = 5 Me.btnProcessBrowse.Text = "..." Me.btnProcessBrowse.UseVisualStyleBackColor = True ' @@ -314,7 +316,7 @@ Partial Class frmGameManager Me.lblSavePath.Location = New System.Drawing.Point(7, 101) Me.lblSavePath.Name = "lblSavePath" Me.lblSavePath.Size = New System.Drawing.Size(60, 13) - Me.lblSavePath.TabIndex = 8 + Me.lblSavePath.TabIndex = 9 Me.lblSavePath.Text = "Save Path:" ' 'lblProcess @@ -323,7 +325,7 @@ Partial Class frmGameManager Me.lblProcess.Location = New System.Drawing.Point(7, 47) Me.lblProcess.Name = "lblProcess" Me.lblProcess.Size = New System.Drawing.Size(48, 13) - Me.lblProcess.TabIndex = 2 + Me.lblProcess.TabIndex = 3 Me.lblProcess.Text = "Process:" ' 'lblName @@ -359,7 +361,7 @@ Partial Class frmGameManager Me.chkTimeStamp.Location = New System.Drawing.Point(191, 156) Me.chkTimeStamp.Name = "chkTimeStamp" Me.chkTimeStamp.Size = New System.Drawing.Size(133, 17) - Me.chkTimeStamp.TabIndex = 15 + Me.chkTimeStamp.TabIndex = 16 Me.chkTimeStamp.Text = "Save multiple backups" Me.chkTimeStamp.UseVisualStyleBackColor = True ' @@ -378,20 +380,20 @@ Partial Class frmGameManager Me.txtSavePath.Location = New System.Drawing.Point(70, 97) Me.txtSavePath.Name = "txtSavePath" Me.txtSavePath.Size = New System.Drawing.Size(414, 20) - Me.txtSavePath.TabIndex = 9 + Me.txtSavePath.TabIndex = 10 ' 'txtProcess ' Me.txtProcess.Location = New System.Drawing.Point(70, 44) Me.txtProcess.Name = "txtProcess" Me.txtProcess.Size = New System.Drawing.Size(290, 20) - Me.txtProcess.TabIndex = 3 + Me.txtProcess.TabIndex = 4 ' 'txtName ' Me.txtName.Location = New System.Drawing.Point(70, 19) Me.txtName.Name = "txtName" - Me.txtName.Size = New System.Drawing.Size(414, 20) + Me.txtName.Size = New System.Drawing.Size(326, 20) Me.txtName.TabIndex = 1 ' 'chkMonitorOnly @@ -873,6 +875,15 @@ Partial Class frmGameManager Me.cmsDeleteAll.Size = New System.Drawing.Size(114, 22) Me.cmsDeleteAll.Text = "&All Files" ' + 'btnGameID + ' + Me.btnGameID.Location = New System.Drawing.Point(402, 17) + Me.btnGameID.Name = "btnGameID" + Me.btnGameID.Size = New System.Drawing.Size(117, 23) + Me.btnGameID.TabIndex = 2 + Me.btnGameID.Text = "&Game ID..." + Me.btnGameID.UseVisualStyleBackColor = True + ' 'frmGameManager ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) @@ -1000,4 +1011,5 @@ Partial Class frmGameManager Friend WithEvents lblComments As Label Friend WithEvents txtComments As TextBox Friend WithEvents chkRegEx As CheckBox + Friend WithEvents btnGameID As Button End Class diff --git a/GBM/Forms/frmGameManager.vb b/GBM/Forms/frmGameManager.vb index 386c7fb..3c15590 100644 --- a/GBM/Forms/frmGameManager.vb +++ b/GBM/Forms/frmGameManager.vb @@ -430,6 +430,28 @@ Public Class frmGameManager IsLoading = False End Sub + Private Sub OpenGameIDEdit() + Dim sCurrentID As String + Dim sNewID As String + + If txtID.Text = String.Empty Then + txtID.Text = Guid.NewGuid.ToString + End If + + sCurrentID = txtID.Text + + sNewID = InputBox(frmGameManager_GameIDEditInfo, frmGameManager_GameIDEditTitle, sCurrentID) + + If sNewID <> String.Empty Then + txtID.Text = sNewID + + If sCurrentID <> sNewID Then + UpdateGenericButtonLabel(frmGameManager_btnGameID, btnGameID, True) + End If + End If + + End Sub + Private Sub OpenBackupFile() Dim sFileName As String Dim oProcessStartInfo As ProcessStartInfo @@ -463,6 +485,16 @@ Public Class frmGameManager End If End Sub + Private Sub UpdateGenericButtonLabel(ByVal sLabel As String, ByVal btn As Button, ByVal bDirty As Boolean) + btn.Text = sLabel + + If bDirty Then + btn.Font = New Font(FontFamily.GenericSansSerif, 8.25, FontStyle.Bold) + Else + btn.Font = New Font(FontFamily.GenericSansSerif, 8.25, FontStyle.Regular) + End If + End Sub + Private Function GetBuilderRoot() As String Dim sRoot As String = String.Empty @@ -750,6 +782,7 @@ Public Class frmGameManager 'Update Buttons UpdateBuilderButtonLabel(oApp.FileType, frmGameManager_IncludeShortcut, btnInclude, False) UpdateBuilderButtonLabel(oApp.ExcludeList, frmGameManager_ExcludeShortcut, btnExclude, False) + UpdateGenericButtonLabel(frmGameManager_btnGameID, btnGameID, False) 'Extra txtAppPath.Text = oApp.ProcessPath @@ -975,6 +1008,9 @@ Public Class frmGameManager btnExclude.Text = frmGameManager_btnExclude btnImport.Enabled = True btnExport.Enabled = True + UpdateGenericButtonLabel(frmGameManager_IncludeShortcut, btnInclude, False) + UpdateGenericButtonLabel(frmGameManager_ExcludeShortcut, btnExclude, False) + UpdateGenericButtonLabel(frmGameManager_btnGameID, btnGameID, False) Case eModes.MultiSelect lstGames.Enabled = True lblQuickFilter.Enabled = False @@ -1163,17 +1199,17 @@ Public Class frmGameManager Select Case eCurrentMode Case eModes.Add - If CoreValidatation(oApp) Then + If CoreValidatation(oApp, True) Then bSuccess = True mgrMonitorList.DoListAdd(oApp) SaveTags(oApp.ID) eCurrentMode = eModes.View End If Case eModes.Edit - If CoreValidatation(oApp) Then + If CoreValidatation(oApp, False) Then bSuccess = True - mgrMonitorList.DoListUpdate(oApp) CheckManifestandUpdate(oCurrentGame, oApp) + mgrMonitorList.DoListUpdate(oApp, CurrentGame.ID) eCurrentMode = eModes.View End If Case eModes.MultiSelect @@ -1250,7 +1286,15 @@ Public Class frmGameManager End If End Sub - Private Function CoreValidatation(ByVal oApp As clsGame) As Boolean + Private Function CoreValidatation(ByVal oApp As clsGame, ByVal bNewGame As Boolean) As Boolean + Dim sCurrentID As String + + If bNewGame Then + sCurrentID = String.Empty + Else + sCurrentID = CurrentGame.ID + End If + If txtName.Text.Trim = String.Empty Then mgrCommon.ShowMessage(frmGameManager_ErrorValidName, MsgBoxStyle.Exclamation) txtName.Focus() @@ -1269,14 +1313,14 @@ Public Class frmGameManager Return False End If - If mgrMonitorList.DoDuplicateListCheck(oApp.Name, oApp.ProcessName, , oApp.ID) Then - mgrCommon.ShowMessage(frmGameManager_ErrorGameDupe, MsgBoxStyle.Exclamation) + If mgrMonitorList.DoDuplicateListCheck(oApp.ID, , sCurrentID) Then + mgrCommon.ShowMessage(frmGameManager_ErrorGameDupe, oApp.ID, MsgBoxStyle.Exclamation) txtName.Focus() Return False End If If oApp.Parameter <> String.Empty Then - If mgrMonitorList.DoDuplicateParameterCheck(oApp.ProcessName, oApp.Parameter, , oApp.ID) Then + If mgrMonitorList.DoDuplicateParameterCheck(oApp.ProcessName, oApp.Parameter, , sCurrentID) Then mgrCommon.ShowMessage(frmGameManager_ErrorProcessParameterDupe, MsgBoxStyle.Exclamation) Return False End If @@ -1537,6 +1581,7 @@ Public Class frmGameManager cmsDeleteAll.Text = frmGameManager_cmsDeleteAll lblComments.Text = frmGameManager_lblComments chkRegEx.Text = frmGameManager_chkRegEx + btnGameID.Text = frmGameManager_btnGameID 'Init Filter Timer tmFilterTimer = New Timer() @@ -1716,6 +1761,10 @@ Public Class frmGameManager ExportGameList() End Sub + Private Sub btnGameID_Click(sender As Object, e As EventArgs) Handles btnGameID.Click + OpenGameIDEdit() + End Sub + Private Sub txtQuickFilter_TextChanged(sender As Object, e As EventArgs) Handles txtQuickFilter.TextChanged If Not tmFilterTimer.Enabled Then tmFilterTimer.Enabled = True diff --git a/GBM/Managers/mgrMonitorList.vb b/GBM/Managers/mgrMonitorList.vb index eb1b16e..100db25 100644 --- a/GBM/Managers/mgrMonitorList.vb +++ b/GBM/Managers/mgrMonitorList.vb @@ -142,18 +142,23 @@ Public Class mgrMonitorList End Sub - Public Shared Sub DoListUpdate(ByVal oGame As clsGame, Optional ByVal iSelectDB As mgrSQLite.Database = mgrSQLite.Database.Local) + Public Shared Sub DoListUpdate(ByVal oGame As clsGame, Optional ByVal sQueryID As String = "", Optional ByVal iSelectDB As mgrSQLite.Database = mgrSQLite.Database.Local) Dim oDatabase As New mgrSQLite(iSelectDB) Dim sSQL As String Dim hshParams As Hashtable - sSQL = "UPDATE monitorlist SET Name=@Name, Process=@Process, Path=@Path, AbsolutePath=@AbsolutePath, FolderSave=@FolderSave, " + sSQL = "UPDATE monitorlist SET MonitorID=@ID, Name=@Name, Process=@Process, Path=@Path, AbsolutePath=@AbsolutePath, FolderSave=@FolderSave, " sSQL &= "FileType=@FileType, TimeStamp=@TimeStamp, ExcludeList=@ExcludeList, ProcessPath=@ProcessPath, Icon=@Icon, " sSQL &= "Hours=@Hours, Version=@Version, Company=@Company, Enabled=@Enabled, MonitorOnly=@MonitorOnly, BackupLimit=@BackupLimit, " - sSQL &= "CleanFolder=@CleanFolder, Parameter=@Parameter, Comments=@Comments, IsRegEx=@IsRegEx WHERE MonitorID=@ID" + sSQL &= "CleanFolder=@CleanFolder, Parameter=@Parameter, Comments=@Comments, IsRegEx=@IsRegEx WHERE MonitorID=@QueryID" 'Parameters hshParams = SetCoreParameters(oGame) + If sQueryID <> String.Empty Then + hshParams.Add("QueryID", sQueryID) + Else + hshParams.Add("QueryID", oGame.ID) + End If oDatabase.RunParamQuery(sSQL, hshParams) @@ -295,7 +300,7 @@ Public Class mgrMonitorList Dim hshParams As New Hashtable Dim iCounter As Integer = 0 - sSQL = "SELECT * from monitorlist " + sSQL = "SELECT * FROM monitorlist " sSQL &= "WHERE MonitorID = @MonitorID" hshParams.Add("MonitorID", sMonitorID) @@ -311,20 +316,19 @@ Public Class mgrMonitorList Return hshGames End Function - Public Shared Function DoDuplicateListCheck(ByVal sName As String, ByVal sProcess As String, Optional ByVal iSelectDB As mgrSQLite.Database = mgrSQLite.Database.Local, Optional ByVal sExcludeID As String = "") As Boolean + Public Shared Function DoDuplicateListCheck(ByVal sMonitorID As String, Optional ByVal iSelectDB As mgrSQLite.Database = mgrSQLite.Database.Local, Optional ByVal sExcludeID As String = "") As Boolean Dim oDatabase As New mgrSQLite(iSelectDB) Dim sSQL As String Dim oData As DataSet Dim hshParams As New Hashtable - sSQL = "SELECT * FROM monitorlist WHERE Name = @Name AND Process= @Process" + sSQL = "SELECT * FROM monitorlist WHERE MonitorID = @MonitorID" - hshParams.Add("Name", sName) - hshParams.Add("Process", sProcess) + hshParams.Add("MonitorID", sMonitorID) If sExcludeID <> String.Empty Then - sSQL &= " AND MonitorID <> @MonitorID" - hshParams.Add("MonitorID", sExcludeID) + sSQL &= " AND MonitorID <> @QueryID" + hshParams.Add("QueryID", sExcludeID) End If oData = oDatabase.ReadParamData(sSQL, hshParams) @@ -478,13 +482,11 @@ Public Class mgrMonitorList sSQL &= "WHERE MonitorID = @MonitorID;" End If sSQL &= "DELETE FROM monitorlist " - sSQL &= "WHERE Name = @Name AND Process= @Process;" + sSQL &= "WHERE MonitorID = @MonitorID;" For Each oGame As clsGame In hshGames.Values hshParams = New Hashtable hshParams.Add("MonitorID", oGame.ID) - hshParams.Add("Name", oGame.Name) - hshParams.Add("Process", oGame.TrueProcess) oParamList.Add(hshParams) Next diff --git a/GBM/My Project/Resources.Designer.vb b/GBM/My Project/Resources.Designer.vb index 891c4dc..7aa4b64 100644 --- a/GBM/My Project/Resources.Designer.vb +++ b/GBM/My Project/Resources.Designer.vb @@ -1500,6 +1500,15 @@ Namespace My.Resources End Get End Property + ''' + ''' Looks up a localized string similar to &Game ID.... + ''' + Friend ReadOnly Property frmGameManager_btnGameID() As String + Get + Return ResourceManager.GetString("frmGameManager_btnGameID", resourceCulture) + End Get + End Property + ''' ''' Looks up a localized string similar to .... ''' @@ -1906,7 +1915,7 @@ Namespace My.Resources End Property ''' - ''' Looks up a localized string similar to A game with this exact name and process already exists.. + ''' Looks up a localized string similar to A game with the same ID ([PARAM]) already exists.. ''' Friend ReadOnly Property frmGameManager_ErrorGameDupe() As String Get @@ -2040,6 +2049,24 @@ Namespace My.Resources End Get End Property + ''' + ''' Looks up a localized string similar to The unique Game ID is generated by GBM. Changing this value is not recommended.. + ''' + Friend ReadOnly Property frmGameManager_GameIDEditInfo() As String + Get + Return ResourceManager.GetString("frmGameManager_GameIDEditInfo", resourceCulture) + End Get + End Property + + ''' + ''' Looks up a localized string similar to Edit Game ID. + ''' + Friend ReadOnly Property frmGameManager_GameIDEditTitle() As String + Get + Return ResourceManager.GetString("frmGameManager_GameIDEditTitle", resourceCulture) + End Get + End Property + ''' ''' Looks up a localized string similar to Configuration. ''' diff --git a/GBM/My Project/Resources.resx b/GBM/My Project/Resources.resx index 4bddb10..cebb1c5 100644 --- a/GBM/My Project/Resources.resx +++ b/GBM/My Project/Resources.resx @@ -554,7 +554,7 @@ [PARAM] is already up to date.[BR][BR]Would you like to restore this backup anyway? - A game with this exact name and process already exists. + A game with the same ID ([PARAM]) already exists. The selected game(s) have no backup data or can't be restored with their current configuration. @@ -2023,4 +2023,13 @@ The process is not a a valid regular expression.[BR][BR]Would you like help validating and testing your regular expression? [BR][BR]This will open your web browser and requires the internet. + + &Game ID... + + + The unique Game ID is generated by GBM. Changing this value is not recommended. + + + Edit Game ID + \ No newline at end of file From 1b6b2fa3a0669889e207680d015afced057bbc2c Mon Sep 17 00:00:00 2001 From: MikeMaximus Date: Fri, 2 Mar 2018 15:56:12 -0600 Subject: [PATCH 06/38] Updates for sync becoming mandatory --- GBM/Forms/frmGameManager.vb | 28 +++++++++++------- GBM/Forms/frmMain.vb | 25 ++++++++--------- GBM/Forms/frmSettings.Designer.vb | 39 +++++++++----------------- GBM/Forms/frmSettings.vb | 26 ++--------------- GBM/Forms/frmStartUpWizard.Designer.vb | 26 +++++------------ GBM/Forms/frmStartUpWizard.vb | 13 ++++----- GBM/Managers/mgrRestore.vb | 11 -------- GBM/Managers/mgrSQLite.vb | 15 ++++++++-- GBM/Managers/mgrSettings.vb | 14 +-------- GBM/My Project/Resources.Designer.vb | 22 ++------------- GBM/My Project/Resources.resx | 10 ++----- 11 files changed, 75 insertions(+), 154 deletions(-) diff --git a/GBM/Forms/frmGameManager.vb b/GBM/Forms/frmGameManager.vb index 3c15590..490d4ca 100644 --- a/GBM/Forms/frmGameManager.vb +++ b/GBM/Forms/frmGameManager.vb @@ -4,6 +4,7 @@ Imports System.IO Public Class frmGameManager + Private oSettings As mgrSettings Private sBackupFolder As String Private bPendingRestores As Boolean = False Private oCurrentBackupItem As clsBackup @@ -39,12 +40,12 @@ Public Class frmGameManager Private eCurrentMode As eModes = eModes.Disabled - Property BackupFolder As String + Property Settings As mgrSettings Get - Return sBackupFolder & Path.DirectorySeparatorChar + Return oSettings End Get - Set(value As String) - sBackupFolder = value + Set(value As mgrSettings) + oSettings = value End Set End Property @@ -75,6 +76,15 @@ Public Class frmGameManager End Set End Property + Private Property BackupFolder As String + Get + Return Settings.BackupFolder & Path.DirectorySeparatorChar + End Get + Set(value As String) + sBackupFolder = value + End Set + End Property + Private Property GameData As OrderedDictionary Get Return oGameData @@ -201,7 +211,6 @@ Public Class frmGameManager oBackupItem.FileName = oBackupItem.FileName.Replace(oOriginalApp.ID, oNewApp.ID) mgrManifest.DoManifestUpdateByManifestID(oBackupItem, mgrSQLite.Database.Local) Next - oLocalBackupData = mgrManifest.ReadLatestManifest(mgrSQLite.Database.Local) End If 'Remote @@ -213,7 +222,6 @@ Public Class frmGameManager oBackupItem.FileName = oBackupItem.FileName.Replace(oOriginalApp.ID, oNewApp.ID) mgrManifest.DoManifestUpdateByManifestID(oBackupItem, mgrSQLite.Database.Remote) Next - oRemoteBackupData = mgrManifest.ReadLatestManifest(mgrSQLite.Database.Remote) End If End If End Sub @@ -657,9 +665,6 @@ Public Class frmGameManager CurrentBackupItem = DirectCast(oRemoteBackupData(oApp.ID), clsBackup) - 'Override Path - CurrentBackupItem.RestorePath = oApp.Path - sFileName = BackupFolder & CurrentBackupItem.FileName btnOpenBackupFile.Enabled = True @@ -673,7 +678,6 @@ Public Class frmGameManager lblBackupFileData.Text = frmGameManager_ErrorNoBackupExists End If - mgrRestore.DoPathOverride(CurrentBackupItem, oApp) lblRestorePathData.Text = CurrentBackupItem.RestorePath Else oComboItems.Add(New KeyValuePair(Of String, String)(String.Empty, frmGameManager_None)) @@ -1226,6 +1230,8 @@ Public Class frmGameManager End Select If bSuccess Then + mgrMonitorList.SyncMonitorLists(Settings.SyncFields) + LoadBackupData() IsDirty = False LoadData() If eCurrentMode = eModes.View Then @@ -1251,6 +1257,7 @@ Public Class frmGameManager If mgrCommon.ShowMessage(frmGameManager_ConfirmGameDelete, oApp.Name, MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then mgrMonitorList.DoListDelete(oApp.ID) + mgrMonitorList.SyncMonitorLists(Settings.SyncFields) LoadData() eCurrentMode = eModes.Disabled ModeChange() @@ -1265,6 +1272,7 @@ Public Class frmGameManager If mgrCommon.ShowMessage(frmGameManager_ConfirmMultiGameDelete, sMonitorIDs.Count, MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then mgrMonitorList.DoListDeleteMulti(sMonitorIDs) + mgrMonitorList.SyncMonitorLists(Settings.SyncFields) LoadData() eCurrentMode = eModes.Disabled ModeChange() diff --git a/GBM/Forms/frmMain.vb b/GBM/Forms/frmMain.vb index 0271255..520cd31 100644 --- a/GBM/Forms/frmMain.vb +++ b/GBM/Forms/frmMain.vb @@ -709,7 +709,7 @@ Public Class frmMain End If mgrMonitorList.DoListUpdate(oProcess.GameInfo) - If oSettings.Sync Then mgrMonitorList.SyncMonitorLists(oSettings.SyncFields) + mgrMonitorList.SyncMonitorLists(oSettings.SyncFields) UpdateTimeSpent(dCurrentHours, oProcess.TimeSpent.TotalHours) End Sub @@ -840,18 +840,17 @@ Public Class frmMain Dim frm As New frmTags PauseScan() frm.ShowDialog() - If oSettings.Sync Then mgrMonitorList.SyncMonitorLists(oSettings.SyncFields) + mgrMonitorList.SyncMonitorLists(oSettings.SyncFields) ResumeScan() End Sub Private Sub OpenGameManager(Optional ByVal bPendingRestores As Boolean = False) Dim frm As New frmGameManager PauseScan() - frm.BackupFolder = oSettings.BackupFolder + frm.Settings = oSettings frm.PendingRestores = bPendingRestores frm.ShowDialog() LoadGameSettings() - If oSettings.Sync Then mgrMonitorList.SyncMonitorLists(oSettings.SyncFields) ResumeScan() 'Handle backup trigger @@ -901,7 +900,7 @@ Public Class frmMain frm.GameData = mgrMonitorList.ReadList(mgrMonitorList.eListTypes.FullList) frm.ShowDialog() LoadGameSettings() - If oSettings.Sync Then mgrMonitorList.SyncMonitorLists(oSettings.SyncFields) + mgrMonitorList.SyncMonitorLists(oSettings.SyncFields) ResumeScan() End Sub @@ -910,7 +909,7 @@ Public Class frmMain PauseScan() frm.ShowDialog() mgrPath.CustomVariablesReload() - If oSettings.Sync Then mgrMonitorList.SyncMonitorLists(oSettings.SyncFields) + mgrMonitorList.SyncMonitorLists(oSettings.SyncFields) ResumeScan() End Sub @@ -975,18 +974,18 @@ Public Class frmMain Private Sub HandleSyncWatcher() Handles tmFileWatcherQueue.Elapsed tmFileWatcherQueue.Stop() StopSyncWatcher() - If oSettings.Sync Then - UpdateLog(frmMain_MasterListChanged, False, ToolTipIcon.Info, True) - SyncGameSettings() - LoadGameSettings() - End If + + UpdateLog(frmMain_MasterListChanged, False, ToolTipIcon.Info, True) + SyncGameSettings() + LoadGameSettings() + CheckForNewBackups() StartSyncWatcher() End Sub Private Sub SyncGameSettings() 'Sync Monitor List - If oSettings.Sync Then mgrMonitorList.SyncMonitorLists(oSettings.SyncFields, False) + mgrMonitorList.SyncMonitorLists(oSettings.SyncFields, False) End Sub Private Sub LocalDatabaseCheck() @@ -1477,7 +1476,7 @@ Public Class frmMain oSettings.BackupFolder = sBackupPath oSettings.SaveSettings() oSettings.LoadSettings() - If oSettings.Sync Then mgrMonitorList.HandleBackupLocationChange(oSettings) + mgrMonitorList.HandleBackupLocationChange(oSettings) End If Return True Else diff --git a/GBM/Forms/frmSettings.Designer.vb b/GBM/Forms/frmSettings.Designer.vb index c00674a..52379b5 100644 --- a/GBM/Forms/frmSettings.Designer.vb +++ b/GBM/Forms/frmSettings.Designer.vb @@ -29,7 +29,6 @@ Partial Class frmSettings Me.chkAutoSaveLog = New System.Windows.Forms.CheckBox() Me.btnOptionalFields = New System.Windows.Forms.Button() Me.chkTimeTracking = New System.Windows.Forms.CheckBox() - Me.chkSync = New System.Windows.Forms.CheckBox() Me.chkShowDetectionTips = New System.Windows.Forms.CheckBox() Me.grpFolderOptions = New System.Windows.Forms.GroupBox() Me.btnBackupFolder = New System.Windows.Forms.Button() @@ -124,7 +123,7 @@ Partial Class frmSettings 'chkAutoSaveLog ' Me.chkAutoSaveLog.AutoSize = True - Me.chkAutoSaveLog.Location = New System.Drawing.Point(12, 251) + Me.chkAutoSaveLog.Location = New System.Drawing.Point(12, 262) Me.chkAutoSaveLog.Name = "chkAutoSaveLog" Me.chkAutoSaveLog.Size = New System.Drawing.Size(231, 17) Me.chkAutoSaveLog.TabIndex = 5 @@ -133,11 +132,11 @@ Partial Class frmSettings ' 'btnOptionalFields ' - Me.btnOptionalFields.Location = New System.Drawing.Point(103, 61) + Me.btnOptionalFields.Location = New System.Drawing.Point(5, 65) Me.btnOptionalFields.Name = "btnOptionalFields" - Me.btnOptionalFields.Size = New System.Drawing.Size(134, 23) + Me.btnOptionalFields.Size = New System.Drawing.Size(216, 23) Me.btnOptionalFields.TabIndex = 3 - Me.btnOptionalFields.Text = "Choose &Optional Fields..." + Me.btnOptionalFields.Text = "Choose &Optional Sync Fields..." Me.btnOptionalFields.UseVisualStyleBackColor = True ' 'chkTimeTracking @@ -150,20 +149,10 @@ Partial Class frmSettings Me.chkTimeTracking.Text = "Enable time tracking" Me.chkTimeTracking.UseVisualStyleBackColor = True ' - 'chkSync - ' - Me.chkSync.AutoSize = True - Me.chkSync.Location = New System.Drawing.Point(6, 65) - Me.chkSync.Name = "chkSync" - Me.chkSync.Size = New System.Drawing.Size(98, 17) - Me.chkSync.TabIndex = 2 - Me.chkSync.Text = "Enable syncing" - Me.chkSync.UseVisualStyleBackColor = True - ' 'chkShowDetectionTips ' Me.chkShowDetectionTips.AutoSize = True - Me.chkShowDetectionTips.Location = New System.Drawing.Point(12, 228) + Me.chkShowDetectionTips.Location = New System.Drawing.Point(12, 239) Me.chkShowDetectionTips.Name = "chkShowDetectionTips" Me.chkShowDetectionTips.Size = New System.Drawing.Size(159, 17) Me.chkShowDetectionTips.TabIndex = 4 @@ -372,9 +361,9 @@ Partial Class frmSettings Me.grpBackupHandling.Controls.Add(Me.chkRestoreNotify) Me.grpBackupHandling.Controls.Add(Me.chkAutoMark) Me.grpBackupHandling.Location = New System.Drawing.Point(6, 88) - Me.grpBackupHandling.Margin = New System.Windows.Forms.Padding(2, 2, 2, 2) + Me.grpBackupHandling.Margin = New System.Windows.Forms.Padding(2) Me.grpBackupHandling.Name = "grpBackupHandling" - Me.grpBackupHandling.Padding = New System.Windows.Forms.Padding(2, 2, 2, 2) + Me.grpBackupHandling.Padding = New System.Windows.Forms.Padding(2) Me.grpBackupHandling.Size = New System.Drawing.Size(354, 87) Me.grpBackupHandling.TabIndex = 1 Me.grpBackupHandling.TabStop = False @@ -384,7 +373,7 @@ Partial Class frmSettings ' Me.chkAutoRestore.AutoSize = True Me.chkAutoRestore.Location = New System.Drawing.Point(8, 41) - Me.chkAutoRestore.Margin = New System.Windows.Forms.Padding(2, 2, 2, 2) + Me.chkAutoRestore.Margin = New System.Windows.Forms.Padding(2) Me.chkAutoRestore.Name = "chkAutoRestore" Me.chkAutoRestore.Size = New System.Drawing.Size(190, 17) Me.chkAutoRestore.TabIndex = 1 @@ -395,7 +384,7 @@ Partial Class frmSettings ' Me.chkRestoreNotify.AutoSize = True Me.chkRestoreNotify.Location = New System.Drawing.Point(8, 19) - Me.chkRestoreNotify.Margin = New System.Windows.Forms.Padding(2, 2, 2, 2) + Me.chkRestoreNotify.Margin = New System.Windows.Forms.Padding(2) Me.chkRestoreNotify.Name = "chkRestoreNotify" Me.chkRestoreNotify.Size = New System.Drawing.Size(216, 17) Me.chkRestoreNotify.TabIndex = 0 @@ -464,7 +453,7 @@ Partial Class frmSettings 'lblMinutes ' Me.lblMinutes.AutoSize = True - Me.lblMinutes.Location = New System.Drawing.Point(232, 205) + Me.lblMinutes.Location = New System.Drawing.Point(232, 216) Me.lblMinutes.Name = "lblMinutes" Me.lblMinutes.Size = New System.Drawing.Size(43, 13) Me.lblMinutes.TabIndex = 17 @@ -472,7 +461,7 @@ Partial Class frmSettings ' 'nudSupressBackupThreshold ' - Me.nudSupressBackupThreshold.Location = New System.Drawing.Point(176, 203) + Me.nudSupressBackupThreshold.Location = New System.Drawing.Point(176, 214) Me.nudSupressBackupThreshold.Maximum = New Decimal(New Integer() {999, 0, 0, 0}) Me.nudSupressBackupThreshold.Name = "nudSupressBackupThreshold" Me.nudSupressBackupThreshold.Size = New System.Drawing.Size(51, 20) @@ -481,7 +470,7 @@ Partial Class frmSettings 'chkSupressBackup ' Me.chkSupressBackup.AutoSize = True - Me.chkSupressBackup.Location = New System.Drawing.Point(12, 204) + Me.chkSupressBackup.Location = New System.Drawing.Point(12, 215) Me.chkSupressBackup.Name = "chkSupressBackup" Me.chkSupressBackup.Size = New System.Drawing.Size(158, 17) Me.chkSupressBackup.TabIndex = 2 @@ -492,11 +481,10 @@ Partial Class frmSettings ' Me.grpGameData.Controls.Add(Me.chkSessionTracking) Me.grpGameData.Controls.Add(Me.chkTimeTracking) - Me.grpGameData.Controls.Add(Me.chkSync) Me.grpGameData.Controls.Add(Me.btnOptionalFields) Me.grpGameData.Location = New System.Drawing.Point(6, 106) Me.grpGameData.Name = "grpGameData" - Me.grpGameData.Size = New System.Drawing.Size(354, 92) + Me.grpGameData.Size = New System.Drawing.Size(354, 97) Me.grpGameData.TabIndex = 1 Me.grpGameData.TabStop = False Me.grpGameData.Text = "Game Data" @@ -572,7 +560,6 @@ Partial Class frmSettings Friend WithEvents chkShowDetectionTips As System.Windows.Forms.CheckBox Friend WithEvents chkStartToTray As System.Windows.Forms.CheckBox Friend WithEvents chkCreateFolder As System.Windows.Forms.CheckBox - Friend WithEvents chkSync As System.Windows.Forms.CheckBox Friend WithEvents chkStartWindows As System.Windows.Forms.CheckBox Friend WithEvents chkTimeTracking As System.Windows.Forms.CheckBox Friend WithEvents grp7zGeneral As GroupBox diff --git a/GBM/Forms/frmSettings.vb b/GBM/Forms/frmSettings.vb index 45b27b5..9519798 100644 --- a/GBM/Forms/frmSettings.vb +++ b/GBM/Forms/frmSettings.vb @@ -68,15 +68,9 @@ Public Class frmSettings oSettings.Custom7zArguments = txt7zArguments.Text.Trim oSettings.Custom7zLocation = txt7zLocation.Text.Trim - 'Turning syncing from off to on is the same as changing the backup folder - If chkSync.Checked = True And oSettings.Sync = False Then - bSyncSettingsChanged = True - End If - oSettings.Sync = chkSync.Checked - If Directory.Exists(txtBackupFolder.Text) Then If oSettings.BackupFolder <> txtBackupFolder.Text Then - If chkSync.Checked Then bSyncSettingsChanged = True + bSyncSettingsChanged = True End If oSettings.BackupFolder = txtBackupFolder.Text Else @@ -96,7 +90,7 @@ Public Class frmSettings End If 'We must trigger a sync if optional fields have changed - If Settings.Sync And (eCurrentSyncFields <> Settings.SyncFields) Then + If eCurrentSyncFields <> Settings.SyncFields Then bSyncSettingsChanged = True End If @@ -181,7 +175,6 @@ Public Class frmSettings chkAutoRestore.Checked = oSettings.AutoRestore chkAutoMark.Checked = oSettings.AutoMark txtBackupFolder.Text = oSettings.BackupFolder - chkSync.Checked = oSettings.Sync chkTimeTracking.Checked = oSettings.TimeTracking chkSessionTracking.Checked = oSettings.SessionTracking chkSupressBackup.Checked = oSettings.SupressBackup @@ -201,8 +194,6 @@ Public Class frmSettings 'Retrieve 7z Info GetUtilityInfo(oSettings.Custom7zLocation) - 'Toggle Sync Button - ToggleSyncButton() End Sub Private Sub LoadCombos() @@ -236,14 +227,6 @@ Public Class frmSettings lstSettings.SelectedIndex = 0 End Sub - Private Sub ToggleSyncButton() - If chkSync.Checked Then - btnOptionalFields.Enabled = True - Else - btnOptionalFields.Enabled = False - End If - End Sub - Private Sub OpenOptionalFields() Dim frm As New frmSyncFields frm.SyncFields = Settings.SyncFields @@ -298,7 +281,6 @@ Public Class frmSettings chkTimeTracking.Text = frmSettings_chkTimeTracking chkSessionTracking.Text = frmSettings_chkSessionTracking chkStartWindows.Text = frmSettings_chkStartWindows - chkSync.Text = frmSettings_chkSync chkShowDetectionTips.Text = frmSettings_chkShowDetectionTips chkAutoSaveLog.Text = frmSettings_chkAutoSaveLog chkStartToTray.Text = frmSettings_chkStartToTray @@ -373,10 +355,6 @@ Public Class frmSettings OpenOptionalFields() End Sub - Private Sub chkSync_CheckedChanged(sender As Object, e As EventArgs) Handles chkSync.CheckedChanged - ToggleSyncButton() - End Sub - Private Sub lstSettings_SelectedValueChanged(sender As Object, e As EventArgs) Handles lstSettings.SelectedValueChanged ChangePanel() End Sub diff --git a/GBM/Forms/frmStartUpWizard.Designer.vb b/GBM/Forms/frmStartUpWizard.Designer.vb index 36628c1..11f7c8c 100644 --- a/GBM/Forms/frmStartUpWizard.Designer.vb +++ b/GBM/Forms/frmStartUpWizard.Designer.vb @@ -30,7 +30,6 @@ Partial Class frmStartUpWizard Me.lblStep1Title = New System.Windows.Forms.Label() Me.lblStep1Instructions = New System.Windows.Forms.Label() Me.tbPage2 = New System.Windows.Forms.TabPage() - Me.chkSync = New System.Windows.Forms.CheckBox() Me.chkCreateFolder = New System.Windows.Forms.CheckBox() Me.lblStep2Title = New System.Windows.Forms.Label() Me.lblStep2Instructions = New System.Windows.Forms.Label() @@ -91,7 +90,7 @@ Partial Class frmStartUpWizard Me.lblStep1Instructions2.Name = "lblStep1Instructions2" Me.lblStep1Instructions2.Size = New System.Drawing.Size(303, 53) Me.lblStep1Instructions2.TabIndex = 2 - Me.lblStep1Instructions2.Text = "If you'd like to learn about advanced features or have any other questions before" & _ + Me.lblStep1Instructions2.Text = "If you'd like to learn about advanced features or have any other questions before" & " you get started, there is a detailed online manual available." ' 'llbManual @@ -126,7 +125,6 @@ Partial Class frmStartUpWizard 'tbPage2 ' Me.tbPage2.BackColor = System.Drawing.SystemColors.Control - Me.tbPage2.Controls.Add(Me.chkSync) Me.tbPage2.Controls.Add(Me.chkCreateFolder) Me.tbPage2.Controls.Add(Me.lblStep2Title) Me.tbPage2.Controls.Add(Me.lblStep2Instructions) @@ -140,16 +138,6 @@ Partial Class frmStartUpWizard Me.tbPage2.TabIndex = 1 Me.tbPage2.Text = "TabPage2" ' - 'chkSync - ' - Me.chkSync.AutoSize = True - Me.chkSync.Location = New System.Drawing.Point(17, 105) - Me.chkSync.Name = "chkSync" - Me.chkSync.Size = New System.Drawing.Size(261, 17) - Me.chkSync.TabIndex = 5 - Me.chkSync.Text = "Import any existing GBM data in the backup folder" - Me.chkSync.UseVisualStyleBackColor = True - ' 'chkCreateFolder ' Me.chkCreateFolder.AutoSize = True @@ -172,12 +160,13 @@ Partial Class frmStartUpWizard ' 'lblStep2Instructions ' - Me.lblStep2Instructions.Location = New System.Drawing.Point(14, 151) + Me.lblStep2Instructions.Location = New System.Drawing.Point(14, 103) Me.lblStep2Instructions.Name = "lblStep2Instructions" - Me.lblStep2Instructions.Size = New System.Drawing.Size(335, 31) + Me.lblStep2Instructions.Size = New System.Drawing.Size(335, 50) Me.lblStep2Instructions.TabIndex = 6 - Me.lblStep2Instructions.Text = "GBM will store all your backup files along with a manifest database (gbm.s3db) in" & _ - " this location. " + Me.lblStep2Instructions.Text = "GBM will store all your backup files along with a manifest database (gbm.s3db) in" & + " this location. Any existing GBM data in this folder will be automatically impo" & + "rted." ' 'btnFolderBrowse ' @@ -283,7 +272,7 @@ Partial Class frmStartUpWizard Me.lblStep4Instructions3.Name = "lblStep4Instructions3" Me.lblStep4Instructions3.Size = New System.Drawing.Size(303, 33) Me.lblStep4Instructions3.TabIndex = 18 - Me.lblStep4Instructions3.Text = "You can change anything you've setup in this wizard and find more settings and fe" & _ + Me.lblStep4Instructions3.Text = "You can change anything you've setup in this wizard and find more settings and fe" & "atures by exploring the menus. Thanks!" ' 'lblStep4Instructions2 @@ -381,7 +370,6 @@ Partial Class frmStartUpWizard Friend WithEvents btnOpenMonitorList As System.Windows.Forms.Button Friend WithEvents lblStep4Instructions3 As System.Windows.Forms.Label Friend WithEvents lblStep4Instructions2 As System.Windows.Forms.Label - Friend WithEvents chkSync As System.Windows.Forms.CheckBox Friend WithEvents lblStep1Instructions2 As System.Windows.Forms.Label Friend WithEvents llbManual As System.Windows.Forms.LinkLabel End Class diff --git a/GBM/Forms/frmStartUpWizard.vb b/GBM/Forms/frmStartUpWizard.vb index 30b875c..8b31c19 100644 --- a/GBM/Forms/frmStartUpWizard.vb +++ b/GBM/Forms/frmStartUpWizard.vb @@ -38,7 +38,6 @@ Public Class frmStartUpWizard llbManual.Text = frmStartUpWizard_llbManual lblStep1Title.Text = frmStartUpWizard_lblStep1Title lblStep1Instructions.Text = frmStartUpWizard_lblStep1Instructions - chkSync.Text = frmStartUpWizard_chkSync chkCreateFolder.Text = frmStartUpWizard_chkCreateFolder lblStep2Title.Text = frmStartUpWizard_lblStep2Title lblStep2Instructions.Text = frmStartUpWizard_lblStep2Instructions @@ -80,7 +79,6 @@ Public Class frmStartUpWizard Case eSteps.Step2 txtBackupPath.Text = oSettings.BackupFolder chkCreateFolder.Checked = oSettings.CreateSubFolder - chkSync.Checked = oSettings.Sync btnBack.Enabled = True btnNext.Enabled = True tabWizard.SelectTab(1) @@ -109,7 +107,7 @@ Public Class frmStartUpWizard If mgrCommon.ShowMessage(frmStartUpWizard_ConfirmOfficialImport, MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then If mgrMonitorList.DoImport(sImportURL) Then oGameData = mgrMonitorList.ReadList(mgrMonitorList.eListTypes.FullList) - If oSettings.Sync Then mgrMonitorList.SyncMonitorLists(oSettings.SyncFields) + mgrMonitorList.SyncMonitorLists(oSettings.SyncFields) End If End If End Sub @@ -124,16 +122,16 @@ Public Class frmStartUpWizard frm.GameData = oGameData frm.ShowDialog() LoadGameSettings() - If oSettings.Sync Then mgrMonitorList.SyncMonitorLists(oSettings.SyncFields) + mgrMonitorList.SyncMonitorLists(oSettings.SyncFields) End Sub Private Sub OpenMonitorList() Dim frm As New frmGameManager - frm.BackupFolder = oSettings.BackupFolder + frm.Settings = oSettings frm.DisableExternalFunctions = True frm.ShowDialog() LoadGameSettings() - If oSettings.Sync Then mgrMonitorList.SyncMonitorLists(oSettings.SyncFields) + mgrMonitorList.SyncMonitorLists(oSettings.SyncFields) End Sub Private Function ValidateBackupPath(ByVal strPath As String, ByRef sErrorMessage As String) As Boolean @@ -183,10 +181,9 @@ Public Class frmStartUpWizard If ValidateBackupPath(txtBackupPath.Text, sErrorMessage) Then oSettings.BackupFolder = txtBackupPath.Text oSettings.CreateSubFolder = chkCreateFolder.Checked - oSettings.Sync = chkSync.Checked oSettings.SaveSettings() oSettings.LoadSettings() - If oSettings.Sync Then CheckSync() + CheckSync() eCurrentStep = eSteps.Step3 Else bError = True diff --git a/GBM/Managers/mgrRestore.vb b/GBM/Managers/mgrRestore.vb index a863415..1484ef5 100644 --- a/GBM/Managers/mgrRestore.vb +++ b/GBM/Managers/mgrRestore.vb @@ -28,17 +28,6 @@ Public Class mgrRestore Public Event UpdateRestoreInfo(oRestoreInfo As clsBackup) Public Event SetLastAction(sMessage As String) - 'This should only be needed by the Game Manager after v1.1.0 - Public Shared Sub DoPathOverride(ByRef oCheckBackup As clsBackup, ByVal oCheckGame As clsGame) - If Path.IsPathRooted(oCheckGame.Path) Then - oCheckBackup.AbsolutePath = True - Else - oCheckBackup.AbsolutePath = False - End If - - oCheckBackup.RestorePath = oCheckGame.Path - End Sub - Public Shared Function CheckPath(ByRef oRestoreInfo As clsBackup, ByVal oGame As clsGame, ByRef bTriggerReload As Boolean) As Boolean Dim sProcess As String Dim sRestorePath As String diff --git a/GBM/Managers/mgrSQLite.vb b/GBM/Managers/mgrSQLite.vb index 1e3651d..35fc390 100644 --- a/GBM/Managers/mgrSQLite.vb +++ b/GBM/Managers/mgrSQLite.vb @@ -72,7 +72,7 @@ Public Class mgrSQLite 'Add Tables (Settings) sSql = "CREATE TABLE settings (SettingsID INTEGER NOT NULL PRIMARY KEY, MonitorOnStartup BOOLEAN NOT NULL, StartToTray BOOLEAN NOT NULL, ShowDetectionToolTips BOOLEAN NOT NULL, " & "DisableConfirmation BOOLEAN NOT NULL, CreateSubFolder BOOLEAN NOT NULL, ShowOverwriteWarning BOOLEAN NOT NULL, RestoreOnLaunch BOOLEAN NOT NULL, " & - "BackupFolder TEXT NOT NULL, Sync BOOLEAN NOT NULL, StartWithWindows BOOLEAN NOT NULL, TimeTracking BOOLEAN NOT NULL, " & + "BackupFolder TEXT NOT NULL, StartWithWindows BOOLEAN NOT NULL, TimeTracking BOOLEAN NOT NULL, " & "SupressBackup BOOLEAN NOT NULL, SupressBackupThreshold INTEGER NOT NULL, CompressionLevel INTEGER NOT NULL, Custom7zArguments TEXT, " & "Custom7zLocation TEXT, SyncFields INTEGER NOT NULL, AutoSaveLog BOOLEAN NOT NULL, AutoRestore BOOLEAN NOT NULL, AutoMark BOOLEAN NOT NULL, SessionTracking BOOLEAN NOT NULL);" @@ -767,7 +767,18 @@ Public Class mgrSQLite BackupDB("v108") 'Overhaul Tables - sSQL = "CREATE TABLE monitorlist_new (MonitorID TEXT NOT NULL PRIMARY KEY, Name TEXT NOT NULL, Process TEXT NOT NULL, Path TEXT, " & + sSQL = "CREATE TABLE settings_new (SettingsID INTEGER NOT NULL PRIMARY KEY, MonitorOnStartup BOOLEAN NOT NULL, StartToTray BOOLEAN NOT NULL, ShowDetectionToolTips BOOLEAN NOT NULL, " & + "DisableConfirmation BOOLEAN NOT NULL, CreateSubFolder BOOLEAN NOT NULL, ShowOverwriteWarning BOOLEAN NOT NULL, RestoreOnLaunch BOOLEAN NOT NULL, " & + "BackupFolder TEXT NOT NULL, StartWithWindows BOOLEAN NOT NULL, TimeTracking BOOLEAN NOT NULL, " & + "SupressBackup BOOLEAN NOT NULL, SupressBackupThreshold INTEGER NOT NULL, CompressionLevel INTEGER NOT NULL, Custom7zArguments TEXT, " & + "Custom7zLocation TEXT, SyncFields INTEGER NOT NULL, AutoSaveLog BOOLEAN NOT NULL, AutoRestore BOOLEAN NOT NULL, AutoMark BOOLEAN NOT NULL, SessionTracking BOOLEAN NOT NULL);" + sSQL &= "INSERT INTO settings_new(SettingsID, MonitorOnStartup, StartToTray, ShowDetectionToolTips, DisableConfirmation, CreateSubFolder, ShowOverwriteWarning, RestoreOnLaunch, " & + "BackupFolder, StartWithWindows, TimeTracking, SupressBackup, SupressBackupThreshold, CompressionLevel, Custom7zArguments, Custom7zLocation, SyncFields, AutoSaveLog, " & + "AutoRestore, AutoMark, SessionTracking) SELECT SettingsID, MonitorOnStartup, StartToTray, ShowDetectionToolTips, DisableConfirmation, CreateSubFolder, ShowOverwriteWarning, RestoreOnLaunch, " & + "BackupFolder, StartWithWindows, TimeTracking, SupressBackup, SupressBackupThreshold, CompressionLevel, Custom7zArguments, Custom7zLocation, SyncFields, AutoSaveLog, " & + "AutoRestore, AutoMark, SessionTracking FROM settings;" & + "DROP TABLE settings; ALTER TABLE settings_new RENAME TO settings;" + sSQL &= "CREATE TABLE monitorlist_new (MonitorID TEXT NOT NULL PRIMARY KEY, Name TEXT NOT NULL, Process TEXT NOT NULL, Path TEXT, " & "AbsolutePath BOOLEAN NOT NULL, FolderSave BOOLEAN NOT NULL, FileType TEXT, TimeStamp BOOLEAN NOT NULL, ExcludeList TEXT NOT NULL, " & "ProcessPath TEXT, Icon TEXT, Hours REAL, Version TEXT, Company TEXT, Enabled BOOLEAN NOT NULL, MonitorOnly BOOLEAN NOT NULL, " & "BackupLimit INTEGER NOT NULL, CleanFolder BOOLEAN NOT NULL, Parameter TEXT, Comments TEXT, IsRegEx BOOLEAN NOT NULL);" diff --git a/GBM/Managers/mgrSettings.vb b/GBM/Managers/mgrSettings.vb index 2d79a46..3ce05b8 100644 --- a/GBM/Managers/mgrSettings.vb +++ b/GBM/Managers/mgrSettings.vb @@ -11,7 +11,6 @@ Public Class mgrSettings Private bRestoreOnLaunch As Boolean = False Private bAutoRestore As Boolean = False Private bAutoMark As Boolean = False - Private bSync As Boolean = True Private bTimeTracking As Boolean = True Private bSessionTracking As Boolean = False Private bSupressBackup As Boolean = False @@ -113,15 +112,6 @@ Public Class mgrSettings End Set End Property - Property Sync As Boolean - Get - Return bSync - End Get - Set(value As Boolean) - bSync = value - End Set - End Property - Property TimeTracking As Boolean Get Return bTimeTracking @@ -269,7 +259,7 @@ Public Class mgrSettings oDatabase.RunParamQuery(sSQL, New Hashtable) sSQL = "INSERT INTO settings VALUES (1, @MonitorOnStartup, @StartToTray, @ShowDetectionToolTips, @DisableConfirmation, " - sSQL &= "@CreateSubFolder, @ShowOverwriteWarning, @RestoreOnLaunch, @BackupFolder, @Sync, @StartWithWindows, " + sSQL &= "@CreateSubFolder, @ShowOverwriteWarning, @RestoreOnLaunch, @BackupFolder, @StartWithWindows, " sSQL &= "@TimeTracking, @SupressBackup, @SupressBackupThreshold, @CompressionLevel, @Custom7zArguments, @Custom7zLocation, " sSQL &= "@SyncFields, @AutoSaveLog, @AutoRestore, @AutoMark, @SessionTracking)" @@ -281,7 +271,6 @@ Public Class mgrSettings hshParams.Add("ShowOverwriteWarning", ShowOverwriteWarning) hshParams.Add("RestoreOnLaunch", RestoreOnLaunch) hshParams.Add("BackupFolder", BackupFolder) - hshParams.Add("Sync", Sync) hshParams.Add("StartWithWindows", StartWithWindows) hshParams.Add("TimeTracking", TimeTracking) hshParams.Add("SupressBackup", SupressBackup) @@ -316,7 +305,6 @@ Public Class mgrSettings ShowOverwriteWarning = CBool(dr("ShowOverwriteWarning")) RestoreOnLaunch = CBool(dr("RestoreOnLaunch")) BackupFolder = CStr(dr("BackupFolder")) - Sync = CBool(dr("Sync")) StartWithWindows = CBool(dr("StartWithWindows")) TimeTracking = CBool(dr("TimeTracking")) SupressBackup = CBool(dr("SupressBackup")) diff --git a/GBM/My Project/Resources.Designer.vb b/GBM/My Project/Resources.Designer.vb index 7aa4b64..0e1b0ab 100644 --- a/GBM/My Project/Resources.Designer.vb +++ b/GBM/My Project/Resources.Designer.vb @@ -4012,7 +4012,7 @@ Namespace My.Resources End Property ''' - ''' Looks up a localized string similar to Choose &Optional Fields.... + ''' Looks up a localized string similar to Choose &Optional Sync Fields.... ''' Friend ReadOnly Property frmSettings_btnOptionalFields() As String Get @@ -4200,15 +4200,6 @@ Namespace My.Resources End Get End Property - ''' - ''' Looks up a localized string similar to Enable syncing. - ''' - Friend ReadOnly Property frmSettings_chkSync() As String - Get - Return ResourceManager.GetString("frmSettings_chkSync", resourceCulture) - End Get - End Property - ''' ''' Looks up a localized string similar to Enable time tracking. ''' @@ -4497,15 +4488,6 @@ Namespace My.Resources End Get End Property - ''' - ''' Looks up a localized string similar to Import any existing GBM data in the backup folder. - ''' - Friend ReadOnly Property frmStartUpWizard_chkSync() As String - Get - Return ResourceManager.GetString("frmStartUpWizard_chkSync", resourceCulture) - End Get - End Property - ''' ''' Looks up a localized string similar to Would you like to choose games to import from the official list?[BR][BR]This requires an active internet connection.. ''' @@ -4588,7 +4570,7 @@ Namespace My.Resources End Property ''' - ''' Looks up a localized string similar to GBM will store all your backup files along with a manifest database (gbm.s3db) in this location. . + ''' Looks up a localized string similar to GBM will store all your backup files along with a manifest database (gbm.s3db) in this location. Any existing GBM data in this folder will be automatically imported.. ''' Friend ReadOnly Property frmStartUpWizard_lblStep2Instructions() As String Get diff --git a/GBM/My Project/Resources.resx b/GBM/My Project/Resources.resx index cebb1c5..44e2fa4 100644 --- a/GBM/My Project/Resources.resx +++ b/GBM/My Project/Resources.resx @@ -1084,9 +1084,6 @@ Ignore sessions shorter than - - Enable syncing - Enable time tracking @@ -1135,9 +1132,6 @@ Create a sub-folder for each game - - Import any existing GBM data in the backup folder - Would you like to choose games to import from the official list?[BR][BR]This requires an active internet connection. @@ -1166,7 +1160,7 @@ Welcome to GBM - GBM will store all your backup files along with a manifest database (gbm.s3db) in this location. + GBM will store all your backup files along with a manifest database (gbm.s3db) in this location. Any existing GBM data in this folder will be automatically imported. Choose where GBM saves your backup files: @@ -1610,7 +1604,7 @@ A backup cannot be run on the selected game(s) with their current configuration. - Choose &Optional Fields... + Choose &Optional Sync Fields... &Cancel From c94b8b83daae076d07ee6bfda892e92e08e3dfda Mon Sep 17 00:00:00 2001 From: MikeMaximus Date: Fri, 2 Mar 2018 19:23:07 -0600 Subject: [PATCH 07/38] Fixed database upgrade for users with sync diabled --- GBM/Managers/mgrSQLite.vb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/GBM/Managers/mgrSQLite.vb b/GBM/Managers/mgrSQLite.vb index 35fc390..6ca19cf 100644 --- a/GBM/Managers/mgrSQLite.vb +++ b/GBM/Managers/mgrSQLite.vb @@ -801,6 +801,11 @@ Public Class mgrSQLite 'Backup DB before starting BackupDB("v108") + 'The remote manifest now requires a synced monitorlist to function. We need to force a sync for users that had it disabled, otherwise their manifest will be lost. + Dim oSettings As New mgrSettings + oSettings.LoadSettings() + mgrMonitorList.SyncMonitorLists(oSettings.SyncFields) + 'Overhaul Tables sSQL = "CREATE TABLE monitorlist_new (MonitorID TEXT NOT NULL PRIMARY KEY, Name TEXT NOT NULL, Process TEXT NOT NULL, Path TEXT, " & "AbsolutePath BOOLEAN NOT NULL, FolderSave BOOLEAN NOT NULL, FileType TEXT, TimeStamp BOOLEAN NOT NULL, ExcludeList TEXT NOT NULL, " & From 07b46f10f55866f12d989c30b59ba0c2cb7441bf Mon Sep 17 00:00:00 2001 From: MikeMaximus Date: Fri, 2 Mar 2018 21:09:47 -0600 Subject: [PATCH 08/38] Removed "Clean Local Manifest" tool --- GBM/Forms/frmMain.Designer.vb | 48 ++++++++++------------------ GBM/Forms/frmMain.vb | 29 ----------------- GBM/Managers/mgrMonitorList.vb | 4 ++- GBM/Managers/mgrRestore.vb | 18 ----------- GBM/My Project/Resources.Designer.vb | 9 ------ GBM/My Project/Resources.resx | 3 -- 6 files changed, 19 insertions(+), 92 deletions(-) diff --git a/GBM/Forms/frmMain.Designer.vb b/GBM/Forms/frmMain.Designer.vb index 4ecf822..5bc1b43 100644 --- a/GBM/Forms/frmMain.Designer.vb +++ b/GBM/Forms/frmMain.Designer.vb @@ -37,11 +37,11 @@ Partial Class frmMain Me.gMonTraySetupCustomVariables = New System.Windows.Forms.ToolStripMenuItem() Me.gMonTraySetupTags = New System.Windows.Forms.ToolStripMenuItem() Me.gMonTrayTools = New System.Windows.Forms.ToolStripMenuItem() - Me.gMonTrayToolsCleanMan = New System.Windows.Forms.ToolStripMenuItem() Me.gMonTrayToolsCompact = New System.Windows.Forms.ToolStripMenuItem() Me.gMonTrayToolsLog = New System.Windows.Forms.ToolStripMenuItem() Me.gMonTrayLogClear = New System.Windows.Forms.ToolStripMenuItem() Me.gMonTrayLogSave = New System.Windows.Forms.ToolStripMenuItem() + Me.gMonTrayToolsSessions = New System.Windows.Forms.ToolStripMenuItem() Me.gMonTraySep1 = New System.Windows.Forms.ToolStripSeparator() Me.gMonTrayExit = New System.Windows.Forms.ToolStripMenuItem() Me.bwMonitor = New System.ComponentModel.BackgroundWorker() @@ -63,7 +63,6 @@ Partial Class frmMain Me.gMonSetupCustomVariables = New System.Windows.Forms.ToolStripMenuItem() Me.gMonSetupTags = New System.Windows.Forms.ToolStripMenuItem() Me.gMonTools = New System.Windows.Forms.ToolStripMenuItem() - Me.gMonToolsCleanMan = New System.Windows.Forms.ToolStripMenuItem() Me.gMonToolsCompact = New System.Windows.Forms.ToolStripMenuItem() Me.gMonToolsLog = New System.Windows.Forms.ToolStripMenuItem() Me.gMonLogClear = New System.Windows.Forms.ToolStripMenuItem() @@ -85,7 +84,6 @@ Partial Class frmMain Me.lblStatus2 = New System.Windows.Forms.Label() Me.lblStatus3 = New System.Windows.Forms.Label() Me.pbTime = New System.Windows.Forms.PictureBox() - Me.gMonTrayToolsSessions = New System.Windows.Forms.ToolStripMenuItem() Me.gMonTrayMenu.SuspendLayout() Me.gMonStatusStrip.SuspendLayout() Me.gMonMainMenu.SuspendLayout() @@ -170,42 +168,42 @@ Partial Class frmMain ' 'gMonTrayTools ' - Me.gMonTrayTools.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.gMonTrayToolsCleanMan, Me.gMonTrayToolsCompact, Me.gMonTrayToolsLog, Me.gMonTrayToolsSessions}) + Me.gMonTrayTools.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.gMonTrayToolsCompact, Me.gMonTrayToolsLog, Me.gMonTrayToolsSessions}) Me.gMonTrayTools.Name = "gMonTrayTools" Me.gMonTrayTools.Size = New System.Drawing.Size(161, 22) Me.gMonTrayTools.Text = "&Tools" ' - 'gMonTrayToolsCleanMan - ' - Me.gMonTrayToolsCleanMan.Name = "gMonTrayToolsCleanMan" - Me.gMonTrayToolsCleanMan.Size = New System.Drawing.Size(184, 22) - Me.gMonTrayToolsCleanMan.Text = "Clean Local Ma&nifest" - ' 'gMonTrayToolsCompact ' Me.gMonTrayToolsCompact.Name = "gMonTrayToolsCompact" - Me.gMonTrayToolsCompact.Size = New System.Drawing.Size(184, 22) + Me.gMonTrayToolsCompact.Size = New System.Drawing.Size(179, 22) Me.gMonTrayToolsCompact.Text = "&Compact Databases" ' 'gMonTrayToolsLog ' Me.gMonTrayToolsLog.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.gMonTrayLogClear, Me.gMonTrayLogSave}) Me.gMonTrayToolsLog.Name = "gMonTrayToolsLog" - Me.gMonTrayToolsLog.Size = New System.Drawing.Size(184, 22) + Me.gMonTrayToolsLog.Size = New System.Drawing.Size(179, 22) Me.gMonTrayToolsLog.Text = "&Log" ' 'gMonTrayLogClear ' Me.gMonTrayLogClear.Name = "gMonTrayLogClear" - Me.gMonTrayLogClear.Size = New System.Drawing.Size(152, 22) + Me.gMonTrayLogClear.Size = New System.Drawing.Size(101, 22) Me.gMonTrayLogClear.Text = "&Clear" ' 'gMonTrayLogSave ' Me.gMonTrayLogSave.Name = "gMonTrayLogSave" - Me.gMonTrayLogSave.Size = New System.Drawing.Size(152, 22) + Me.gMonTrayLogSave.Size = New System.Drawing.Size(101, 22) Me.gMonTrayLogSave.Text = "&Save" ' + 'gMonTrayToolsSessions + ' + Me.gMonTrayToolsSessions.Name = "gMonTrayToolsSessions" + Me.gMonTrayToolsSessions.Size = New System.Drawing.Size(179, 22) + Me.gMonTrayToolsSessions.Text = "&Session Viewer..." + ' 'gMonTraySep1 ' Me.gMonTraySep1.Name = "gMonTraySep1" @@ -350,28 +348,22 @@ Partial Class frmMain ' 'gMonTools ' - Me.gMonTools.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.gMonToolsCleanMan, Me.gMonToolsCompact, Me.gMonToolsLog, Me.gMonToolsSessions}) + Me.gMonTools.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.gMonToolsCompact, Me.gMonToolsLog, Me.gMonToolsSessions}) Me.gMonTools.Name = "gMonTools" Me.gMonTools.Size = New System.Drawing.Size(47, 20) Me.gMonTools.Text = "&Tools" ' - 'gMonToolsCleanMan - ' - Me.gMonToolsCleanMan.Name = "gMonToolsCleanMan" - Me.gMonToolsCleanMan.Size = New System.Drawing.Size(184, 22) - Me.gMonToolsCleanMan.Text = "Clean Local Ma&nifest" - ' 'gMonToolsCompact ' Me.gMonToolsCompact.Name = "gMonToolsCompact" - Me.gMonToolsCompact.Size = New System.Drawing.Size(184, 22) + Me.gMonToolsCompact.Size = New System.Drawing.Size(179, 22) Me.gMonToolsCompact.Text = "&Compact Databases" ' 'gMonToolsLog ' Me.gMonToolsLog.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.gMonLogClear, Me.gMonLogSave}) Me.gMonToolsLog.Name = "gMonToolsLog" - Me.gMonToolsLog.Size = New System.Drawing.Size(184, 22) + Me.gMonToolsLog.Size = New System.Drawing.Size(179, 22) Me.gMonToolsLog.Text = "&Log" ' 'gMonLogClear @@ -389,7 +381,7 @@ Partial Class frmMain 'gMonToolsSessions ' Me.gMonToolsSessions.Name = "gMonToolsSessions" - Me.gMonToolsSessions.Size = New System.Drawing.Size(184, 22) + Me.gMonToolsSessions.Size = New System.Drawing.Size(179, 22) Me.gMonToolsSessions.Text = "&Session Viewer..." ' 'gMonHelp @@ -532,12 +524,6 @@ Partial Class frmMain Me.pbTime.TabIndex = 18 Me.pbTime.TabStop = False ' - 'gMonTrayToolsSessions - ' - Me.gMonTrayToolsSessions.Name = "gMonTrayToolsSessions" - Me.gMonTrayToolsSessions.Size = New System.Drawing.Size(184, 22) - Me.gMonTrayToolsSessions.Text = "&Session Viewer..." - ' 'frmMain ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) @@ -625,8 +611,6 @@ Partial Class frmMain Friend WithEvents gMonTrayNotification As System.Windows.Forms.ToolStripMenuItem Friend WithEvents gMonHelpWebSite As System.Windows.Forms.ToolStripMenuItem Friend WithEvents pbTime As System.Windows.Forms.PictureBox - Friend WithEvents gMonTrayToolsCleanMan As System.Windows.Forms.ToolStripMenuItem - Friend WithEvents gMonToolsCleanMan As System.Windows.Forms.ToolStripMenuItem Friend WithEvents gMonToolsLog As ToolStripMenuItem Friend WithEvents gMonLogClear As ToolStripMenuItem Friend WithEvents gMonLogSave As ToolStripMenuItem diff --git a/GBM/Forms/frmMain.vb b/GBM/Forms/frmMain.vb index 520cd31..59b1a89 100644 --- a/GBM/Forms/frmMain.vb +++ b/GBM/Forms/frmMain.vb @@ -1346,7 +1346,6 @@ Public Class frmMain gMonSetupCustomVariables.Text = frmMain_gMonSetupCustomVariables gMonSetupTags.Text = frmMain_gMonSetupTags gMonTools.Text = frmMain_gMonTools - gMonToolsCleanMan.Text = frmMain_gMonToolsCleanMan gMonToolsCompact.Text = frmMain_gMonToolsCompact gMonToolsLog.Text = frmMain_gMonToolsLog gMonToolsSessions.Text = frmMain_gMonToolsSessions @@ -1368,7 +1367,6 @@ Public Class frmMain gMonTraySetupCustomVariables.Text = frmMain_gMonSetupCustomVariables gMonTraySetupTags.Text = frmMain_gMonSetupTags gMonTrayTools.Text = frmMain_gMonTools - gMonTrayToolsCleanMan.Text = frmMain_gMonToolsCleanMan gMonTrayToolsCompact.Text = frmMain_gMonToolsCompact gMonTrayToolsLog.Text = frmMain_gMonToolsLog gMonTrayToolsSessions.Text = frmMain_gMonToolsSessions @@ -1575,29 +1573,6 @@ Public Class frmMain End If End Sub - Private Sub CleanLocalManifest() - Dim slItems As SortedList - - PauseScan() - - If mgrCommon.ShowMessage(frmMain_ConfirmManifestClean, MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then - - slItems = mgrRestore.SyncLocalManifest() - - If slItems.Count > 0 Then - For Each oItem As clsBackup In slItems.Values - UpdateLog(mgrCommon.FormatString(frmMain_ManifestRemovedEntry, oItem.Name), False) - Next - mgrCommon.ShowMessage(frmMain_ManifestTotalRemoved, slItems.Count, MsgBoxStyle.Information) - Else - mgrCommon.ShowMessage(frmMain_ManifestAreadyClean, MsgBoxStyle.Information) - End If - End If - - ResumeScan() - - End Sub - Private Sub CompactDatabases() Dim oLocalDatabase As mgrSQLite Dim oRemoteDatabase As mgrSQLite @@ -1651,10 +1626,6 @@ Public Class frmMain OpenGameManager() End Sub - Private Sub gMonToolsSync_Click(sender As Object, e As EventArgs) Handles gMonTrayToolsCleanMan.Click, gMonToolsCleanMan.Click - CleanLocalManifest() - End Sub - Private Sub gMonToolsCompact_Click(sender As Object, e As EventArgs) Handles gMonToolsCompact.Click, gMonTrayToolsCompact.Click CompactDatabases() End Sub diff --git a/GBM/Managers/mgrMonitorList.vb b/GBM/Managers/mgrMonitorList.vb index 100db25..e1ad955 100644 --- a/GBM/Managers/mgrMonitorList.vb +++ b/GBM/Managers/mgrMonitorList.vb @@ -475,7 +475,9 @@ Public Class mgrMonitorList Dim hshParams As Hashtable Dim oParamList As New List(Of Hashtable) - sSQL = "DELETE FROM gametags " + sSQL = "DELETE FROM manifest " + sSQL &= "WHERE MonitorID = @MonitorID;" + sSQL &= "DELETE FROM gametags " sSQL &= "WHERE MonitorID = @MonitorID;" If iSelectDB = mgrSQLite.Database.Local Then sSQL &= "DELETE FROM sessions " diff --git a/GBM/Managers/mgrRestore.vb b/GBM/Managers/mgrRestore.vb index 1484ef5..91dd280 100644 --- a/GBM/Managers/mgrRestore.vb +++ b/GBM/Managers/mgrRestore.vb @@ -119,24 +119,6 @@ Public Class mgrRestore Return slRestoreItems End Function - Public Shared Function SyncLocalManifest() As SortedList - Dim slLocalManifest As SortedList - Dim slRemoteManifest As SortedList - Dim slRemovedItems As New SortedList - - slLocalManifest = mgrManifest.ReadLatestManifest(mgrSQLite.Database.Local) - slRemoteManifest = mgrManifest.ReadLatestManifest(mgrSQLite.Database.Remote) - - For Each oItem As clsBackup In slLocalManifest.Values - If Not slRemoteManifest.Contains(oItem.MonitorID) Then - slRemovedItems.Add(oItem.MonitorID, oItem) - mgrManifest.DoManifestDeleteByMonitorID(oItem, mgrSQLite.Database.Local) - End If - Next - - Return slRemovedItems - End Function - Public Function CheckRestorePrereq(ByVal oBackupInfo As clsBackup, ByVal bCleanFolder As Boolean) As Boolean Dim sHash As String Dim sExtractPath As String diff --git a/GBM/My Project/Resources.Designer.vb b/GBM/My Project/Resources.Designer.vb index 0e1b0ab..07e0e5b 100644 --- a/GBM/My Project/Resources.Designer.vb +++ b/GBM/My Project/Resources.Designer.vb @@ -3291,15 +3291,6 @@ Namespace My.Resources End Get End Property - ''' - ''' Looks up a localized string similar to Clea&n Local Manifest. - ''' - Friend ReadOnly Property frmMain_gMonToolsCleanMan() As String - Get - Return ResourceManager.GetString("frmMain_gMonToolsCleanMan", resourceCulture) - End Get - End Property - ''' ''' Looks up a localized string similar to &Compact Databases. ''' diff --git a/GBM/My Project/Resources.resx b/GBM/My Project/Resources.resx index 44e2fa4..4283a3e 100644 --- a/GBM/My Project/Resources.resx +++ b/GBM/My Project/Resources.resx @@ -406,9 +406,6 @@ &Tools - - Clea&n Local Manifest - &Compact Databases From 7c73b27af0c44e17b10bea2281f3119d8820f8f8 Mon Sep 17 00:00:00 2001 From: MikeMaximus Date: Sat, 3 Mar 2018 09:22:27 -0600 Subject: [PATCH 09/38] Updated readme.txt with current changes --- GBM/readme.txt | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/GBM/readme.txt b/GBM/readme.txt index e0ca111..fe9c216 100644 --- a/GBM/readme.txt +++ b/GBM/readme.txt @@ -1,10 +1,10 @@ -Game Backup Monitor v1.0.8 Pre-Release Readme +Game Backup Monitor v1.1.0 Readme http://mikemaximus.github.io/gbm-web/ gamebackupmonitor@gmail.com -February 24, 2018 +March 3rd, 2018 -New in 1.0.8 +New in 1.1.0 Disclaimer: @@ -14,14 +14,23 @@ Disclaimer: All Platforms: +- Core Design Changes (Game Configuration) + - Game ID is now exposed to the user and can be changed. This feature is mainly for developer and contributer usage. + - Game ID is generated automatically by GBM or acquired from an import, the user doesn't need to set it unless they want to. + - Game ID is now used to name game backup files and folders. + - Game Name can now contain any character. + - When a game is deleted via Game Manager (or sync), all backup manifest entries for that particular game are now deleted. The backup files themselves are not. +- Core Design Changes (Features) + - The "Enable Sync" feature is now mandatory and the option been removed from Settings. + - The "Clean Local Manifest" feature has been removed. It is no longer required because manfiest entries can no longer be orphaned. Existing orphaned entries will be removed during the v1.1.0 database upgrade. +- Import / Export Changes + - When importing a game list, GBM now uses the Game ID to determine if a game is new or has an updated configuration. + - Games with an updated configuration are identified by red text. - Added Regular Expression support for game detection - This feature allows GBM to detect games based on a pattern instead of a single process name. - This allows GBM to better support games that run from multiple executables and games that use interpreters or emulators. - Use the new "Regular Expression" checkbox on the Game Manager and enter the pattern in the "Process" field. - GBM will validate patterns and offer to help troubleshoot (using regexr.com) when validation fails. -- Changed how GBM handles game and file names - - You may now use any character in the configuration name of a game. For example, Kingdom Come: "Deliverance" is now a valid game name. - - These characters are still stripped when a folder or filename is created, using the above example the backup folder and file name would be Kingdom Come Deliverance. - Updated session CSV export to adhere to RFC 4180. It now handles commas, quotes and line breaks correctly. Windows Only: @@ -33,5 +42,10 @@ Linux Only: - GBM now uses notify-send (libnotify) if it's available to display notifications on Linux. - Mono style notifications will be displayed if notify-send is not available. - The GBM icon will be displayed on notifications if it's been installed to the correct location (via makefile or deb). + +Known Issues: + +- After upgrading to v1.1.0, backup manifest entries and files created with prior versions are not overwritten when a new backup is created. + The entire version history of GBM releases is available at http://mikemaximus.github.io/gbm-web/versionhistory.html \ No newline at end of file From 9a024349f59b5744987cf156fe7e5080c89eb2a3 Mon Sep 17 00:00:00 2001 From: MikeMaximus Date: Sat, 3 Mar 2018 15:14:16 -0600 Subject: [PATCH 10/38] Added Game ID to custom filter --- GBM/Forms/frmFilter.vb | 11 +++++++++++ GBM/My Project/Resources.Designer.vb | 9 +++++++++ GBM/My Project/Resources.resx | 3 +++ 3 files changed, 23 insertions(+) diff --git a/GBM/Forms/frmFilter.vb b/GBM/Forms/frmFilter.vb index 2cbae61..d861608 100644 --- a/GBM/Forms/frmFilter.vb +++ b/GBM/Forms/frmFilter.vb @@ -132,6 +132,17 @@ Public Class frmFilter Private Sub LoadFilterFields() Dim oField As clsGameFilterField + + 'Game ID + oField = New clsGameFilterField + oField.FieldName = "MonitorID" + oField.FriendlyFieldName = frmFilter_FieldGameID + oField.Type = clsGameFilterField.eDataType.fString + oField.Status = clsGameFilterField.eFieldStatus.ValidSort + oField.Status = clsGameFilterField.eFieldStatus.ValidFilter + oValidFields.Add(oField) + + 'Name oField = New clsGameFilterField oField.FieldName = "Name" diff --git a/GBM/My Project/Resources.Designer.vb b/GBM/My Project/Resources.Designer.vb index 07e0e5b..029f27a 100644 --- a/GBM/My Project/Resources.Designer.vb +++ b/GBM/My Project/Resources.Designer.vb @@ -1095,6 +1095,15 @@ Namespace My.Resources End Get End Property + ''' + ''' Looks up a localized string similar to Game ID. + ''' + Friend ReadOnly Property frmFilter_FieldGameID() As String + Get + Return ResourceManager.GetString("frmFilter_FieldGameID", resourceCulture) + End Get + End Property + ''' ''' Looks up a localized string similar to Hours. ''' diff --git a/GBM/My Project/Resources.resx b/GBM/My Project/Resources.resx index 4283a3e..94c78d7 100644 --- a/GBM/My Project/Resources.resx +++ b/GBM/My Project/Resources.resx @@ -2023,4 +2023,7 @@ Edit Game ID + + Game ID + \ No newline at end of file From 990756514583c01b79ef27dcc73968c0d6831390 Mon Sep 17 00:00:00 2001 From: MikeMaximus Date: Sat, 3 Mar 2018 20:04:59 -0600 Subject: [PATCH 11/38] Revised remote manifest updates --- GBM/Managers/mgrBackup.vb | 8 +++++--- GBM/Managers/mgrManifest.vb | 19 ++++++++----------- GBM/readme.txt | 5 ----- 3 files changed, 13 insertions(+), 19 deletions(-) diff --git a/GBM/Managers/mgrBackup.vb b/GBM/Managers/mgrBackup.vb index 9f10866..74394a2 100644 --- a/GBM/Managers/mgrBackup.vb +++ b/GBM/Managers/mgrBackup.vb @@ -48,10 +48,12 @@ Public Class mgrBackup oItem.CheckSum = sCheckSum 'Save Remote Manifest - If mgrManifest.DoSpecificManifestCheck(oItem, mgrSQLite.Database.Remote) Then - mgrManifest.DoManifestUpdateByManifestID(oItem, mgrSQLite.Database.Remote) + If Not oGameInfo.AppendTimeStamp Then + If Not mgrManifest.DoUpdateLatestManifest(oItem, mgrSQLite.Database.Remote) Then + mgrManifest.DoManifestAdd(oItem, mgrSQLite.Database.Remote) + End If Else - mgrManifest.DoManifestAdd(oItem, mgrSQLite.Database.Remote) + mgrManifest.DoManifestAdd(oItem, mgrSQLite.Database.Remote) End If 'Save Local Manifest diff --git a/GBM/Managers/mgrManifest.vb b/GBM/Managers/mgrManifest.vb index f0be577..3ce67cf 100644 --- a/GBM/Managers/mgrManifest.vb +++ b/GBM/Managers/mgrManifest.vb @@ -114,25 +114,22 @@ Return oBackupItem End Function - 'This should only be used to update specific entries in the remote manifest - Public Shared Function DoSpecificManifestCheck(ByRef oItem As clsBackup, ByVal iSelectDB As mgrSQLite.Database) As Boolean + Public Shared Function DoUpdateLatestManifest(ByRef oItem As clsBackup, ByVal iSelectDB As mgrSQLite.Database) As Boolean Dim oDatabase As New mgrSQLite(iSelectDB) - Dim oData As DataSet + Dim oData As Object Dim sSQL As String Dim hshParams As New Hashtable - sSQL = "SELECT * FROM manifest NATURAL JOIN monitorlist " - sSQL &= "WHERE MonitorID = @MonitorID AND FileName = @FileName" + sSQL = "SELECT ManifestID FROM manifest NATURAL JOIN monitorlist " + sSQL &= "WHERE MonitorID = @MonitorID ORDER BY DateUpdated DESC LIMIT 1" hshParams.Add("MonitorID", oItem.MonitorID) - hshParams.Add("FileName", oItem.FileName) - oData = oDatabase.ReadParamData(sSQL, hshParams) + oData = oDatabase.ReadSingleValue(sSQL, hshParams) - If oData.Tables(0).Rows.Count > 0 Then - For Each dr As DataRow In oData.Tables(0).Rows - oItem.ManifestID = CStr(dr("ManifestID")) - Next + If Not oData Is Nothing Then + oItem.ManifestID = CStr(oData) + DoManifestUpdateByManifestID(oItem, mgrSQLite.Database.Remote) Return True Else Return False diff --git a/GBM/readme.txt b/GBM/readme.txt index fe9c216..18de283 100644 --- a/GBM/readme.txt +++ b/GBM/readme.txt @@ -42,10 +42,5 @@ Linux Only: - GBM now uses notify-send (libnotify) if it's available to display notifications on Linux. - Mono style notifications will be displayed if notify-send is not available. - The GBM icon will be displayed on notifications if it's been installed to the correct location (via makefile or deb). - -Known Issues: - -- After upgrading to v1.1.0, backup manifest entries and files created with prior versions are not overwritten when a new backup is created. - The entire version history of GBM releases is available at http://mikemaximus.github.io/gbm-web/versionhistory.html \ No newline at end of file From b76a7dd6ab7fe57318756292f8db27992d0e79a3 Mon Sep 17 00:00:00 2001 From: MikeMaximus Date: Sun, 4 Mar 2018 09:27:00 -0600 Subject: [PATCH 12/38] Fixed orphaned tags issue when game id is changed --- GBM/Managers/mgrMonitorList.vb | 3 ++- GBM/readme.txt | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/GBM/Managers/mgrMonitorList.vb b/GBM/Managers/mgrMonitorList.vb index e1ad955..5c2850d 100644 --- a/GBM/Managers/mgrMonitorList.vb +++ b/GBM/Managers/mgrMonitorList.vb @@ -150,7 +150,8 @@ Public Class mgrMonitorList sSQL = "UPDATE monitorlist SET MonitorID=@ID, Name=@Name, Process=@Process, Path=@Path, AbsolutePath=@AbsolutePath, FolderSave=@FolderSave, " sSQL &= "FileType=@FileType, TimeStamp=@TimeStamp, ExcludeList=@ExcludeList, ProcessPath=@ProcessPath, Icon=@Icon, " sSQL &= "Hours=@Hours, Version=@Version, Company=@Company, Enabled=@Enabled, MonitorOnly=@MonitorOnly, BackupLimit=@BackupLimit, " - sSQL &= "CleanFolder=@CleanFolder, Parameter=@Parameter, Comments=@Comments, IsRegEx=@IsRegEx WHERE MonitorID=@QueryID" + sSQL &= "CleanFolder=@CleanFolder, Parameter=@Parameter, Comments=@Comments, IsRegEx=@IsRegEx WHERE MonitorID=@QueryID;" + sSQL &= "UPDATE gametags SET MonitorID=@ID WHERE MonitorID=@QueryID;" 'Parameters hshParams = SetCoreParameters(oGame) diff --git a/GBM/readme.txt b/GBM/readme.txt index 18de283..be4f01c 100644 --- a/GBM/readme.txt +++ b/GBM/readme.txt @@ -42,5 +42,11 @@ Linux Only: - GBM now uses notify-send (libnotify) if it's available to display notifications on Linux. - Mono style notifications will be displayed if notify-send is not available. - The GBM icon will be displayed on notifications if it's been installed to the correct location (via makefile or deb). + +Known Issues: + +- If one or more Game IDs are changed on one computer and these changes are synced to another PC sharing the same backup folder, the local backup manifest data for the changed game(s) on that PC will be reset. + - This is intended behavior. + - If "Backup Handling" options are enabled in Settings, GBM will see any backups for the changed game(s) as new and will handle them accordingly. The entire version history of GBM releases is available at http://mikemaximus.github.io/gbm-web/versionhistory.html \ No newline at end of file From 2e5fa70f58dc8348bab6a62f8ae009e2a92174bd Mon Sep 17 00:00:00 2001 From: MikeMaximus Date: Sun, 4 Mar 2018 09:43:49 -0600 Subject: [PATCH 13/38] Fixed orphaned sessions issue when game id is changed --- GBM/Managers/mgrMonitorList.vb | 1 + GBM/readme.txt | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/GBM/Managers/mgrMonitorList.vb b/GBM/Managers/mgrMonitorList.vb index 5c2850d..98b5122 100644 --- a/GBM/Managers/mgrMonitorList.vb +++ b/GBM/Managers/mgrMonitorList.vb @@ -152,6 +152,7 @@ Public Class mgrMonitorList sSQL &= "Hours=@Hours, Version=@Version, Company=@Company, Enabled=@Enabled, MonitorOnly=@MonitorOnly, BackupLimit=@BackupLimit, " sSQL &= "CleanFolder=@CleanFolder, Parameter=@Parameter, Comments=@Comments, IsRegEx=@IsRegEx WHERE MonitorID=@QueryID;" sSQL &= "UPDATE gametags SET MonitorID=@ID WHERE MonitorID=@QueryID;" + sSQL &= "UPDATE sessions SET MonitorID=@ID WHERE MonitorID=@QueryID;" 'Parameters hshParams = SetCoreParameters(oGame) diff --git a/GBM/readme.txt b/GBM/readme.txt index be4f01c..255d119 100644 --- a/GBM/readme.txt +++ b/GBM/readme.txt @@ -45,8 +45,8 @@ Linux Only: Known Issues: -- If one or more Game IDs are changed on one computer and these changes are synced to another PC sharing the same backup folder, the local backup manifest data for the changed game(s) on that PC will be reset. - - This is intended behavior. - - If "Backup Handling" options are enabled in Settings, GBM will see any backups for the changed game(s) as new and will handle them accordingly. - +- If one or more Game IDs are changed on one computer and these changes are synced to another PC sharing the same backup folder: + - The local session data on that PC for the changed game(s) will be lost. + - The local backup manifest data for the changed game(s) on that PC will be reset. GBM will see any backups for the changed game(s) as new and will handle them accordingly. + The entire version history of GBM releases is available at http://mikemaximus.github.io/gbm-web/versionhistory.html \ No newline at end of file From ddee7372227dcde38f1f1e80541da4d5165fb7a8 Mon Sep 17 00:00:00 2001 From: MikeMaximus Date: Sun, 4 Mar 2018 21:23:01 -0600 Subject: [PATCH 14/38] Added game id sync to import --- GBM/Forms/frmGameManager.vb | 4 ++ GBM/Managers/mgrMonitorList.vb | 78 +++++++++++++++++++++++++++- GBM/My Project/Resources.Designer.vb | 27 ++++++++++ GBM/My Project/Resources.resx | 9 ++++ GBM/readme.txt | 6 +-- 5 files changed, 119 insertions(+), 5 deletions(-) diff --git a/GBM/Forms/frmGameManager.vb b/GBM/Forms/frmGameManager.vb index 490d4ca..cfc6554 100644 --- a/GBM/Forms/frmGameManager.vb +++ b/GBM/Forms/frmGameManager.vb @@ -1497,7 +1497,9 @@ Public Class frmGameManager If sLocation <> String.Empty Then If mgrMonitorList.DoImport(sLocation) Then + mgrMonitorList.SyncMonitorLists(Settings.SyncFields) LoadData() + LoadBackupData() End If End If @@ -1525,7 +1527,9 @@ Public Class frmGameManager If mgrCommon.ShowMessage(frmGameManager_ConfirmOfficialImport, MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then If mgrMonitorList.DoImport(sImportURL) Then + mgrMonitorList.SyncMonitorLists(Settings.SyncFields) LoadData() + LoadBackupData() End If End If End Sub diff --git a/GBM/Managers/mgrMonitorList.vb b/GBM/Managers/mgrMonitorList.vb index 98b5122..61d0473 100644 --- a/GBM/Managers/mgrMonitorList.vb +++ b/GBM/Managers/mgrMonitorList.vb @@ -163,7 +163,6 @@ Public Class mgrMonitorList End If oDatabase.RunParamQuery(sSQL, hshParams) - End Sub Public Shared Sub DoListUpdateMulti(ByVal sMonitorIDs As List(Of String), ByVal oGame As clsGame, Optional ByVal iSelectDB As mgrSQLite.Database = mgrSQLite.Database.Local) @@ -787,6 +786,9 @@ Public Class mgrMonitorList If (sPath.IndexOf("http://", 0, StringComparison.CurrentCultureIgnoreCase) > -1) Or (sPath.IndexOf("https://", 0, StringComparison.CurrentCultureIgnoreCase) > -1) Then If mgrCommon.CheckAddress(sPath) Then + If mgrCommon.ShowMessage(mgrMonitorList_ConfirmGameIDSync, MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then + ImportSyncGameID(sPath, True) + End If ImportMonitorList(sPath, True) Return True Else @@ -795,6 +797,9 @@ Public Class mgrMonitorList End If Else If File.Exists(sPath) Then + If mgrCommon.ShowMessage(mgrMonitorList_ConfirmGameIDSync, MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then + ImportSyncGameID(sPath) + End If ImportMonitorList(sPath) Return True Else @@ -815,8 +820,14 @@ Public Class mgrMonitorList Cursor.Current = Cursors.WaitCursor - 'Add / Update Sync hshCompareFrom = mgrXML.ReadMonitorList(sLocation, oExportInfo, bWebRead) + + If oExportInfo.AppVer < 110 Then + If mgrCommon.ShowMessage(mgrMonitorList_ImportVersionWarning, MsgBoxStyle.YesNo) = MsgBoxResult.No Then + Exit Sub + End If + End If + hshCompareTo = ReadList(eListTypes.FullList, mgrSQLite.Database.Local) hshSyncItems = hshCompareFrom.Clone @@ -829,7 +840,11 @@ Public Class mgrMonitorList hshSyncItems.Remove(oFromItem.ID) Else DirectCast(hshSyncItems(oFromItem.ID), clsGame).ImportUpdate = True + 'These fields need to be set via the object or they will be lost when the configuration is updated + DirectCast(hshSyncItems(oFromItem.ID), clsGame).Hours = oToItem.Hours + DirectCast(hshSyncItems(oFromItem.ID), clsGame).CleanFolder = oToItem.CleanFolder End If + End If End If Next @@ -856,6 +871,65 @@ Public Class mgrMonitorList Application.DoEvents() End Sub + Private Shared Sub ImportSyncGameID(ByVal sLocation As String, Optional ByVal bWebRead As Boolean = False) + Dim oLocalDatabase As New mgrSQLite(mgrSQLite.Database.Local) + Dim oRemoteDatabase As New mgrSQLite(mgrSQLite.Database.Remote) + Dim sSQL As String + Dim hshParams As Hashtable + Dim oParamList As New List(Of Hashtable) + Dim hshCompareFrom As Hashtable + Dim hshCompareTo As Hashtable + Dim hshSyncIDs As New Hashtable + Dim oFromItem As clsGame + Dim oToItem As clsGame + Dim oExportInfo As New ExportData + + Cursor.Current = Cursors.WaitCursor + + hshCompareFrom = mgrXML.ReadMonitorList(sLocation, oExportInfo, bWebRead) + + If oExportInfo.AppVer < 110 Then + mgrCommon.ShowMessage(mgrMonitorList_ErrorGameIDVerFailure, MsgBoxStyle.Exclamation) + Exit Sub + End If + + hshCompareTo = ReadList(eListTypes.FullList, mgrSQLite.Database.Local) + + For Each oFromItem In hshCompareFrom.Values + If Not hshCompareTo.Contains(oFromItem.ID) Then + For Each oToItem In hshCompareTo.Values + 'Strip all special characters and compare names + If Regex.Replace(oToItem.Name, "[^\w]+", "") = Regex.Replace(oFromItem.Name, "[^\w]+", "") Then + 'Ignore games with duplicate names + If Not hshSyncIDs.Contains(oFromItem.ID) Then + hshSyncIDs.Add(oToItem.ID, oFromItem.ID) + End If + End If + Next + End If + Next + + For Each de As DictionaryEntry In hshSyncIDs + hshParams = New Hashtable + hshParams.Add("MonitorID", CStr(de.Value)) + hshParams.Add("QueryID", CStr(de.Key)) + oParamList.Add(hshParams) + Next + + sSQL = "UPDATE monitorlist SET MonitorID=@MonitorID WHERE MonitorID=@QueryID;" + sSQL &= "UPDATE gametags SET MonitorID=@MonitorID WHERE MonitorID=@QueryID;" + sSQL &= "UPDATE manifest SET MonitorID=@MonitorID WHERE MonitorID=@QueryID;" + + oRemoteDatabase.RunMassParamQuery(sSQL, oParamList) + + sSQL &= "UPDATE sessions SET MonitorID=@MonitorID WHERE MonitorID=@QueryID;" + + oLocalDatabase.RunMassParamQuery(sSQL, oParamList) + + Cursor.Current = Cursors.Default + + End Sub + Public Shared Sub ExportMonitorList(ByVal sLocation As String) Dim oList As List(Of Game) Dim bSuccess As Boolean = False diff --git a/GBM/My Project/Resources.Designer.vb b/GBM/My Project/Resources.Designer.vb index 029f27a..a03ee87 100644 --- a/GBM/My Project/Resources.Designer.vb +++ b/GBM/My Project/Resources.Designer.vb @@ -5437,6 +5437,24 @@ Namespace My.Resources End Get End Property + ''' + ''' Looks up a localized string similar to GBM now uses a unique identifier for each game. For the import feature to work as intended, your existing game configurations need to use the same identifiers.[BR][BR]Do you want to sync your game identifiers? (Recommened). + ''' + Friend ReadOnly Property mgrMonitorList_ConfirmGameIDSync() As String + Get + Return ResourceManager.GetString("mgrMonitorList_ConfirmGameIDSync", resourceCulture) + End Get + End Property + + ''' + ''' Looks up a localized string similar to This file cannot be used to sync game indentifiers. It was created with an older version of GBM.. + ''' + Friend ReadOnly Property mgrMonitorList_ErrorGameIDVerFailure() As String + Get + Return ResourceManager.GetString("mgrMonitorList_ErrorGameIDVerFailure", resourceCulture) + End Get + End Property + ''' ''' Looks up a localized string similar to Export Complete. [PARAM] item(s) have been exported.. ''' @@ -5473,6 +5491,15 @@ Namespace My.Resources End Get End Property + ''' + ''' Looks up a localized string similar to This export file was created with a version of GBM prior to 1.1.0 and does not contain unique game identifiers.[BR][BR]Do you still want to import configurations from this file? (Not Recommended). + ''' + Friend ReadOnly Property mgrMonitorList_ImportVersionWarning() As String + Get + Return ResourceManager.GetString("mgrMonitorList_ImportVersionWarning", resourceCulture) + End Get + End Property + ''' ''' Looks up a localized string similar to [PARAM] change(s) synced.. ''' diff --git a/GBM/My Project/Resources.resx b/GBM/My Project/Resources.resx index 94c78d7..4dc637f 100644 --- a/GBM/My Project/Resources.resx +++ b/GBM/My Project/Resources.resx @@ -2026,4 +2026,13 @@ Game ID + + GBM now uses a unique identifier for each game. For the import feature to work as intended, your existing game configurations need to use the same identifiers.[BR][BR]Do you want to sync your game identifiers? (Recommened) + + + This file cannot be used to sync game indentifiers. It was created with an older version of GBM. + + + This export file was created with a version of GBM prior to 1.1.0 and does not contain unique game identifiers.[BR][BR]Do you still want to import configurations from this file? (Not Recommended) + \ No newline at end of file diff --git a/GBM/readme.txt b/GBM/readme.txt index 255d119..b2ecf99 100644 --- a/GBM/readme.txt +++ b/GBM/readme.txt @@ -8,9 +8,9 @@ New in 1.1.0 Disclaimer: -1. This is pre-release software intended for testing. -2. Database files from this version (gbm.s3db) may not be compatible with the full release. GBM makes automatic backups of your database files if you need to revert to a prior version. -3. Do not make external links to this release, it will be available for a limited time. +Version 1.1.0 makes fundamental changes to how GBM works with game configurations and backup data. Please read the changes below carefully. + +I've done my best to make sure the upgrade process is seamless and allows everyone to continue using their existing data and configurations. All Platforms: From fe6b90311a39578124bdbf1d8e307355d5ba790e Mon Sep 17 00:00:00 2001 From: MikeMaximus Date: Mon, 5 Mar 2018 13:06:50 -0600 Subject: [PATCH 15/38] Fixed duplicate check on game id sync --- GBM/Managers/mgrMonitorList.vb | 8 ++++---- GBM/readme.txt | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/GBM/Managers/mgrMonitorList.vb b/GBM/Managers/mgrMonitorList.vb index 61d0473..1667d4d 100644 --- a/GBM/Managers/mgrMonitorList.vb +++ b/GBM/Managers/mgrMonitorList.vb @@ -899,10 +899,10 @@ Public Class mgrMonitorList If Not hshCompareTo.Contains(oFromItem.ID) Then For Each oToItem In hshCompareTo.Values 'Strip all special characters and compare names - If Regex.Replace(oToItem.Name, "[^\w]+", "") = Regex.Replace(oFromItem.Name, "[^\w]+", "") Then + If Regex.Replace(oToItem.Name, "[^\w]+", "").ToLower = Regex.Replace(oFromItem.Name, "[^\w]+", "").ToLower Then 'Ignore games with duplicate names If Not hshSyncIDs.Contains(oFromItem.ID) Then - hshSyncIDs.Add(oToItem.ID, oFromItem.ID) + hshSyncIDs.Add(oFromItem.ID, oToItem.ID) End If End If Next @@ -911,8 +911,8 @@ Public Class mgrMonitorList For Each de As DictionaryEntry In hshSyncIDs hshParams = New Hashtable - hshParams.Add("MonitorID", CStr(de.Value)) - hshParams.Add("QueryID", CStr(de.Key)) + hshParams.Add("MonitorID", CStr(de.Key)) + hshParams.Add("QueryID", CStr(de.Value)) oParamList.Add(hshParams) Next diff --git a/GBM/readme.txt b/GBM/readme.txt index b2ecf99..20975da 100644 --- a/GBM/readme.txt +++ b/GBM/readme.txt @@ -20,6 +20,7 @@ All Platforms: - Game ID is now used to name game backup files and folders. - Game Name can now contain any character. - When a game is deleted via Game Manager (or sync), all backup manifest entries for that particular game are now deleted. The backup files themselves are not. + - The Game Manager now syncs changes to the remote database immediately, instead of only when closed. - Core Design Changes (Features) - The "Enable Sync" feature is now mandatory and the option been removed from Settings. - The "Clean Local Manifest" feature has been removed. It is no longer required because manfiest entries can no longer be orphaned. Existing orphaned entries will be removed during the v1.1.0 database upgrade. From b23ace4b549b3224258eadb3e442d123439ee586 Mon Sep 17 00:00:00 2001 From: MikeMaximus Date: Mon, 5 Mar 2018 13:51:32 -0600 Subject: [PATCH 16/38] Updated game id sync confirmations --- GBM/Forms/frmGameManager.vb | 4 ++-- GBM/Forms/frmStartUpWizard.vb | 2 +- GBM/Managers/mgrMonitorList.vb | 15 ++++++++++++--- GBM/My Project/Resources.Designer.vb | 15 ++++++++++++--- GBM/My Project/Resources.resx | 7 +++++-- 5 files changed, 32 insertions(+), 11 deletions(-) diff --git a/GBM/Forms/frmGameManager.vb b/GBM/Forms/frmGameManager.vb index cfc6554..b40a468 100644 --- a/GBM/Forms/frmGameManager.vb +++ b/GBM/Forms/frmGameManager.vb @@ -1496,7 +1496,7 @@ Public Class frmGameManager sLocation = mgrCommon.OpenFileBrowser("XML_Import", frmGameManager_ChooseImportXML, "xml", frmGameManager_XML, Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), False) If sLocation <> String.Empty Then - If mgrMonitorList.DoImport(sLocation) Then + If mgrMonitorList.DoImport(sLocation, False) Then mgrMonitorList.SyncMonitorLists(Settings.SyncFields) LoadData() LoadBackupData() @@ -1526,7 +1526,7 @@ Public Class frmGameManager End If If mgrCommon.ShowMessage(frmGameManager_ConfirmOfficialImport, MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then - If mgrMonitorList.DoImport(sImportURL) Then + If mgrMonitorList.DoImport(sImportURL, True) Then mgrMonitorList.SyncMonitorLists(Settings.SyncFields) LoadData() LoadBackupData() diff --git a/GBM/Forms/frmStartUpWizard.vb b/GBM/Forms/frmStartUpWizard.vb index 8b31c19..3813e2a 100644 --- a/GBM/Forms/frmStartUpWizard.vb +++ b/GBM/Forms/frmStartUpWizard.vb @@ -105,7 +105,7 @@ Public Class frmStartUpWizard End If If mgrCommon.ShowMessage(frmStartUpWizard_ConfirmOfficialImport, MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then - If mgrMonitorList.DoImport(sImportURL) Then + If mgrMonitorList.DoImport(sImportURL, True) Then oGameData = mgrMonitorList.ReadList(mgrMonitorList.eListTypes.FullList) mgrMonitorList.SyncMonitorLists(oSettings.SyncFields) End If diff --git a/GBM/Managers/mgrMonitorList.vb b/GBM/Managers/mgrMonitorList.vb index 1667d4d..d8925f5 100644 --- a/GBM/Managers/mgrMonitorList.vb +++ b/GBM/Managers/mgrMonitorList.vb @@ -782,11 +782,20 @@ Public Class mgrMonitorList Return oList End Function - Public Shared Function DoImport(ByVal sPath As String) As Boolean + Public Shared Function DoImport(ByVal sPath As String, ByVal bOfficial As Boolean) As Boolean + Dim sWarning As String + + 'Set Warning Message + If bOfficial Then + sWarning = mgrMonitorList_ConfirmOfficialGameIDSync + Else + sWarning = mgrMonitorList_ConfirmFileGameIDSync + End If + If (sPath.IndexOf("http://", 0, StringComparison.CurrentCultureIgnoreCase) > -1) Or (sPath.IndexOf("https://", 0, StringComparison.CurrentCultureIgnoreCase) > -1) Then If mgrCommon.CheckAddress(sPath) Then - If mgrCommon.ShowMessage(mgrMonitorList_ConfirmGameIDSync, MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then + If mgrCommon.ShowMessage(sWarning, MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then ImportSyncGameID(sPath, True) End If ImportMonitorList(sPath, True) @@ -797,7 +806,7 @@ Public Class mgrMonitorList End If Else If File.Exists(sPath) Then - If mgrCommon.ShowMessage(mgrMonitorList_ConfirmGameIDSync, MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then + If mgrCommon.ShowMessage(sWarning, MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then ImportSyncGameID(sPath) End If ImportMonitorList(sPath) diff --git a/GBM/My Project/Resources.Designer.vb b/GBM/My Project/Resources.Designer.vb index a03ee87..0e562e4 100644 --- a/GBM/My Project/Resources.Designer.vb +++ b/GBM/My Project/Resources.Designer.vb @@ -5438,11 +5438,20 @@ Namespace My.Resources End Property ''' - ''' Looks up a localized string similar to GBM now uses a unique identifier for each game. For the import feature to work as intended, your existing game configurations need to use the same identifiers.[BR][BR]Do you want to sync your game identifiers? (Recommened). + ''' Looks up a localized string similar to Do you want to sync your local game ids with this export file? (Not Recommended) [BR][BR]You should only do this if you're managing your own game configurations.. ''' - Friend ReadOnly Property mgrMonitorList_ConfirmGameIDSync() As String + Friend ReadOnly Property mgrMonitorList_ConfirmFileGameIDSync() As String Get - Return ResourceManager.GetString("mgrMonitorList_ConfirmGameIDSync", resourceCulture) + Return ResourceManager.GetString("mgrMonitorList_ConfirmFileGameIDSync", resourceCulture) + End Get + End Property + + ''' + ''' Looks up a localized string similar to Do you want to sync your local game ids with the official game list? (Recommended)[BR][BR]This allows you to easily keep your game configurations up to date if they change in the future.. + ''' + Friend ReadOnly Property mgrMonitorList_ConfirmOfficialGameIDSync() As String + Get + Return ResourceManager.GetString("mgrMonitorList_ConfirmOfficialGameIDSync", resourceCulture) End Get End Property diff --git a/GBM/My Project/Resources.resx b/GBM/My Project/Resources.resx index 4dc637f..9848fc4 100644 --- a/GBM/My Project/Resources.resx +++ b/GBM/My Project/Resources.resx @@ -2026,8 +2026,8 @@ Game ID - - GBM now uses a unique identifier for each game. For the import feature to work as intended, your existing game configurations need to use the same identifiers.[BR][BR]Do you want to sync your game identifiers? (Recommened) + + Do you want to sync your local game ids with the official game list? (Recommended)[BR][BR]This allows you to easily keep your game configurations up to date if they change in the future. This file cannot be used to sync game indentifiers. It was created with an older version of GBM. @@ -2035,4 +2035,7 @@ This export file was created with a version of GBM prior to 1.1.0 and does not contain unique game identifiers.[BR][BR]Do you still want to import configurations from this file? (Not Recommended) + + Do you want to sync your local game ids with this export file? (Not Recommended) [BR][BR]You should only do this if you're managing your own game configurations. + \ No newline at end of file From 7d874f00799bef961ac5f78737754e1ba16499f6 Mon Sep 17 00:00:00 2001 From: MikeMaximus Date: Mon, 5 Mar 2018 18:58:51 -0600 Subject: [PATCH 17/38] Added message supression support and refined game id sync --- GBM/Forms/frmGameManager.vb | 4 +- GBM/Forms/frmMain.Designer.vb | 56 +++++++++++++++++++++++++-- GBM/Forms/frmMain.vb | 33 ++++++++++++++++ GBM/Forms/frmSettings.Designer.vb | 12 ++++++ GBM/Forms/frmSettings.vb | 12 +++++- GBM/Forms/frmStartUpWizard.vb | 2 +- GBM/Managers/mgrCommon.vb | 11 +++++- GBM/Managers/mgrMonitorList.vb | 47 ++++++++++++++++------ GBM/Managers/mgrSQLite.vb | 6 ++- GBM/Managers/mgrSettings.vb | 28 +++++++++++++- GBM/My Project/Resources.Designer.vb | 58 +++++++++++++++++++++++++++- GBM/My Project/Resources.resx | 24 ++++++++++-- 12 files changed, 264 insertions(+), 29 deletions(-) diff --git a/GBM/Forms/frmGameManager.vb b/GBM/Forms/frmGameManager.vb index b40a468..18cce8b 100644 --- a/GBM/Forms/frmGameManager.vb +++ b/GBM/Forms/frmGameManager.vb @@ -1496,7 +1496,7 @@ Public Class frmGameManager sLocation = mgrCommon.OpenFileBrowser("XML_Import", frmGameManager_ChooseImportXML, "xml", frmGameManager_XML, Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), False) If sLocation <> String.Empty Then - If mgrMonitorList.DoImport(sLocation, False) Then + If mgrMonitorList.DoImport(sLocation, False, Settings) Then mgrMonitorList.SyncMonitorLists(Settings.SyncFields) LoadData() LoadBackupData() @@ -1526,7 +1526,7 @@ Public Class frmGameManager End If If mgrCommon.ShowMessage(frmGameManager_ConfirmOfficialImport, MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then - If mgrMonitorList.DoImport(sImportURL, True) Then + If mgrMonitorList.DoImport(sImportURL, True, Settings) Then mgrMonitorList.SyncMonitorLists(Settings.SyncFields) LoadData() LoadBackupData() diff --git a/GBM/Forms/frmMain.Designer.vb b/GBM/Forms/frmMain.Designer.vb index 5bc1b43..83816fb 100644 --- a/GBM/Forms/frmMain.Designer.vb +++ b/GBM/Forms/frmMain.Designer.vb @@ -42,6 +42,9 @@ Partial Class frmMain Me.gMonTrayLogClear = New System.Windows.Forms.ToolStripMenuItem() Me.gMonTrayLogSave = New System.Windows.Forms.ToolStripMenuItem() Me.gMonTrayToolsSessions = New System.Windows.Forms.ToolStripMenuItem() + Me.gMonTrayToolsSyncGameID = New System.Windows.Forms.ToolStripMenuItem() + Me.gMonTrayToolsSyncGameIDOfficial = New System.Windows.Forms.ToolStripMenuItem() + Me.gMonTrayToolsSyncGameIDFile = New System.Windows.Forms.ToolStripMenuItem() Me.gMonTraySep1 = New System.Windows.Forms.ToolStripSeparator() Me.gMonTrayExit = New System.Windows.Forms.ToolStripMenuItem() Me.bwMonitor = New System.ComponentModel.BackgroundWorker() @@ -68,6 +71,9 @@ Partial Class frmMain Me.gMonLogClear = New System.Windows.Forms.ToolStripMenuItem() Me.gMonLogSave = New System.Windows.Forms.ToolStripMenuItem() Me.gMonToolsSessions = New System.Windows.Forms.ToolStripMenuItem() + Me.gMonToolsSyncGameID = New System.Windows.Forms.ToolStripMenuItem() + Me.gMonToolsSyncGameIDOfficial = New System.Windows.Forms.ToolStripMenuItem() + Me.gMonToolsSyncGameIDFile = New System.Windows.Forms.ToolStripMenuItem() Me.gMonHelp = New System.Windows.Forms.ToolStripMenuItem() Me.gMonHelpWebSite = New System.Windows.Forms.ToolStripMenuItem() Me.gMonHelpManual = New System.Windows.Forms.ToolStripMenuItem() @@ -103,7 +109,7 @@ Partial Class frmMain ' Me.gMonTrayMenu.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.gMonTrayNotification, Me.gMonTrayShow, Me.gMonTraySep2, Me.gMonTrayMon, Me.gMonTraySettings, Me.gMonTraySetup, Me.gMonTrayTools, Me.gMonTraySep1, Me.gMonTrayExit}) Me.gMonTrayMenu.Name = "gMonTrayMenu" - Me.gMonTrayMenu.Size = New System.Drawing.Size(162, 192) + Me.gMonTrayMenu.Size = New System.Drawing.Size(162, 170) ' 'gMonTrayNotification ' @@ -168,7 +174,7 @@ Partial Class frmMain ' 'gMonTrayTools ' - Me.gMonTrayTools.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.gMonTrayToolsCompact, Me.gMonTrayToolsLog, Me.gMonTrayToolsSessions}) + Me.gMonTrayTools.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.gMonTrayToolsCompact, Me.gMonTrayToolsLog, Me.gMonTrayToolsSessions, Me.gMonTrayToolsSyncGameID}) Me.gMonTrayTools.Name = "gMonTrayTools" Me.gMonTrayTools.Size = New System.Drawing.Size(161, 22) Me.gMonTrayTools.Text = "&Tools" @@ -204,6 +210,25 @@ Partial Class frmMain Me.gMonTrayToolsSessions.Size = New System.Drawing.Size(179, 22) Me.gMonTrayToolsSessions.Text = "&Session Viewer..." ' + 'gMonTrayToolsSyncGameID + ' + Me.gMonTrayToolsSyncGameID.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.gMonTrayToolsSyncGameIDOfficial, Me.gMonTrayToolsSyncGameIDFile}) + Me.gMonTrayToolsSyncGameID.Name = "gMonTrayToolsSyncGameID" + Me.gMonTrayToolsSyncGameID.Size = New System.Drawing.Size(179, 22) + Me.gMonTrayToolsSyncGameID.Text = "S&ync Game IDs" + ' + 'gMonTrayToolsSyncGameIDOfficial + ' + Me.gMonTrayToolsSyncGameIDOfficial.Name = "gMonTrayToolsSyncGameIDOfficial" + Me.gMonTrayToolsSyncGameIDOfficial.Size = New System.Drawing.Size(142, 22) + Me.gMonTrayToolsSyncGameIDOfficial.Text = "&Official List..." + ' + 'gMonTrayToolsSyncGameIDFile + ' + Me.gMonTrayToolsSyncGameIDFile.Name = "gMonTrayToolsSyncGameIDFile" + Me.gMonTrayToolsSyncGameIDFile.Size = New System.Drawing.Size(142, 22) + Me.gMonTrayToolsSyncGameIDFile.Text = "&File..." + ' 'gMonTraySep1 ' Me.gMonTraySep1.Name = "gMonTraySep1" @@ -348,7 +373,7 @@ Partial Class frmMain ' 'gMonTools ' - Me.gMonTools.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.gMonToolsCompact, Me.gMonToolsLog, Me.gMonToolsSessions}) + Me.gMonTools.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.gMonToolsCompact, Me.gMonToolsLog, Me.gMonToolsSessions, Me.gMonToolsSyncGameID}) Me.gMonTools.Name = "gMonTools" Me.gMonTools.Size = New System.Drawing.Size(47, 20) Me.gMonTools.Text = "&Tools" @@ -384,6 +409,25 @@ Partial Class frmMain Me.gMonToolsSessions.Size = New System.Drawing.Size(179, 22) Me.gMonToolsSessions.Text = "&Session Viewer..." ' + 'gMonToolsSyncGameID + ' + Me.gMonToolsSyncGameID.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.gMonToolsSyncGameIDOfficial, Me.gMonToolsSyncGameIDFile}) + Me.gMonToolsSyncGameID.Name = "gMonToolsSyncGameID" + Me.gMonToolsSyncGameID.Size = New System.Drawing.Size(179, 22) + Me.gMonToolsSyncGameID.Text = "S&ync Game IDs" + ' + 'gMonToolsSyncGameIDOfficial + ' + Me.gMonToolsSyncGameIDOfficial.Name = "gMonToolsSyncGameIDOfficial" + Me.gMonToolsSyncGameIDOfficial.Size = New System.Drawing.Size(152, 22) + Me.gMonToolsSyncGameIDOfficial.Text = "&Official List..." + ' + 'gMonToolsSyncGameIDFile + ' + Me.gMonToolsSyncGameIDFile.Name = "gMonToolsSyncGameIDFile" + Me.gMonToolsSyncGameIDFile.Size = New System.Drawing.Size(152, 22) + Me.gMonToolsSyncGameIDFile.Text = "&File..." + ' 'gMonHelp ' Me.gMonHelp.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.gMonHelpWebSite, Me.gMonHelpManual, Me.gMonHelpCheckforUpdates, Me.gMonHelpAbout}) @@ -621,4 +665,10 @@ Partial Class frmMain Friend WithEvents gMonStripStatusButton As System.Windows.Forms.ToolStripStatusLabel Friend WithEvents gMonToolsSessions As ToolStripMenuItem Friend WithEvents gMonTrayToolsSessions As ToolStripMenuItem + Friend WithEvents gMonToolsSyncGameID As ToolStripMenuItem + Friend WithEvents gMonToolsSyncGameIDOfficial As ToolStripMenuItem + Friend WithEvents gMonToolsSyncGameIDFile As ToolStripMenuItem + Friend WithEvents gMonTrayToolsSyncGameID As ToolStripMenuItem + Friend WithEvents gMonTrayToolsSyncGameIDOfficial As ToolStripMenuItem + Friend WithEvents gMonTrayToolsSyncGameIDFile As ToolStripMenuItem End Class diff --git a/GBM/Forms/frmMain.vb b/GBM/Forms/frmMain.vb index 59b1a89..9b1b4d1 100644 --- a/GBM/Forms/frmMain.vb +++ b/GBM/Forms/frmMain.vb @@ -988,6 +988,26 @@ Public Class frmMain mgrMonitorList.SyncMonitorLists(oSettings.SyncFields, False) End Sub + Private Sub SyncGameIDs(ByVal bOfficial As Boolean) + Dim sLocation As String + + If mgrCommon.IsUnix Then + sLocation = App_URLImportLinux + Else + sLocation = App_URLImport + End If + + If bOfficial Then + mgrMonitorList.SyncGameIDs(sLocation, oSettings, True) + Else + sLocation = mgrCommon.OpenFileBrowser("XML_Import", frmGameManager_ChooseImportXML, "xml", frmGameManager_XML, Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), False) + + If sLocation <> String.Empty Then + mgrMonitorList.SyncGameIDs(sLocation, oSettings, False) + End If + End If + End Sub + Private Sub LocalDatabaseCheck() Dim oLocalDatabase As New mgrSQLite(mgrSQLite.Database.Local) oLocalDatabase.DatabaseUpgrade() @@ -1349,6 +1369,9 @@ Public Class frmMain gMonToolsCompact.Text = frmMain_gMonToolsCompact gMonToolsLog.Text = frmMain_gMonToolsLog gMonToolsSessions.Text = frmMain_gMonToolsSessions + gMonToolsSyncGameID.Text = frmMain_gMonToolsSyncGameID + gMonToolsSyncGameIDOfficial.Text = frmMain_gMonToolsSyncGameIDOfficial + gMonToolsSyncGameIDFile.Text = frmMain_gMonToolsSyncGameIDFile gMonLogClear.Text = frmMain_gMonLogClear gMonLogSave.Text = frmMain_gMonLogSave gMonHelp.Text = frmMain_gMonHelp @@ -1370,6 +1393,9 @@ Public Class frmMain gMonTrayToolsCompact.Text = frmMain_gMonToolsCompact gMonTrayToolsLog.Text = frmMain_gMonToolsLog gMonTrayToolsSessions.Text = frmMain_gMonToolsSessions + gMonTrayToolsSyncGameID.Text = frmMain_gMonToolsSyncGameID + gMonTrayToolsSyncGameIDOfficial.Text = frmMain_gMonToolsSyncGameIDOfficial + gMonTrayToolsSyncGameIDFile.Text = frmMain_gMonToolsSyncGameIDFile gMonTrayLogClear.Text = frmMain_gMonLogClear gMonTrayLogSave.Text = frmMain_gMonLogSave gMonTrayExit.Text = frmMain_gMonFileExit @@ -1907,4 +1933,11 @@ Public Class frmMain lblGameTitle.Focus() End Sub + Private Sub gMonToolsSyncGameIDOfficial_Click(sender As Object, e As EventArgs) Handles gMonToolsSyncGameIDOfficial.Click, gMonTrayToolsSyncGameIDOfficial.Click + SyncGameIDs(True) + End Sub + + Private Sub gMonToolsSyncGameIDFile_Click(sender As Object, e As EventArgs) Handles gMonToolsSyncGameIDFile.Click, gMonTrayToolsSyncGameIDFile.Click + SyncGameIDs(False) + End Sub End Class \ No newline at end of file diff --git a/GBM/Forms/frmSettings.Designer.vb b/GBM/Forms/frmSettings.Designer.vb index 52379b5..a51ba5a 100644 --- a/GBM/Forms/frmSettings.Designer.vb +++ b/GBM/Forms/frmSettings.Designer.vb @@ -65,6 +65,7 @@ Partial Class frmSettings Me.grpGameData = New System.Windows.Forms.GroupBox() Me.chkSessionTracking = New System.Windows.Forms.CheckBox() Me.lstSettings = New System.Windows.Forms.ListBox() + Me.btnResetMessages = New System.Windows.Forms.Button() Me.grpStartup.SuspendLayout() Me.grpFolderOptions.SuspendLayout() Me.grp7zGeneral.SuspendLayout() @@ -507,11 +508,21 @@ Partial Class frmSettings Me.lstSettings.Size = New System.Drawing.Size(162, 303) Me.lstSettings.TabIndex = 0 ' + 'btnResetMessages + ' + Me.btnResetMessages.Location = New System.Drawing.Point(128, 321) + Me.btnResetMessages.Name = "btnResetMessages" + Me.btnResetMessages.Size = New System.Drawing.Size(110, 23) + Me.btnResetMessages.TabIndex = 7 + Me.btnResetMessages.Text = "&Reset Warnings" + Me.btnResetMessages.UseVisualStyleBackColor = True + ' 'frmSettings ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font Me.ClientSize = New System.Drawing.Size(554, 361) + Me.Controls.Add(Me.btnResetMessages) Me.Controls.Add(Me.pnlGeneral) Me.Controls.Add(Me.pnlBackup) Me.Controls.Add(Me.pnl7z) @@ -592,4 +603,5 @@ Partial Class frmSettings Friend WithEvents lblMinutes As Label Friend WithEvents nudSupressBackupThreshold As NumericUpDown Friend WithEvents chkSupressBackup As CheckBox + Friend WithEvents btnResetMessages As Button End Class diff --git a/GBM/Forms/frmSettings.vb b/GBM/Forms/frmSettings.vb index 9519798..4325b16 100644 --- a/GBM/Forms/frmSettings.vb +++ b/GBM/Forms/frmSettings.vb @@ -162,6 +162,12 @@ Public Class frmSettings End If End Sub + Private Sub ResetMessages() + If mgrCommon.ShowMessage(frmSettings_ConfirmMessageReset, MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then + oSettings.SupressMessages = mgrSettings.eSupressMessages.None + End If + End Sub + Private Sub LoadSettings() chkStartWindows.Checked = oSettings.StartWithWindows chkMonitorOnStartup.Checked = oSettings.MonitorOnStartup @@ -293,6 +299,7 @@ Public Class frmSettings lblArguments.Text = frmSettings_lblArguments lblLocation.Text = frmSettings_lblLocation btnOptionalFields.Text = frmSettings_btnOptionalFields + btnResetMessages.Text = frmSettings_btnResetMessages 'Unix Handler If mgrCommon.IsUnix Then @@ -351,6 +358,10 @@ Public Class frmSettings SetDefaults() End Sub + Private Sub btnResetMessages_Click(sender As Object, e As EventArgs) Handles btnResetMessages.Click + ResetMessages() + End Sub + Private Sub btnOptionalFields_Click(sender As Object, e As EventArgs) Handles btnOptionalFields.Click OpenOptionalFields() End Sub @@ -358,5 +369,4 @@ Public Class frmSettings Private Sub lstSettings_SelectedValueChanged(sender As Object, e As EventArgs) Handles lstSettings.SelectedValueChanged ChangePanel() End Sub - End Class \ No newline at end of file diff --git a/GBM/Forms/frmStartUpWizard.vb b/GBM/Forms/frmStartUpWizard.vb index 3813e2a..cbcae36 100644 --- a/GBM/Forms/frmStartUpWizard.vb +++ b/GBM/Forms/frmStartUpWizard.vb @@ -105,7 +105,7 @@ Public Class frmStartUpWizard End If If mgrCommon.ShowMessage(frmStartUpWizard_ConfirmOfficialImport, MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then - If mgrMonitorList.DoImport(sImportURL, True) Then + If mgrMonitorList.DoImport(sImportURL, True, Settings, True) Then oGameData = mgrMonitorList.ReadList(mgrMonitorList.eListTypes.FullList) mgrMonitorList.SyncMonitorLists(oSettings.SyncFields) End If diff --git a/GBM/Managers/mgrCommon.vb b/GBM/Managers/mgrCommon.vb index e38f0d5..c46af4b 100644 --- a/GBM/Managers/mgrCommon.vb +++ b/GBM/Managers/mgrCommon.vb @@ -65,9 +65,16 @@ Public Class mgrCommon Return oFormatter.Deserialize(oStream) End Function - Public Shared Function CheckAddress(ByVal URL As String) As Boolean + Public Shared Function IsAddress(ByVal sURL As String) As Boolean + If (sURL.IndexOf("http://", 0, StringComparison.CurrentCultureIgnoreCase) > -1) Or (sURL.IndexOf("https://", 0, StringComparison.CurrentCultureIgnoreCase) > -1) Then + Return True + End If + Return False + End Function + + Public Shared Function CheckAddress(ByVal sURL As String) As Boolean Try - Dim request As WebRequest = WebRequest.Create(URL) + Dim request As WebRequest = WebRequest.Create(sURL) Dim response As WebResponse = request.GetResponse() response.Close() Catch ex As Exception diff --git a/GBM/Managers/mgrMonitorList.vb b/GBM/Managers/mgrMonitorList.vb index d8925f5..8a2afdd 100644 --- a/GBM/Managers/mgrMonitorList.vb +++ b/GBM/Managers/mgrMonitorList.vb @@ -782,21 +782,47 @@ Public Class mgrMonitorList Return oList End Function - Public Shared Function DoImport(ByVal sPath As String, ByVal bOfficial As Boolean) As Boolean + Public Shared Function SyncGameIDs(ByVal sPath As String, ByRef oSettings As mgrSettings, ByVal bOfficial As Boolean) As Boolean Dim sWarning As String - 'Set Warning Message If bOfficial Then - sWarning = mgrMonitorList_ConfirmOfficialGameIDSync + If (oSettings.SupressMessages And mgrSettings.eSupressMessages.GameIDSync) = mgrSettings.eSupressMessages.GameIDSync Then + sWarning = mgrMonitorList_ConfirmOfficialGameIDSync + Else + sWarning = mgrMonitorList_ConfirmInitialOfficialGameIDSync + oSettings.SupressMessages = oSettings.SetMessageField(oSettings.SupressMessages, mgrSettings.eSupressMessages.GameIDSync) + oSettings.SaveSettings() + End If Else - sWarning = mgrMonitorList_ConfirmFileGameIDSync + sWarning = mgrMonitorList_ConfirmFileGameIDSync End If - If (sPath.IndexOf("http://", 0, StringComparison.CurrentCultureIgnoreCase) > -1) Or - (sPath.IndexOf("https://", 0, StringComparison.CurrentCultureIgnoreCase) > -1) Then + If mgrCommon.ShowMessage(sWarning, MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then + If mgrCommon.IsAddress(sPath) Then + If mgrCommon.CheckAddress(sPath) Then + DoGameIDSync(sPath, True) + Else + mgrCommon.ShowMessage(mgrMonitorList_WebNoReponse, sPath, MsgBoxStyle.Exclamation) + Return False + End If + Else + If File.Exists(sPath) Then + DoGameIDSync(sPath) + Else + mgrCommon.ShowMessage(mgrMonitorList_FileNotFound, sPath, MsgBoxStyle.Exclamation) + Return False + End If + End If + End If + + Return True + End Function + + Public Shared Function DoImport(ByVal sPath As String, ByVal bOfficial As Boolean, ByRef oSettings As mgrSettings, Optional ByVal bStartUpWizard As Boolean = False) As Boolean + If mgrCommon.IsAddress(sPath) Then If mgrCommon.CheckAddress(sPath) Then - If mgrCommon.ShowMessage(sWarning, MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then - ImportSyncGameID(sPath, True) + If bOfficial And Not bStartUpWizard And Not ((oSettings.SupressMessages And mgrSettings.eSupressMessages.GameIDSync) = mgrSettings.eSupressMessages.GameIDSync) Then + SyncGameIDs(sPath, oSettings, True) End If ImportMonitorList(sPath, True) Return True @@ -806,9 +832,6 @@ Public Class mgrMonitorList End If Else If File.Exists(sPath) Then - If mgrCommon.ShowMessage(sWarning, MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then - ImportSyncGameID(sPath) - End If ImportMonitorList(sPath) Return True Else @@ -880,7 +903,7 @@ Public Class mgrMonitorList Application.DoEvents() End Sub - Private Shared Sub ImportSyncGameID(ByVal sLocation As String, Optional ByVal bWebRead As Boolean = False) + Private Shared Sub DoGameIDSync(ByVal sLocation As String, Optional ByVal bWebRead As Boolean = False) Dim oLocalDatabase As New mgrSQLite(mgrSQLite.Database.Local) Dim oRemoteDatabase As New mgrSQLite(mgrSQLite.Database.Remote) Dim sSQL As String diff --git a/GBM/Managers/mgrSQLite.vb b/GBM/Managers/mgrSQLite.vb index 6ca19cf..e9ee9b5 100644 --- a/GBM/Managers/mgrSQLite.vb +++ b/GBM/Managers/mgrSQLite.vb @@ -74,7 +74,8 @@ Public Class mgrSQLite "DisableConfirmation BOOLEAN NOT NULL, CreateSubFolder BOOLEAN NOT NULL, ShowOverwriteWarning BOOLEAN NOT NULL, RestoreOnLaunch BOOLEAN NOT NULL, " & "BackupFolder TEXT NOT NULL, StartWithWindows BOOLEAN NOT NULL, TimeTracking BOOLEAN NOT NULL, " & "SupressBackup BOOLEAN NOT NULL, SupressBackupThreshold INTEGER NOT NULL, CompressionLevel INTEGER NOT NULL, Custom7zArguments TEXT, " & - "Custom7zLocation TEXT, SyncFields INTEGER NOT NULL, AutoSaveLog BOOLEAN NOT NULL, AutoRestore BOOLEAN NOT NULL, AutoMark BOOLEAN NOT NULL, SessionTracking BOOLEAN NOT NULL);" + "Custom7zLocation TEXT, SyncFields INTEGER NOT NULL, AutoSaveLog BOOLEAN NOT NULL, AutoRestore BOOLEAN NOT NULL, AutoMark BOOLEAN NOT NULL, SessionTracking BOOLEAN NOT NULL, " & + "SupressMessages INTEGER NOT NULL);" 'Add Tables (SavedPath) sSql &= "CREATE TABLE savedpath (PathName TEXT NOT NULL PRIMARY KEY, Path TEXT NOT NULL);" @@ -771,7 +772,8 @@ Public Class mgrSQLite "DisableConfirmation BOOLEAN NOT NULL, CreateSubFolder BOOLEAN NOT NULL, ShowOverwriteWarning BOOLEAN NOT NULL, RestoreOnLaunch BOOLEAN NOT NULL, " & "BackupFolder TEXT NOT NULL, StartWithWindows BOOLEAN NOT NULL, TimeTracking BOOLEAN NOT NULL, " & "SupressBackup BOOLEAN NOT NULL, SupressBackupThreshold INTEGER NOT NULL, CompressionLevel INTEGER NOT NULL, Custom7zArguments TEXT, " & - "Custom7zLocation TEXT, SyncFields INTEGER NOT NULL, AutoSaveLog BOOLEAN NOT NULL, AutoRestore BOOLEAN NOT NULL, AutoMark BOOLEAN NOT NULL, SessionTracking BOOLEAN NOT NULL);" + "Custom7zLocation TEXT, SyncFields INTEGER NOT NULL, AutoSaveLog BOOLEAN NOT NULL, AutoRestore BOOLEAN NOT NULL, AutoMark BOOLEAN NOT NULL, SessionTracking BOOLEAN NOT NULL" & + "SupressMessages INTEGER NOT NULL);" sSQL &= "INSERT INTO settings_new(SettingsID, MonitorOnStartup, StartToTray, ShowDetectionToolTips, DisableConfirmation, CreateSubFolder, ShowOverwriteWarning, RestoreOnLaunch, " & "BackupFolder, StartWithWindows, TimeTracking, SupressBackup, SupressBackupThreshold, CompressionLevel, Custom7zArguments, Custom7zLocation, SyncFields, AutoSaveLog, " & "AutoRestore, AutoMark, SessionTracking) SELECT SettingsID, MonitorOnStartup, StartToTray, ShowDetectionToolTips, DisableConfirmation, CreateSubFolder, ShowOverwriteWarning, RestoreOnLaunch, " & diff --git a/GBM/Managers/mgrSettings.vb b/GBM/Managers/mgrSettings.vb index 3ce05b8..856798f 100644 --- a/GBM/Managers/mgrSettings.vb +++ b/GBM/Managers/mgrSettings.vb @@ -20,8 +20,14 @@ Public Class mgrSettings Private s7zLocation As String = String.Empty Private sBackupFolder As String = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments).TrimEnd(New Char() {"\", "/"}) Private eSyncFields As clsGame.eOptionalSyncFields = clsGame.eOptionalSyncFields.None Or clsGame.eOptionalSyncFields.TimeStamp + Private eMessages As eSupressMessages = eSupressMessages.None Private bAutoSaveLog As Boolean = False + Public Enum eSupressMessages + None = 0 + GameIDSync = 1 + End Enum + Property StartWithWindows As Boolean Get Return bStartWithWindows @@ -250,6 +256,15 @@ Public Class mgrSettings End Set End Property + Property SupressMessages As eSupressMessages + Get + Return eMessages + End Get + Set(value As eSupressMessages) + eMessages = value + End Set + End Property + Private Sub SaveFromClass() Dim oDatabase As New mgrSQLite(mgrSQLite.Database.Local) Dim sSQL As String @@ -261,7 +276,7 @@ Public Class mgrSettings sSQL = "INSERT INTO settings VALUES (1, @MonitorOnStartup, @StartToTray, @ShowDetectionToolTips, @DisableConfirmation, " sSQL &= "@CreateSubFolder, @ShowOverwriteWarning, @RestoreOnLaunch, @BackupFolder, @StartWithWindows, " sSQL &= "@TimeTracking, @SupressBackup, @SupressBackupThreshold, @CompressionLevel, @Custom7zArguments, @Custom7zLocation, " - sSQL &= "@SyncFields, @AutoSaveLog, @AutoRestore, @AutoMark, @SessionTracking)" + sSQL &= "@SyncFields, @AutoSaveLog, @AutoRestore, @AutoMark, @SessionTracking, @SupressMessages)" hshParams.Add("MonitorOnStartup", MonitorOnStartup) hshParams.Add("StartToTray", StartToTray) @@ -283,6 +298,7 @@ Public Class mgrSettings hshParams.Add("AutoRestore", AutoRestore) hshParams.Add("AutoMark", AutoMark) hshParams.Add("SessionTracking", SessionTracking) + hshParams.Add("SupressMessages", SupressMessages) oDatabase.RunParamQuery(sSQL, hshParams) End Sub @@ -317,6 +333,7 @@ Public Class mgrSettings AutoRestore = CBool(dr("AutoRestore")) AutoMark = CBool(dr("AutoMark")) SessionTracking = CBool(dr("SessionTracking")) + SupressMessages = CInt(dr("SupressMessages")) Next oDatabase.Disconnect() @@ -335,4 +352,13 @@ Public Class mgrSettings 'Set Remote Manifest Location mgrPath.RemoteDatabaseLocation = Me.BackupFolder End Sub + + Public Function SetMessageField(ByVal eMessages As eSupressMessages, ByVal eMessage As eSupressMessages) As eSupressMessages + Return eMessages Or eMessage + End Function + + Public Function RemoveMessageField(ByVal eMessages As eSupressMessages, ByVal eMessage As eSupressMessages) As eSupressMessages + Return eMessages And (Not eMessage) + End Function + End Class diff --git a/GBM/My Project/Resources.Designer.vb b/GBM/My Project/Resources.Designer.vb index 0e562e4..353741e 100644 --- a/GBM/My Project/Resources.Designer.vb +++ b/GBM/My Project/Resources.Designer.vb @@ -3327,6 +3327,33 @@ Namespace My.Resources End Get End Property + ''' + ''' Looks up a localized string similar to S&ync Game IDs. + ''' + Friend ReadOnly Property frmMain_gMonToolsSyncGameID() As String + Get + Return ResourceManager.GetString("frmMain_gMonToolsSyncGameID", resourceCulture) + End Get + End Property + + ''' + ''' Looks up a localized string similar to &File.... + ''' + Friend ReadOnly Property frmMain_gMonToolsSyncGameIDFile() As String + Get + Return ResourceManager.GetString("frmMain_gMonToolsSyncGameIDFile", resourceCulture) + End Get + End Property + + ''' + ''' Looks up a localized string similar to &Official List.... + ''' + Friend ReadOnly Property frmMain_gMonToolsSyncGameIDOfficial() As String + Get + Return ResourceManager.GetString("frmMain_gMonToolsSyncGameIDOfficial", resourceCulture) + End Get + End Property + ''' ''' Looks up a localized string similar to Show / Hide. ''' @@ -4020,6 +4047,15 @@ Namespace My.Resources End Get End Property + ''' + ''' Looks up a localized string similar to &Reset Warnings. + ''' + Friend ReadOnly Property frmSettings_btnResetMessages() As String + Get + Return ResourceManager.GetString("frmSettings_btnResetMessages", resourceCulture) + End Get + End Property + ''' ''' Looks up a localized string similar to &Save. ''' @@ -4218,6 +4254,15 @@ Namespace My.Resources End Get End Property + ''' + ''' Looks up a localized string similar to Do you want to reset all hidden warnings and messages?. + ''' + Friend ReadOnly Property frmSettings_ConfirmMessageReset() As String + Get + Return ResourceManager.GetString("frmSettings_ConfirmMessageReset", resourceCulture) + End Get + End Property + ''' ''' Looks up a localized string similar to The backup folder does not exist. Please choose a valid backup folder.. ''' @@ -5438,7 +5483,7 @@ Namespace My.Resources End Property ''' - ''' Looks up a localized string similar to Do you want to sync your local game ids with this export file? (Not Recommended) [BR][BR]You should only do this if you're managing your own game configurations.. + ''' Looks up a localized string similar to Do you want to sync your identifiers with this export file?[BR][BR]You should only do this if you're managing your own game configurations.. ''' Friend ReadOnly Property mgrMonitorList_ConfirmFileGameIDSync() As String Get @@ -5447,7 +5492,16 @@ Namespace My.Resources End Property ''' - ''' Looks up a localized string similar to Do you want to sync your local game ids with the official game list? (Recommended)[BR][BR]This allows you to easily keep your game configurations up to date if they change in the future.. + ''' Looks up a localized string similar to GBM now uses a unique identifier for each game. For the import feature to work as intended, your existing game configurations should use the same identifiers.[BR][BR]Do you want to sync your identifiers with the official list?[BR][BR]This warning will only be displayed once, but the option is available anytime from the "Tools" menu.. + ''' + Friend ReadOnly Property mgrMonitorList_ConfirmInitialOfficialGameIDSync() As String + Get + Return ResourceManager.GetString("mgrMonitorList_ConfirmInitialOfficialGameIDSync", resourceCulture) + End Get + End Property + + ''' + ''' Looks up a localized string similar to Do you want to sync your identifiers with the official game list?. ''' Friend ReadOnly Property mgrMonitorList_ConfirmOfficialGameIDSync() As String Get diff --git a/GBM/My Project/Resources.resx b/GBM/My Project/Resources.resx index 9848fc4..05992c3 100644 --- a/GBM/My Project/Resources.resx +++ b/GBM/My Project/Resources.resx @@ -2026,8 +2026,8 @@ Game ID - - Do you want to sync your local game ids with the official game list? (Recommended)[BR][BR]This allows you to easily keep your game configurations up to date if they change in the future. + + GBM now uses a unique identifier for each game. For the import feature to work as intended, your existing game configurations should use the same identifiers.[BR][BR]Do you want to sync your identifiers with the official list?[BR][BR]This warning will only be displayed once, but the option is available anytime from the "Tools" menu. This file cannot be used to sync game indentifiers. It was created with an older version of GBM. @@ -2036,6 +2036,24 @@ This export file was created with a version of GBM prior to 1.1.0 and does not contain unique game identifiers.[BR][BR]Do you still want to import configurations from this file? (Not Recommended) - Do you want to sync your local game ids with this export file? (Not Recommended) [BR][BR]You should only do this if you're managing your own game configurations. + Do you want to sync your identifiers with this export file?[BR][BR]You should only do this if you're managing your own game configurations. + + + S&ync Game IDs + + + &File... + + + &Official List... + + + Do you want to sync your identifiers with the official game list? + + + &Reset Warnings + + + Do you want to reset all hidden warnings and messages? \ No newline at end of file From 4caa2df312d5ee77726dd73789d657f44b44300a Mon Sep 17 00:00:00 2001 From: MikeMaximus Date: Mon, 5 Mar 2018 19:03:39 -0600 Subject: [PATCH 18/38] Fixed "Mark as Restored" functionality on Game Manager --- GBM/Forms/frmGameManager.vb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/GBM/Forms/frmGameManager.vb b/GBM/Forms/frmGameManager.vb index 18cce8b..25eaf32 100644 --- a/GBM/Forms/frmGameManager.vb +++ b/GBM/Forms/frmGameManager.vb @@ -1354,8 +1354,8 @@ Public Class frmGameManager If lstGames.SelectedItems.Count > 0 Then For Each oData In lstGames.SelectedItems - If oRemoteBackupData.Contains(oData.Value) Then - oGameBackup = DirectCast(oRemoteBackupData(oData.Value), clsBackup) + If oRemoteBackupData.Contains(oData.Key) Then + oGameBackup = DirectCast(oRemoteBackupData(oData.Key), clsBackup) oMarkList.Add(oGameBackup) End If Next From 5245cc3ab3412dcbb2bd33a47d827fcc9a670120 Mon Sep 17 00:00:00 2001 From: MikeMaximus Date: Mon, 5 Mar 2018 21:35:07 -0600 Subject: [PATCH 19/38] Fixed database upgrade errors --- GBM/Managers/mgrSQLite.vb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/GBM/Managers/mgrSQLite.vb b/GBM/Managers/mgrSQLite.vb index e9ee9b5..76f3a1f 100644 --- a/GBM/Managers/mgrSQLite.vb +++ b/GBM/Managers/mgrSQLite.vb @@ -772,13 +772,13 @@ Public Class mgrSQLite "DisableConfirmation BOOLEAN NOT NULL, CreateSubFolder BOOLEAN NOT NULL, ShowOverwriteWarning BOOLEAN NOT NULL, RestoreOnLaunch BOOLEAN NOT NULL, " & "BackupFolder TEXT NOT NULL, StartWithWindows BOOLEAN NOT NULL, TimeTracking BOOLEAN NOT NULL, " & "SupressBackup BOOLEAN NOT NULL, SupressBackupThreshold INTEGER NOT NULL, CompressionLevel INTEGER NOT NULL, Custom7zArguments TEXT, " & - "Custom7zLocation TEXT, SyncFields INTEGER NOT NULL, AutoSaveLog BOOLEAN NOT NULL, AutoRestore BOOLEAN NOT NULL, AutoMark BOOLEAN NOT NULL, SessionTracking BOOLEAN NOT NULL" & + "Custom7zLocation TEXT, SyncFields INTEGER NOT NULL, AutoSaveLog BOOLEAN NOT NULL, AutoRestore BOOLEAN NOT NULL, AutoMark BOOLEAN NOT NULL, SessionTracking BOOLEAN NOT NULL, " & "SupressMessages INTEGER NOT NULL);" sSQL &= "INSERT INTO settings_new(SettingsID, MonitorOnStartup, StartToTray, ShowDetectionToolTips, DisableConfirmation, CreateSubFolder, ShowOverwriteWarning, RestoreOnLaunch, " & "BackupFolder, StartWithWindows, TimeTracking, SupressBackup, SupressBackupThreshold, CompressionLevel, Custom7zArguments, Custom7zLocation, SyncFields, AutoSaveLog, " & - "AutoRestore, AutoMark, SessionTracking) SELECT SettingsID, MonitorOnStartup, StartToTray, ShowDetectionToolTips, DisableConfirmation, CreateSubFolder, ShowOverwriteWarning, RestoreOnLaunch, " & + "AutoRestore, AutoMark, SessionTracking, SupressMessages) SELECT SettingsID, MonitorOnStartup, StartToTray, ShowDetectionToolTips, DisableConfirmation, CreateSubFolder, ShowOverwriteWarning, RestoreOnLaunch, " & "BackupFolder, StartWithWindows, TimeTracking, SupressBackup, SupressBackupThreshold, CompressionLevel, Custom7zArguments, Custom7zLocation, SyncFields, AutoSaveLog, " & - "AutoRestore, AutoMark, SessionTracking FROM settings;" & + "AutoRestore, AutoMark, SessionTracking, 0 FROM settings;" & "DROP TABLE settings; ALTER TABLE settings_new RENAME TO settings;" sSQL &= "CREATE TABLE monitorlist_new (MonitorID TEXT NOT NULL PRIMARY KEY, Name TEXT NOT NULL, Process TEXT NOT NULL, Path TEXT, " & "AbsolutePath BOOLEAN NOT NULL, FolderSave BOOLEAN NOT NULL, FileType TEXT, TimeStamp BOOLEAN NOT NULL, ExcludeList TEXT NOT NULL, " & From afb479044c79af39de3e9ff14f924a962726cc29 Mon Sep 17 00:00:00 2001 From: MikeMaximus Date: Tue, 6 Mar 2018 10:02:15 -0600 Subject: [PATCH 20/38] Added icons to import --- GBM/Forms/frmAdvancedImport.vb | 12 +++++++++++- GBM/Game Backup Monitor.vbproj | 2 ++ GBM/My Project/Resources.Designer.vb | 20 ++++++++++++++++++++ GBM/My Project/Resources.resx | 6 ++++++ GBM/Resources/New.png | Bin 0 -> 926 bytes GBM/Resources/Update.png | Bin 0 -> 891 bytes GBM/readme.txt | 13 ++++++++++--- 7 files changed, 49 insertions(+), 4 deletions(-) create mode 100644 GBM/Resources/New.png create mode 100644 GBM/Resources/Update.png diff --git a/GBM/Forms/frmAdvancedImport.vb b/GBM/Forms/frmAdvancedImport.vb index 2ec181d..f9202e1 100644 --- a/GBM/Forms/frmAdvancedImport.vb +++ b/GBM/Forms/frmAdvancedImport.vb @@ -9,6 +9,7 @@ Public Class frmAdvancedImport Private bSelectAll As Boolean = True Private bIsLoading As Boolean = False Private iCurrentSort As Integer = 0 + Private oImageList As ImageList Private WithEvents tmFilterTimer As Timer Public Property ImportInfo As ExportData @@ -104,8 +105,10 @@ Public Class frmAdvancedImport End If If oApp.ImportUpdate Then - oListViewItem.ForeColor = Color.Red + oListViewItem.ImageIndex = 1 oListViewItem.Checked = True + Else + oListViewItem.ImageIndex = 0 End If If sFilter = String.Empty Then @@ -161,6 +164,13 @@ Public Class frmAdvancedImport btnImport.Text = frmAdvancedImport_btnImport chkSelectAll.Text = frmAdvancedImport_chkSelectAll + + 'Set Icons + oImageList = New ImageList() + oImageList.Images.Add(Icon_New) + oImageList.Images.Add(Icon_Update) + lstGames.SmallImageList = oImageList + chkSelectAll.Checked = True 'Init Filter Timer diff --git a/GBM/Game Backup Monitor.vbproj b/GBM/Game Backup Monitor.vbproj index 1384ed4..88a2cc1 100644 --- a/GBM/Game Backup Monitor.vbproj +++ b/GBM/Game Backup Monitor.vbproj @@ -365,6 +365,8 @@ PreserveNewest + + PreserveNewest diff --git a/GBM/My Project/Resources.Designer.vb b/GBM/My Project/Resources.Designer.vb index 353741e..f668fd2 100644 --- a/GBM/My Project/Resources.Designer.vb +++ b/GBM/My Project/Resources.Designer.vb @@ -5098,6 +5098,16 @@ Namespace My.Resources End Get End Property + ''' + ''' Looks up a localized resource of type System.Drawing.Bitmap. + ''' + Friend ReadOnly Property Icon_New() As System.Drawing.Bitmap + Get + Dim obj As Object = ResourceManager.GetObject("Icon_New", resourceCulture) + Return CType(obj,System.Drawing.Bitmap) + End Get + End Property + ''' ''' Looks up a localized resource of type System.Drawing.Bitmap. ''' @@ -5138,6 +5148,16 @@ Namespace My.Resources End Get End Property + ''' + ''' Looks up a localized resource of type System.Drawing.Bitmap. + ''' + Friend ReadOnly Property Icon_Update() As System.Drawing.Bitmap + Get + Dim obj As Object = ResourceManager.GetObject("Icon_Update", resourceCulture) + Return CType(obj,System.Drawing.Bitmap) + End Get + End Property + ''' ''' Looks up a localized resource of type System.Drawing.Bitmap. ''' diff --git a/GBM/My Project/Resources.resx b/GBM/My Project/Resources.resx index 05992c3..e5d5567 100644 --- a/GBM/My Project/Resources.resx +++ b/GBM/My Project/Resources.resx @@ -2056,4 +2056,10 @@ Do you want to reset all hidden warnings and messages? + + ..\Resources\New.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\Update.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + \ No newline at end of file diff --git a/GBM/Resources/New.png b/GBM/Resources/New.png new file mode 100644 index 0000000000000000000000000000000000000000..14d0fff80a6d0b85fd2c029290c5e5c03e957716 GIT binary patch literal 926 zcmV;P17ZA$P)NABt9hrcDisls06^rNtE2g1|EnK=xpVOGd-1rt%1wYT?_R#FQhw3QF1#|W zCx8eb1OrH22W#^iuRXu}^8xVZD8Q<${K(|E?*z4!5E%+X2D$~%nJnt6<|cP-1XT4v zi9P~|7)rTxL=v0=jm$TI-wEc0gVX- zC8+~(Mxh(wloXUFYl}~A-j=PWp1m|{rW7O~2}A@YMS0)wYLxY@x|vNL2Ik=*iGF_4 zi}vq7J(cg_0gxbv=W)A``TXSY%Mag<6@^F5#l79_3!m=Hnr;Y#K$6f|Y%}x9y__c5 z;@n@3ax%F%EpJ_F(sv*O5ksFcusyAsA0D(f0356UP0DwFU+~SNqJX3{0A)yF8>hht zKetSTV2*lnx5rgrP)7oEM{bGCw6_NAvfux0ZkR|wWPJw7V}{bN2bZY*GLjs6`E}w z*!O)EWd|=NkfK0S3af@NRyWn)lZg&bvFcRM&+v6Dv6+H9T!*ekBJOgP>*coaf!iUw=H&0>1M3*UzNs>~=ZZc|Dco>GB=c zVwl0(<8Py1eDu?2*YAzAEy9xOab!i}s=`o%WsS&r#Py_xBraYV5{lI%s=>0Y4fPR# ziXs~X)rt?y23JFx|6WDbEi$(%K-$PD;WB}TOecQlQ zMgxW|4kLJj9(yQyU5-8ibgd+GKUsf>{||t_0h1BCpEP)k3ONXp zoINNA20>I%4_*wSM%1v1q7cQP23Hnca@k$7>}dYXOn1HasyqaTfN?U(=xHse+k3yS zzt`181K-vxt9Njyy=QQ!eIdQxd>f8G8riTommBuenc<%MFE)HtVE4U|)hm`1F0{54 z!%V(4Ol6}BJr93h{Z)X6Z$B@tTUt1!GSRBP*oT*nptHGEDixmUzWuEDMS=USKh3un z^QXOZwsSOAFrq*LK!@I^F%-%lsDs9)0{)b+qOV6&6KZqp`!35hTP&h+$YD zehScG7cmYUd;F(r8fZ$T1NkWGeNzESRRNK$Z9^8s4o;^59rTXy65Qk%8x%SGMMECPAcMPY?p%o1Ill za$sVZ$@grk@wT(OI_@+)(w%4TZd_Ar=^J-}9w{Yo;t(4_Om()gV5fi}($3R;d(Pe6 z*pT6tll|ZCSiACaC6(>?qXIzr^ZKxz6`1lQs^g_0s+RZm|G53lXMyW`FSTu6v+R6J z?z^q8#vN>!fuGWFt}&Q`g0KOVr;tpIgR7MRA+vwrmz`rDYxK;9LPpb*w|`$#`oF<2 zlTE^WVYg04n>?>EODhDblpoOK`zw-ELt!dgE7b5Q-FoKUPpK$(LZ`E+e`2PiI4;9X zP5gZ8VCTutRq1*WakUzVA0qI>h73(?Kye(@tEme#hG7lE1>At&bUhPe!9ZexV}T=? zYx+=dAQmvm!hwlcSQ1#01`HLL1uV7+Lu27m0wICIT=%jA8v&bUfXuMO@M|M=b#F*v zfp8P=(2&3 Date: Tue, 6 Mar 2018 10:02:47 -0600 Subject: [PATCH 21/38] Added missing sync to tag updates --- GBM/Forms/frmGameManager.vb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/GBM/Forms/frmGameManager.vb b/GBM/Forms/frmGameManager.vb index 25eaf32..7b645ed 100644 --- a/GBM/Forms/frmGameManager.vb +++ b/GBM/Forms/frmGameManager.vb @@ -608,6 +608,9 @@ Public Class frmGameManager oTagsToSave = frm.TagList FillTagsbyList(frm.TagList) Else + 'Sync + mgrMonitorList.SyncMonitorLists(Settings.SyncFields) + 'Only update visible tags if one item is selected If lstGames.SelectedItems.Count = 1 Then FillTagsbyID(CurrentGame.ID) From ad538da1d1c49558af41e471ebb7db34cc2cb0cd Mon Sep 17 00:00:00 2001 From: MikeMaximus Date: Tue, 6 Mar 2018 10:18:08 -0600 Subject: [PATCH 22/38] Fixed some issues with game id sync --- GBM/Forms/frmMain.vb | 4 ++++ GBM/Managers/mgrMonitorList.vb | 2 ++ GBM/My Project/Resources.Designer.vb | 9 +++++++++ GBM/My Project/Resources.resx | 3 +++ 4 files changed, 18 insertions(+) diff --git a/GBM/Forms/frmMain.vb b/GBM/Forms/frmMain.vb index 9b1b4d1..865c4eb 100644 --- a/GBM/Forms/frmMain.vb +++ b/GBM/Forms/frmMain.vb @@ -991,6 +991,8 @@ Public Class frmMain Private Sub SyncGameIDs(ByVal bOfficial As Boolean) Dim sLocation As String + PauseScan() + If mgrCommon.IsUnix Then sLocation = App_URLImportLinux Else @@ -1006,6 +1008,8 @@ Public Class frmMain mgrMonitorList.SyncGameIDs(sLocation, oSettings, False) End If End If + + ResumeScan() End Sub Private Sub LocalDatabaseCheck() diff --git a/GBM/Managers/mgrMonitorList.vb b/GBM/Managers/mgrMonitorList.vb index 8a2afdd..f880b3e 100644 --- a/GBM/Managers/mgrMonitorList.vb +++ b/GBM/Managers/mgrMonitorList.vb @@ -960,6 +960,8 @@ Public Class mgrMonitorList Cursor.Current = Cursors.Default + mgrCommon.ShowMessage(mgrMonitorList_GameIDSyncCompleted, hshSyncIDs.Count.ToString, MsgBoxStyle.Information) + End Sub Public Shared Sub ExportMonitorList(ByVal sLocation As String) diff --git a/GBM/My Project/Resources.Designer.vb b/GBM/My Project/Resources.Designer.vb index f668fd2..64060b3 100644 --- a/GBM/My Project/Resources.Designer.vb +++ b/GBM/My Project/Resources.Designer.vb @@ -5556,6 +5556,15 @@ Namespace My.Resources End Get End Property + ''' + ''' Looks up a localized string similar to Sync Complete.[BR][BR][PARAM] game configurations were matched and updated.. + ''' + Friend ReadOnly Property mgrMonitorList_GameIDSyncCompleted() As String + Get + Return ResourceManager.GetString("mgrMonitorList_GameIDSyncCompleted", resourceCulture) + End Get + End Property + ''' ''' Looks up a localized string similar to Import Complete.. ''' diff --git a/GBM/My Project/Resources.resx b/GBM/My Project/Resources.resx index e5d5567..2cbe4a4 100644 --- a/GBM/My Project/Resources.resx +++ b/GBM/My Project/Resources.resx @@ -2062,4 +2062,7 @@ ..\Resources\Update.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + Sync Complete.[BR][BR][PARAM] game configurations were matched and updated. + \ No newline at end of file From ebc185d7b8f10549bb206116ef8dac204094a527 Mon Sep 17 00:00:00 2001 From: MikeMaximus Date: Tue, 6 Mar 2018 10:24:12 -0600 Subject: [PATCH 23/38] Disable game id sync message when database is new --- GBM/Managers/mgrSettings.vb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/GBM/Managers/mgrSettings.vb b/GBM/Managers/mgrSettings.vb index 856798f..5afdc02 100644 --- a/GBM/Managers/mgrSettings.vb +++ b/GBM/Managers/mgrSettings.vb @@ -265,6 +265,11 @@ Public Class mgrSettings End Set End Property + Sub New() + 'The GameIDsync message should be supressed on all new databases + SetMessageField(SupressMessages, eSupressMessages.GameIDSync) + End Sub + Private Sub SaveFromClass() Dim oDatabase As New mgrSQLite(mgrSQLite.Database.Local) Dim sSQL As String From b9244eeeaed79e6e074b68e9d3ca6c939ede4d43 Mon Sep 17 00:00:00 2001 From: MikeMaximus Date: Tue, 6 Mar 2018 13:19:47 -0600 Subject: [PATCH 24/38] Added "Backup GBM data files on launch" feature --- GBM/Forms/frmMain.vb | 12 +++++++++ GBM/Forms/frmSettings.Designer.vb | 39 ++++++++++++++++++---------- GBM/Forms/frmSettings.vb | 3 +++ GBM/Managers/mgrSQLite.vb | 16 ++++++------ GBM/Managers/mgrSettings.vb | 14 +++++++++- GBM/My Project/Resources.Designer.vb | 18 +++++++++++++ GBM/My Project/Resources.resx | 6 +++++ GBM/readme.txt | 10 ++++--- 8 files changed, 92 insertions(+), 26 deletions(-) diff --git a/GBM/Forms/frmMain.vb b/GBM/Forms/frmMain.vb index 865c4eb..f4784eb 100644 --- a/GBM/Forms/frmMain.vb +++ b/GBM/Forms/frmMain.vb @@ -1022,6 +1022,13 @@ Public Class frmMain oRemoteDatabase.DatabaseUpgrade() End Sub + Private Sub BackupDatabases() + Dim oLocalDatabase As New mgrSQLite(mgrSQLite.Database.Local) + Dim oRemoteDatabase As New mgrSQLite(mgrSQLite.Database.Remote) + oLocalDatabase.BackupDB(App_BackupOnLaunchFileDescription, True) + oRemoteDatabase.BackupDB(App_BackupOnLaunchFileDescription, True) + End Sub + Private Sub LoadAndVerify() 'If the default utility is missing we cannot continue @@ -1051,6 +1058,11 @@ Public Class frmMain VerifyDBVersion(mgrSQLite.Database.Remote) RemoteDatabaseCheck() + 'Backup GBM data + If oSettings.BackupOnLaunch Then + BackupDatabases() + End If + 'Sync Game Settings SyncGameSettings() End If diff --git a/GBM/Forms/frmSettings.Designer.vb b/GBM/Forms/frmSettings.Designer.vb index a51ba5a..336c32e 100644 --- a/GBM/Forms/frmSettings.Designer.vb +++ b/GBM/Forms/frmSettings.Designer.vb @@ -66,6 +66,7 @@ Partial Class frmSettings Me.chkSessionTracking = New System.Windows.Forms.CheckBox() Me.lstSettings = New System.Windows.Forms.ListBox() Me.btnResetMessages = New System.Windows.Forms.Button() + Me.chkBackupOnLaunch = New System.Windows.Forms.CheckBox() Me.grpStartup.SuspendLayout() Me.grpFolderOptions.SuspendLayout() Me.grp7zGeneral.SuspendLayout() @@ -84,19 +85,20 @@ Partial Class frmSettings Me.chkMonitorOnStartup.AutoSize = True Me.chkMonitorOnStartup.Location = New System.Drawing.Point(6, 65) Me.chkMonitorOnStartup.Name = "chkMonitorOnStartup" - Me.chkMonitorOnStartup.Size = New System.Drawing.Size(146, 17) + Me.chkMonitorOnStartup.Size = New System.Drawing.Size(149, 17) Me.chkMonitorOnStartup.TabIndex = 2 - Me.chkMonitorOnStartup.Text = "Start monitoring at launch" + Me.chkMonitorOnStartup.Text = "Start monitoring on launch" Me.chkMonitorOnStartup.UseVisualStyleBackColor = True ' 'grpStartup ' + Me.grpStartup.Controls.Add(Me.chkBackupOnLaunch) Me.grpStartup.Controls.Add(Me.chkStartWindows) Me.grpStartup.Controls.Add(Me.chkStartToTray) Me.grpStartup.Controls.Add(Me.chkMonitorOnStartup) Me.grpStartup.Location = New System.Drawing.Point(6, 12) Me.grpStartup.Name = "grpStartup" - Me.grpStartup.Size = New System.Drawing.Size(354, 90) + Me.grpStartup.Size = New System.Drawing.Size(354, 112) Me.grpStartup.TabIndex = 0 Me.grpStartup.TabStop = False Me.grpStartup.Text = "Startup" @@ -124,7 +126,7 @@ Partial Class frmSettings 'chkAutoSaveLog ' Me.chkAutoSaveLog.AutoSize = True - Me.chkAutoSaveLog.Location = New System.Drawing.Point(12, 262) + Me.chkAutoSaveLog.Location = New System.Drawing.Point(12, 280) Me.chkAutoSaveLog.Name = "chkAutoSaveLog" Me.chkAutoSaveLog.Size = New System.Drawing.Size(231, 17) Me.chkAutoSaveLog.TabIndex = 5 @@ -133,7 +135,7 @@ Partial Class frmSettings ' 'btnOptionalFields ' - Me.btnOptionalFields.Location = New System.Drawing.Point(5, 65) + Me.btnOptionalFields.Location = New System.Drawing.Point(6, 65) Me.btnOptionalFields.Name = "btnOptionalFields" Me.btnOptionalFields.Size = New System.Drawing.Size(216, 23) Me.btnOptionalFields.TabIndex = 3 @@ -153,7 +155,7 @@ Partial Class frmSettings 'chkShowDetectionTips ' Me.chkShowDetectionTips.AutoSize = True - Me.chkShowDetectionTips.Location = New System.Drawing.Point(12, 239) + Me.chkShowDetectionTips.Location = New System.Drawing.Point(12, 257) Me.chkShowDetectionTips.Name = "chkShowDetectionTips" Me.chkShowDetectionTips.Size = New System.Drawing.Size(159, 17) Me.chkShowDetectionTips.TabIndex = 4 @@ -214,7 +216,7 @@ Partial Class frmSettings Me.btnSave.Location = New System.Drawing.Point(384, 321) Me.btnSave.Name = "btnSave" Me.btnSave.Size = New System.Drawing.Size(75, 23) - Me.btnSave.TabIndex = 5 + Me.btnSave.TabIndex = 6 Me.btnSave.Text = "&Save" Me.btnSave.UseVisualStyleBackColor = True ' @@ -224,7 +226,7 @@ Partial Class frmSettings Me.btnCancel.Location = New System.Drawing.Point(465, 321) Me.btnCancel.Name = "btnCancel" Me.btnCancel.Size = New System.Drawing.Size(75, 23) - Me.btnCancel.TabIndex = 6 + Me.btnCancel.TabIndex = 7 Me.btnCancel.Text = "&Cancel" Me.btnCancel.UseVisualStyleBackColor = True ' @@ -454,7 +456,7 @@ Partial Class frmSettings 'lblMinutes ' Me.lblMinutes.AutoSize = True - Me.lblMinutes.Location = New System.Drawing.Point(232, 216) + Me.lblMinutes.Location = New System.Drawing.Point(232, 234) Me.lblMinutes.Name = "lblMinutes" Me.lblMinutes.Size = New System.Drawing.Size(43, 13) Me.lblMinutes.TabIndex = 17 @@ -462,7 +464,7 @@ Partial Class frmSettings ' 'nudSupressBackupThreshold ' - Me.nudSupressBackupThreshold.Location = New System.Drawing.Point(176, 214) + Me.nudSupressBackupThreshold.Location = New System.Drawing.Point(176, 232) Me.nudSupressBackupThreshold.Maximum = New Decimal(New Integer() {999, 0, 0, 0}) Me.nudSupressBackupThreshold.Name = "nudSupressBackupThreshold" Me.nudSupressBackupThreshold.Size = New System.Drawing.Size(51, 20) @@ -471,7 +473,7 @@ Partial Class frmSettings 'chkSupressBackup ' Me.chkSupressBackup.AutoSize = True - Me.chkSupressBackup.Location = New System.Drawing.Point(12, 215) + Me.chkSupressBackup.Location = New System.Drawing.Point(12, 233) Me.chkSupressBackup.Name = "chkSupressBackup" Me.chkSupressBackup.Size = New System.Drawing.Size(158, 17) Me.chkSupressBackup.TabIndex = 2 @@ -483,7 +485,7 @@ Partial Class frmSettings Me.grpGameData.Controls.Add(Me.chkSessionTracking) Me.grpGameData.Controls.Add(Me.chkTimeTracking) Me.grpGameData.Controls.Add(Me.btnOptionalFields) - Me.grpGameData.Location = New System.Drawing.Point(6, 106) + Me.grpGameData.Location = New System.Drawing.Point(6, 130) Me.grpGameData.Name = "grpGameData" Me.grpGameData.Size = New System.Drawing.Size(354, 97) Me.grpGameData.TabIndex = 1 @@ -513,10 +515,20 @@ Partial Class frmSettings Me.btnResetMessages.Location = New System.Drawing.Point(128, 321) Me.btnResetMessages.Name = "btnResetMessages" Me.btnResetMessages.Size = New System.Drawing.Size(110, 23) - Me.btnResetMessages.TabIndex = 7 + Me.btnResetMessages.TabIndex = 5 Me.btnResetMessages.Text = "&Reset Warnings" Me.btnResetMessages.UseVisualStyleBackColor = True ' + 'chkBackupOnLaunch + ' + Me.chkBackupOnLaunch.AutoSize = True + Me.chkBackupOnLaunch.Location = New System.Drawing.Point(6, 88) + Me.chkBackupOnLaunch.Name = "chkBackupOnLaunch" + Me.chkBackupOnLaunch.Size = New System.Drawing.Size(185, 17) + Me.chkBackupOnLaunch.TabIndex = 3 + Me.chkBackupOnLaunch.Text = "Backup GBM data files on launch" + Me.chkBackupOnLaunch.UseVisualStyleBackColor = True + ' 'frmSettings ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) @@ -604,4 +616,5 @@ Partial Class frmSettings Friend WithEvents nudSupressBackupThreshold As NumericUpDown Friend WithEvents chkSupressBackup As CheckBox Friend WithEvents btnResetMessages As Button + Friend WithEvents chkBackupOnLaunch As CheckBox End Class diff --git a/GBM/Forms/frmSettings.vb b/GBM/Forms/frmSettings.vb index 4325b16..7f01dae 100644 --- a/GBM/Forms/frmSettings.vb +++ b/GBM/Forms/frmSettings.vb @@ -47,6 +47,7 @@ Public Class frmSettings oSettings.MonitorOnStartup = chkMonitorOnStartup.Checked oSettings.StartToTray = chkStartToTray.Checked + oSettings.BackupOnLaunch = chkBackupOnLaunch.Checked oSettings.ShowDetectionToolTips = chkShowDetectionTips.Checked oSettings.AutoSaveLog = chkAutoSaveLog.Checked oSettings.DisableConfirmation = chkBackupConfirm.Checked @@ -172,6 +173,7 @@ Public Class frmSettings chkStartWindows.Checked = oSettings.StartWithWindows chkMonitorOnStartup.Checked = oSettings.MonitorOnStartup chkStartToTray.Checked = oSettings.StartToTray + chkBackupOnLaunch.Checked = oSettings.BackupOnLaunch chkShowDetectionTips.Checked = oSettings.ShowDetectionToolTips chkAutoSaveLog.Checked = oSettings.AutoSaveLog chkBackupConfirm.Checked = oSettings.DisableConfirmation @@ -300,6 +302,7 @@ Public Class frmSettings lblLocation.Text = frmSettings_lblLocation btnOptionalFields.Text = frmSettings_btnOptionalFields btnResetMessages.Text = frmSettings_btnResetMessages + chkBackupOnLaunch.Text = frmSettings_chkBackupOnLaunch 'Unix Handler If mgrCommon.IsUnix Then diff --git a/GBM/Managers/mgrSQLite.vb b/GBM/Managers/mgrSQLite.vb index 76f3a1f..3794143 100644 --- a/GBM/Managers/mgrSQLite.vb +++ b/GBM/Managers/mgrSQLite.vb @@ -27,17 +27,17 @@ Public Class mgrSQLite End Select End Sub - Private Sub BackupDB(ByVal sLastVer As String) + Public Sub BackupDB(ByVal sDescription As String, Optional ByVal bOverwrite As Boolean = False) Dim sNewFile As String = String.Empty Try Select Case eDatabase Case Database.Local - sNewFile = mgrPath.DatabaseLocation & "." & sLastVer & ".bak" - File.Copy(mgrPath.DatabaseLocation, sNewFile, False) + sNewFile = mgrPath.DatabaseLocation & "." & sDescription & ".bak" + File.Copy(mgrPath.DatabaseLocation, sNewFile, bOverwrite) Case Database.Remote - sNewFile = mgrPath.RemoteDatabaseLocation & "." & sLastVer & ".bak" - File.Copy(mgrPath.RemoteDatabaseLocation, sNewFile, False) + sNewFile = mgrPath.RemoteDatabaseLocation & "." & sDescription & ".bak" + File.Copy(mgrPath.RemoteDatabaseLocation, sNewFile, bOverwrite) End Select Catch ex As Exception mgrCommon.ShowMessage(mgrSQLite_ErrorBackupFailure, New String() {sNewFile, ex.Message}, MsgBoxStyle.Exclamation) @@ -75,7 +75,7 @@ Public Class mgrSQLite "BackupFolder TEXT NOT NULL, StartWithWindows BOOLEAN NOT NULL, TimeTracking BOOLEAN NOT NULL, " & "SupressBackup BOOLEAN NOT NULL, SupressBackupThreshold INTEGER NOT NULL, CompressionLevel INTEGER NOT NULL, Custom7zArguments TEXT, " & "Custom7zLocation TEXT, SyncFields INTEGER NOT NULL, AutoSaveLog BOOLEAN NOT NULL, AutoRestore BOOLEAN NOT NULL, AutoMark BOOLEAN NOT NULL, SessionTracking BOOLEAN NOT NULL, " & - "SupressMessages INTEGER NOT NULL);" + "SupressMessages INTEGER NOT NULL, BackupOnLaunch BOOLEAN NOT NULL);" 'Add Tables (SavedPath) sSql &= "CREATE TABLE savedpath (PathName TEXT NOT NULL PRIMARY KEY, Path TEXT NOT NULL);" @@ -773,12 +773,12 @@ Public Class mgrSQLite "BackupFolder TEXT NOT NULL, StartWithWindows BOOLEAN NOT NULL, TimeTracking BOOLEAN NOT NULL, " & "SupressBackup BOOLEAN NOT NULL, SupressBackupThreshold INTEGER NOT NULL, CompressionLevel INTEGER NOT NULL, Custom7zArguments TEXT, " & "Custom7zLocation TEXT, SyncFields INTEGER NOT NULL, AutoSaveLog BOOLEAN NOT NULL, AutoRestore BOOLEAN NOT NULL, AutoMark BOOLEAN NOT NULL, SessionTracking BOOLEAN NOT NULL, " & - "SupressMessages INTEGER NOT NULL);" + "SupressMessages INTEGER NOT NULL, BackupOnLaunch BOOLEAN NOT NULL);" sSQL &= "INSERT INTO settings_new(SettingsID, MonitorOnStartup, StartToTray, ShowDetectionToolTips, DisableConfirmation, CreateSubFolder, ShowOverwriteWarning, RestoreOnLaunch, " & "BackupFolder, StartWithWindows, TimeTracking, SupressBackup, SupressBackupThreshold, CompressionLevel, Custom7zArguments, Custom7zLocation, SyncFields, AutoSaveLog, " & "AutoRestore, AutoMark, SessionTracking, SupressMessages) SELECT SettingsID, MonitorOnStartup, StartToTray, ShowDetectionToolTips, DisableConfirmation, CreateSubFolder, ShowOverwriteWarning, RestoreOnLaunch, " & "BackupFolder, StartWithWindows, TimeTracking, SupressBackup, SupressBackupThreshold, CompressionLevel, Custom7zArguments, Custom7zLocation, SyncFields, AutoSaveLog, " & - "AutoRestore, AutoMark, SessionTracking, 0 FROM settings;" & + "AutoRestore, AutoMark, SessionTracking, 0, 1 FROM settings;" & "DROP TABLE settings; ALTER TABLE settings_new RENAME TO settings;" sSQL &= "CREATE TABLE monitorlist_new (MonitorID TEXT NOT NULL PRIMARY KEY, Name TEXT NOT NULL, Process TEXT NOT NULL, Path TEXT, " & "AbsolutePath BOOLEAN NOT NULL, FolderSave BOOLEAN NOT NULL, FileType TEXT, TimeStamp BOOLEAN NOT NULL, ExcludeList TEXT NOT NULL, " & diff --git a/GBM/Managers/mgrSettings.vb b/GBM/Managers/mgrSettings.vb index 5afdc02..84f1d4d 100644 --- a/GBM/Managers/mgrSettings.vb +++ b/GBM/Managers/mgrSettings.vb @@ -22,6 +22,7 @@ Public Class mgrSettings Private eSyncFields As clsGame.eOptionalSyncFields = clsGame.eOptionalSyncFields.None Or clsGame.eOptionalSyncFields.TimeStamp Private eMessages As eSupressMessages = eSupressMessages.None Private bAutoSaveLog As Boolean = False + Private bBackupOnLaunch As Boolean = True Public Enum eSupressMessages None = 0 @@ -265,6 +266,15 @@ Public Class mgrSettings End Set End Property + Property BackupOnLaunch As Boolean + Get + Return bBackupOnLaunch + End Get + Set(value As Boolean) + bBackupOnLaunch = value + End Set + End Property + Sub New() 'The GameIDsync message should be supressed on all new databases SetMessageField(SupressMessages, eSupressMessages.GameIDSync) @@ -281,7 +291,7 @@ Public Class mgrSettings sSQL = "INSERT INTO settings VALUES (1, @MonitorOnStartup, @StartToTray, @ShowDetectionToolTips, @DisableConfirmation, " sSQL &= "@CreateSubFolder, @ShowOverwriteWarning, @RestoreOnLaunch, @BackupFolder, @StartWithWindows, " sSQL &= "@TimeTracking, @SupressBackup, @SupressBackupThreshold, @CompressionLevel, @Custom7zArguments, @Custom7zLocation, " - sSQL &= "@SyncFields, @AutoSaveLog, @AutoRestore, @AutoMark, @SessionTracking, @SupressMessages)" + sSQL &= "@SyncFields, @AutoSaveLog, @AutoRestore, @AutoMark, @SessionTracking, @SupressMessages, @BackupOnLaunch)" hshParams.Add("MonitorOnStartup", MonitorOnStartup) hshParams.Add("StartToTray", StartToTray) @@ -304,6 +314,7 @@ Public Class mgrSettings hshParams.Add("AutoMark", AutoMark) hshParams.Add("SessionTracking", SessionTracking) hshParams.Add("SupressMessages", SupressMessages) + hshParams.Add("BackupOnLaunch", BackupOnLaunch) oDatabase.RunParamQuery(sSQL, hshParams) End Sub @@ -339,6 +350,7 @@ Public Class mgrSettings AutoMark = CBool(dr("AutoMark")) SessionTracking = CBool(dr("SessionTracking")) SupressMessages = CInt(dr("SupressMessages")) + BackupOnLaunch = CBool(dr("BackupOnLaunch")) Next oDatabase.Disconnect() diff --git a/GBM/My Project/Resources.Designer.vb b/GBM/My Project/Resources.Designer.vb index 64060b3..71c67f4 100644 --- a/GBM/My Project/Resources.Designer.vb +++ b/GBM/My Project/Resources.Designer.vb @@ -60,6 +60,15 @@ Namespace My.Resources End Set End Property + ''' + ''' Looks up a localized string similar to launch. + ''' + Friend ReadOnly Property App_BackupOnLaunchFileDescription() As String + Get + Return ResourceManager.GetString("App_BackupOnLaunchFileDescription", resourceCulture) + End Get + End Property + ''' ''' Looks up a localized string similar to There are unsaved changes on this form. Do you want to save?. ''' @@ -4155,6 +4164,15 @@ Namespace My.Resources End Get End Property + ''' + ''' Looks up a localized string similar to Backup GBM data files on launch. + ''' + Friend ReadOnly Property frmSettings_chkBackupOnLaunch() As String + Get + Return ResourceManager.GetString("frmSettings_chkBackupOnLaunch", resourceCulture) + End Get + End Property + ''' ''' Looks up a localized string similar to Create a sub-folder for each game. ''' diff --git a/GBM/My Project/Resources.resx b/GBM/My Project/Resources.resx index 2cbe4a4..15ec306 100644 --- a/GBM/My Project/Resources.resx +++ b/GBM/My Project/Resources.resx @@ -2065,4 +2065,10 @@ Sync Complete.[BR][BR][PARAM] game configurations were matched and updated. + + launch + + + Backup GBM data files on launch + \ No newline at end of file diff --git a/GBM/readme.txt b/GBM/readme.txt index 74ad610..c28c7d1 100644 --- a/GBM/readme.txt +++ b/GBM/readme.txt @@ -8,9 +8,9 @@ New in 1.1.0 Disclaimer: -Version 1.1.0 makes fundamental changes to how GBM works with game configurations and backup data. Please read the changes below carefully. +Version 1.1.0 makes fundamental changes to how GBM works with game configurations and backup data, in addition to many other changes. Please read the changes below carefully before upgrading. -I've done my best to make sure the upgrade process is seamless and allows everyone to continue using their existing data and configurations. +I've done my best to make sure the upgrade process allows everyone to continue using their existing data and configurations. All Platforms: @@ -21,7 +21,10 @@ All Platforms: - Game Name can now contain any character. - When a game is deleted via Game Manager (or sync), all backup manifest entries for that particular game are now deleted. The backup files themselves are not. - The Game Manager now syncs changes to the remote database immediately, instead of only when closed. -- Core Design Changes (Features) +- Feature Changes + - Added "Backup GBM data files on launch" to the settings. A long overdue feature, this will backup both the remote and local databases (as gbm.s3db.launch.bak) each time GBM starts. + - This new setting is enabled by default. + - Only one backup is kept, the prior one will be overwritten. - Added the ability to display messages that can be supressed. These messages can be reset via the Settings screen. - The "Enable Sync" feature is now mandatory and the option been removed from Settings. - The "Clean Local Manifest" feature has been removed. It is not required because manfiest entries are no longer orphaned by design. Existing orphaned entries will be removed during the v1.1.0 database upgrade. @@ -55,6 +58,5 @@ Known Issues: - If one or more Game IDs are changed on one computer and these changes are synced to another PC sharing the same backup folder: - The local session data on that PC for the changed game(s) will be lost. - The local backup manifest data for the changed game(s) on that PC will be reset. GBM will see any backups for the changed game(s) as new and will handle them accordingly. -- If the "Create a sub-folder..." option is enabled, GBM may leave empty folders when backups are updated or deleted. This only only applies to folders created with a prior version of GBM. The entire version history of GBM releases is available at http://mikemaximus.github.io/gbm-web/versionhistory.html \ No newline at end of file From 743055114535a4350a023efe7a86ad88aa4355ac Mon Sep 17 00:00:00 2001 From: MikeMaximus Date: Tue, 6 Mar 2018 13:49:24 -0600 Subject: [PATCH 25/38] Added a known issue to readme.txt --- GBM/readme.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/GBM/readme.txt b/GBM/readme.txt index c28c7d1..0902555 100644 --- a/GBM/readme.txt +++ b/GBM/readme.txt @@ -58,5 +58,9 @@ Known Issues: - If one or more Game IDs are changed on one computer and these changes are synced to another PC sharing the same backup folder: - The local session data on that PC for the changed game(s) will be lost. - The local backup manifest data for the changed game(s) on that PC will be reset. GBM will see any backups for the changed game(s) as new and will handle them accordingly. +- Backup files made prior to v1.1.0 are not being renamed or removed when a new backup is created. + - This is due to file name now being generated by the Game ID and not the name. + - Only backups made prior to v1.1.0 are affected by this issue. + - After new backup files are created, these files can be deleted at the user's discretion. The entire version history of GBM releases is available at http://mikemaximus.github.io/gbm-web/versionhistory.html \ No newline at end of file From c6ded1a34936584ce2cf7ff7613894f3a66541f1 Mon Sep 17 00:00:00 2001 From: MikeMaximus Date: Wed, 7 Mar 2018 09:40:49 -0600 Subject: [PATCH 26/38] Updated readme.txt with another known issue --- GBM/readme.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/GBM/readme.txt b/GBM/readme.txt index 0902555..0753b4d 100644 --- a/GBM/readme.txt +++ b/GBM/readme.txt @@ -2,7 +2,7 @@ Game Backup Monitor v1.1.0 Readme http://mikemaximus.github.io/gbm-web/ gamebackupmonitor@gmail.com -March 3rd, 2018 +March 7th, 2018 New in 1.1.0 @@ -62,5 +62,8 @@ Known Issues: - This is due to file name now being generated by the Game ID and not the name. - Only backups made prior to v1.1.0 are affected by this issue. - After new backup files are created, these files can be deleted at the user's discretion. +- Configurations on the official game list are no longer fully compatible with older GBM versions. + - Technically they will work. But any game imported with a special character in it's name, such as a colon, will not create backup files correctly. + - These characters can be manually removed from the game name after importing, then the configurations will function properly. The entire version history of GBM releases is available at http://mikemaximus.github.io/gbm-web/versionhistory.html \ No newline at end of file From 259cc2c5dd529637b4fdde542e9feacfbeb3e87c Mon Sep 17 00:00:00 2001 From: MikeMaximus Date: Wed, 7 Mar 2018 10:03:44 -0600 Subject: [PATCH 27/38] Removed unrequired parameter validation --- GBM/Forms/frmGameManager.vb | 7 ------- GBM/Managers/mgrMonitorList.vb | 25 ------------------------- GBM/My Project/Resources.Designer.vb | 9 --------- GBM/My Project/Resources.resx | 3 --- 4 files changed, 44 deletions(-) diff --git a/GBM/Forms/frmGameManager.vb b/GBM/Forms/frmGameManager.vb index 7b645ed..f1fb9c2 100644 --- a/GBM/Forms/frmGameManager.vb +++ b/GBM/Forms/frmGameManager.vb @@ -1330,13 +1330,6 @@ Public Class frmGameManager Return False End If - If oApp.Parameter <> String.Empty Then - If mgrMonitorList.DoDuplicateParameterCheck(oApp.ProcessName, oApp.Parameter, , sCurrentID) Then - mgrCommon.ShowMessage(frmGameManager_ErrorProcessParameterDupe, MsgBoxStyle.Exclamation) - Return False - End If - End If - If oApp.IsRegEx Then If Not mgrCommon.IsRegExValid(oApp.ProcessName) Then If mgrCommon.ShowMessage(frmGameManager_ErrorRegExFailure, MsgBoxStyle.Exclamation, MsgBoxStyle.YesNoCancel) = MsgBoxResult.Yes Then diff --git a/GBM/Managers/mgrMonitorList.vb b/GBM/Managers/mgrMonitorList.vb index f880b3e..353f2fc 100644 --- a/GBM/Managers/mgrMonitorList.vb +++ b/GBM/Managers/mgrMonitorList.vb @@ -341,31 +341,6 @@ Public Class mgrMonitorList End If End Function - Public Shared Function DoDuplicateParameterCheck(ByVal sProcess As String, ByVal sParameter As String, Optional ByVal iSelectDB As mgrSQLite.Database = mgrSQLite.Database.Local, Optional ByVal sExcludeID As String = "") As Boolean - Dim oDatabase As New mgrSQLite(iSelectDB) - Dim sSQL As String - Dim oData As DataSet - Dim hshParams As New Hashtable - - sSQL = "SELECT * FROM monitorlist WHERE Process = @Process AND Parameter = @Parameter" - - hshParams.Add("Process", sProcess) - hshParams.Add("Parameter", sParameter) - - If sExcludeID <> String.Empty Then - sSQL &= " AND MonitorID <> @MonitorID" - hshParams.Add("MonitorID", sExcludeID) - End If - - oData = oDatabase.ReadParamData(sSQL, hshParams) - - If oData.Tables(0).Rows.Count > 0 Then - Return True - Else - Return False - End If - End Function - 'Sync Functions Public Shared Sub DoListAddUpdateSync(ByVal hshGames As Hashtable, Optional ByVal iSelectDB As mgrSQLite.Database = mgrSQLite.Database.Local, Optional ByVal eSyncFields As clsGame.eOptionalSyncFields = clsGame.eOptionalSyncFields.None) diff --git a/GBM/My Project/Resources.Designer.vb b/GBM/My Project/Resources.Designer.vb index 71c67f4..77f5fb0 100644 --- a/GBM/My Project/Resources.Designer.vb +++ b/GBM/My Project/Resources.Designer.vb @@ -1995,15 +1995,6 @@ Namespace My.Resources End Get End Property - ''' - ''' Looks up a localized string similar to A game with this exact process and parameter already exists.. - ''' - Friend ReadOnly Property frmGameManager_ErrorProcessParameterDupe() As String - Get - Return ResourceManager.GetString("frmGameManager_ErrorProcessParameterDupe", resourceCulture) - End Get - End Property - ''' ''' Looks up a localized string similar to The process is not a a valid regular expression.[BR][BR]Would you like help validating and testing your regular expression? [BR][BR]This will open your web browser and requires the internet.. ''' diff --git a/GBM/My Project/Resources.resx b/GBM/My Project/Resources.resx index 15ec306..23a0358 100644 --- a/GBM/My Project/Resources.resx +++ b/GBM/My Project/Resources.resx @@ -1768,9 +1768,6 @@ Parameter: - - A game with this exact process and parameter already exists. - [PARAM] B From 9807094af6e32345474d25e13f3325b48ed34bce Mon Sep 17 00:00:00 2001 From: MikeMaximus Date: Wed, 7 Mar 2018 12:41:21 -0600 Subject: [PATCH 28/38] Fixed database upgrade issue --- GBM/Managers/mgrSQLite.vb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GBM/Managers/mgrSQLite.vb b/GBM/Managers/mgrSQLite.vb index 3794143..667b692 100644 --- a/GBM/Managers/mgrSQLite.vb +++ b/GBM/Managers/mgrSQLite.vb @@ -776,7 +776,7 @@ Public Class mgrSQLite "SupressMessages INTEGER NOT NULL, BackupOnLaunch BOOLEAN NOT NULL);" sSQL &= "INSERT INTO settings_new(SettingsID, MonitorOnStartup, StartToTray, ShowDetectionToolTips, DisableConfirmation, CreateSubFolder, ShowOverwriteWarning, RestoreOnLaunch, " & "BackupFolder, StartWithWindows, TimeTracking, SupressBackup, SupressBackupThreshold, CompressionLevel, Custom7zArguments, Custom7zLocation, SyncFields, AutoSaveLog, " & - "AutoRestore, AutoMark, SessionTracking, SupressMessages) SELECT SettingsID, MonitorOnStartup, StartToTray, ShowDetectionToolTips, DisableConfirmation, CreateSubFolder, ShowOverwriteWarning, RestoreOnLaunch, " & + "AutoRestore, AutoMark, SessionTracking, SupressMessages, BackupOnLaunch) SELECT SettingsID, MonitorOnStartup, StartToTray, ShowDetectionToolTips, DisableConfirmation, CreateSubFolder, ShowOverwriteWarning, RestoreOnLaunch, " & "BackupFolder, StartWithWindows, TimeTracking, SupressBackup, SupressBackupThreshold, CompressionLevel, Custom7zArguments, Custom7zLocation, SyncFields, AutoSaveLog, " & "AutoRestore, AutoMark, SessionTracking, 0, 1 FROM settings;" & "DROP TABLE settings; ALTER TABLE settings_new RENAME TO settings;" From 6461c80ae0be276fa8c653d16b9154d782ea1dfc Mon Sep 17 00:00:00 2001 From: MikeMaximus Date: Thu, 8 Mar 2018 09:04:48 -0600 Subject: [PATCH 29/38] Updated import/id sync error handling and messaging --- GBM/Managers/mgrMonitorList.vb | 12 ++++++++---- GBM/Managers/mgrXML.vb | 21 +++++++++++---------- GBM/My Project/Resources.Designer.vb | 6 +++--- GBM/My Project/Resources.resx | 6 +++--- 4 files changed, 25 insertions(+), 20 deletions(-) diff --git a/GBM/Managers/mgrMonitorList.vb b/GBM/Managers/mgrMonitorList.vb index 353f2fc..eb17a5b 100644 --- a/GBM/Managers/mgrMonitorList.vb +++ b/GBM/Managers/mgrMonitorList.vb @@ -818,7 +818,7 @@ Public Class mgrMonitorList End Function Private Shared Sub ImportMonitorList(ByVal sLocation As String, Optional ByVal bWebRead As Boolean = False) - Dim hshCompareFrom As Hashtable + Dim hshCompareFrom As New Hashtable Dim hshCompareTo As Hashtable Dim hshSyncItems As Hashtable Dim oFromItem As clsGame @@ -827,7 +827,9 @@ Public Class mgrMonitorList Cursor.Current = Cursors.WaitCursor - hshCompareFrom = mgrXML.ReadMonitorList(sLocation, oExportInfo, bWebRead) + If Not mgrXML.ReadMonitorList(sLocation, oExportInfo, hshCompareFrom, bWebRead) Then + Exit Sub + End If If oExportInfo.AppVer < 110 Then If mgrCommon.ShowMessage(mgrMonitorList_ImportVersionWarning, MsgBoxStyle.YesNo) = MsgBoxResult.No Then @@ -884,7 +886,7 @@ Public Class mgrMonitorList Dim sSQL As String Dim hshParams As Hashtable Dim oParamList As New List(Of Hashtable) - Dim hshCompareFrom As Hashtable + Dim hshCompareFrom As New Hashtable Dim hshCompareTo As Hashtable Dim hshSyncIDs As New Hashtable Dim oFromItem As clsGame @@ -893,7 +895,9 @@ Public Class mgrMonitorList Cursor.Current = Cursors.WaitCursor - hshCompareFrom = mgrXML.ReadMonitorList(sLocation, oExportInfo, bWebRead) + If Not mgrXML.ReadMonitorList(sLocation, oExportInfo, hshCompareFrom, bWebRead) Then + Exit Sub + End If If oExportInfo.AppVer < 110 Then mgrCommon.ShowMessage(mgrMonitorList_ErrorGameIDVerFailure, MsgBoxStyle.Exclamation) diff --git a/GBM/Managers/mgrXML.vb b/GBM/Managers/mgrXML.vb index 5b1e91e..69b7a6a 100644 --- a/GBM/Managers/mgrXML.vb +++ b/GBM/Managers/mgrXML.vb @@ -6,20 +6,22 @@ Imports System.Net Public Class mgrXML - Public Shared Function ReadMonitorList(ByVal sLocation As String, ByRef oExportInfo As ExportData, Optional ByVal bWebRead As Boolean = False) As Hashtable + Public Shared Function ReadMonitorList(ByVal sLocation As String, ByRef oExportInfo As ExportData, ByRef hshList As Hashtable, Optional ByVal bWebRead As Boolean = False) As Boolean Dim oList As List(Of Game) - Dim hshList As New Hashtable Dim hshDupeList As New Hashtable - Dim oExportData As ExportData + Dim oExportData As New ExportData Dim oGame As clsGame 'If the file doesn't exist return an empty list If Not File.Exists(sLocation) And Not bWebRead Then - Return hshList + Return False + End If + + If Not ImportandDeserialize(sLocation, oExportData, bWebRead) Then + Return False End If - oExportData = ImportandDeserialize(sLocation, bWebRead) oList = oExportData.Configurations oExportInfo = oExportData @@ -49,7 +51,7 @@ Public Class mgrXML End Try Next - Return hshList + Return True End Function Private Shared Function ReadImportData(ByVal sLocation As String, ByVal bWebRead As Boolean) @@ -66,10 +68,9 @@ Public Class mgrXML Return oReader End Function - Public Shared Function ImportandDeserialize(ByVal sLocation As String, Optional ByVal bWebRead As Boolean = False) As ExportData + Public Shared Function ImportandDeserialize(ByVal sLocation As String, ByRef oExportData As ExportData, Optional ByVal bWebRead As Boolean = False) As Boolean Dim oReader As StreamReader Dim oSerializer As XmlSerializer - Dim oExportData As New ExportData Try oReader = ReadImportData(sLocation, bWebRead) @@ -84,12 +85,12 @@ Public Class mgrXML oExportData.Configurations = oSerializer.Deserialize(oReader) oReader.Close() End If - + Return True Catch ex As Exception mgrCommon.ShowMessage(mgrXML_ErrorImportFailure, ex.Message, MsgBoxStyle.Exclamation) + Return False End Try - Return oExportData End Function Public Shared Function SerializeAndExport(ByVal oList As List(Of Game), ByVal sLocation As String) As Boolean diff --git a/GBM/My Project/Resources.Designer.vb b/GBM/My Project/Resources.Designer.vb index 77f5fb0..d1f6800 100644 --- a/GBM/My Project/Resources.Designer.vb +++ b/GBM/My Project/Resources.Designer.vb @@ -5512,7 +5512,7 @@ Namespace My.Resources End Property ''' - ''' Looks up a localized string similar to Do you want to sync your identifiers with this export file?[BR][BR]You should only do this if you're managing your own game configurations.. + ''' Looks up a localized string similar to Do you want to sync your game identifiers with this export file?[BR][BR]You should only do this if you're managing your own game configurations. Please see the online manual for more information.. ''' Friend ReadOnly Property mgrMonitorList_ConfirmFileGameIDSync() As String Get @@ -5521,7 +5521,7 @@ Namespace My.Resources End Property ''' - ''' Looks up a localized string similar to GBM now uses a unique identifier for each game. For the import feature to work as intended, your existing game configurations should use the same identifiers.[BR][BR]Do you want to sync your identifiers with the official list?[BR][BR]This warning will only be displayed once, but the option is available anytime from the "Tools" menu.. + ''' Looks up a localized string similar to GBM now uses a unique identifier for each game. For the import feature to recognize game configurations from a prior version, they need to use the same identifiers.[BR][BR]Do you want to sync your game identifiers with the official list?[BR][BR]This question will only be displayed once, but the option is available anytime from the "Tools" menu. Please see the online manual for more information.. ''' Friend ReadOnly Property mgrMonitorList_ConfirmInitialOfficialGameIDSync() As String Get @@ -5530,7 +5530,7 @@ Namespace My.Resources End Property ''' - ''' Looks up a localized string similar to Do you want to sync your identifiers with the official game list?. + ''' Looks up a localized string similar to Do you want to sync your game identifiers with the official game list?[BR][BR]This allows the import feature to recognize game configurations from a prior version. Please see the online manual for more information.. ''' Friend ReadOnly Property mgrMonitorList_ConfirmOfficialGameIDSync() As String Get diff --git a/GBM/My Project/Resources.resx b/GBM/My Project/Resources.resx index 23a0358..5f53281 100644 --- a/GBM/My Project/Resources.resx +++ b/GBM/My Project/Resources.resx @@ -2024,7 +2024,7 @@ Game ID - GBM now uses a unique identifier for each game. For the import feature to work as intended, your existing game configurations should use the same identifiers.[BR][BR]Do you want to sync your identifiers with the official list?[BR][BR]This warning will only be displayed once, but the option is available anytime from the "Tools" menu. + GBM now uses a unique identifier for each game. For the import feature to recognize game configurations from a prior version, they need to use the same identifiers.[BR][BR]Do you want to sync your game identifiers with the official list?[BR][BR]This question will only be displayed once, but the option is available anytime from the "Tools" menu. Please see the online manual for more information. This file cannot be used to sync game indentifiers. It was created with an older version of GBM. @@ -2033,7 +2033,7 @@ This export file was created with a version of GBM prior to 1.1.0 and does not contain unique game identifiers.[BR][BR]Do you still want to import configurations from this file? (Not Recommended) - Do you want to sync your identifiers with this export file?[BR][BR]You should only do this if you're managing your own game configurations. + Do you want to sync your game identifiers with this export file?[BR][BR]You should only do this if you're managing your own game configurations. Please see the online manual for more information. S&ync Game IDs @@ -2045,7 +2045,7 @@ &Official List... - Do you want to sync your identifiers with the official game list? + Do you want to sync your game identifiers with the official game list?[BR][BR]This allows the import feature to recognize game configurations from a prior version. Please see the online manual for more information. &Reset Warnings From 28a260bdfc1bd138b9457c55e712388c04ebbef3 Mon Sep 17 00:00:00 2001 From: MikeMaximus Date: Thu, 8 Mar 2018 16:02:58 -0600 Subject: [PATCH 30/38] Added the ability to launch other processes when a game is detected --- GBM/Classes/clsGameProcess.vb | 22 ++ GBM/Classes/clsProcess.vb | 53 +++ GBM/Forms/frmChooseGame.vb | 6 +- GBM/Forms/frmGameManager.Designer.vb | 28 +- GBM/Forms/frmGameManager.vb | 80 ++-- GBM/Forms/frmGameProcesses.Designer.vb | 142 +++++++ GBM/Forms/frmGameProcesses.resx | 120 ++++++ GBM/Forms/frmGameProcesses.vb | 247 ++++++++++++ GBM/Forms/frmMain.Designer.vb | 24 +- GBM/Forms/frmMain.vb | 118 +++++- GBM/Forms/frmProcessManager.Designer.vb | 241 ++++++++++++ GBM/Forms/frmProcessManager.resx | 120 ++++++ GBM/Forms/frmProcessManager.vb | 371 ++++++++++++++++++ GBM/Game Backup Monitor.vbproj | 24 +- GBM/Managers/mgrGameProcesses.vb | 163 ++++++++ GBM/Managers/mgrMonitorList.vb | 22 +- GBM/Managers/mgrProcess.vb | 152 +++++++ ...mgrProcesses.vb => mgrProcessDetection.vb} | 2 +- GBM/Managers/mgrSQLite.vb | 10 + GBM/My Project/Resources.Designer.vb | 270 +++++++++++++ GBM/My Project/Resources.resx | 90 +++++ GBM/readme.txt | 10 + 22 files changed, 2254 insertions(+), 61 deletions(-) create mode 100644 GBM/Classes/clsGameProcess.vb create mode 100644 GBM/Classes/clsProcess.vb create mode 100644 GBM/Forms/frmGameProcesses.Designer.vb create mode 100644 GBM/Forms/frmGameProcesses.resx create mode 100644 GBM/Forms/frmGameProcesses.vb create mode 100644 GBM/Forms/frmProcessManager.Designer.vb create mode 100644 GBM/Forms/frmProcessManager.resx create mode 100644 GBM/Forms/frmProcessManager.vb create mode 100644 GBM/Managers/mgrGameProcesses.vb create mode 100644 GBM/Managers/mgrProcess.vb rename GBM/Managers/{mgrProcesses.vb => mgrProcessDetection.vb} (99%) diff --git a/GBM/Classes/clsGameProcess.vb b/GBM/Classes/clsGameProcess.vb new file mode 100644 index 0000000..ef33eb9 --- /dev/null +++ b/GBM/Classes/clsGameProcess.vb @@ -0,0 +1,22 @@ +Public Class clsGameProcess + Private sProcessID As String + Private sMonitorID As String + + Public Property ProcessID As String + Get + Return sProcessID + End Get + Set(value As String) + sProcessID = value + End Set + End Property + + Public Property MonitorID As String + Get + Return sMonitorID + End Get + Set(value As String) + sMonitorID = value + End Set + End Property +End Class diff --git a/GBM/Classes/clsProcess.vb b/GBM/Classes/clsProcess.vb new file mode 100644 index 0000000..bae66d1 --- /dev/null +++ b/GBM/Classes/clsProcess.vb @@ -0,0 +1,53 @@ + +Public Class clsProcess + Private sProcessID As String = Guid.NewGuid.ToString + Private sName As String = String.Empty + Private sPath As String = String.Empty + Private sArgs As String = String.Empty + Private bKill As Boolean = True + + Public Property ID As String + Get + Return sProcessID + End Get + Set(value As String) + sProcessID = value + End Set + End Property + + Public Property Name As String + Get + Return sName + End Get + Set(value As String) + sName = value + End Set + End Property + + Public Property Path As String + Get + Return sPath + End Get + Set(value As String) + sPath = value + End Set + End Property + + Public Property Args As String + Get + Return sArgs + End Get + Set(value As String) + sArgs = value + End Set + End Property + + Public Property Kill As Boolean + Get + Return bKill + End Get + Set(value As Boolean) + bKill = value + End Set + End Property +End Class diff --git a/GBM/Forms/frmChooseGame.vb b/GBM/Forms/frmChooseGame.vb index f79125e..ef6f040 100644 --- a/GBM/Forms/frmChooseGame.vb +++ b/GBM/Forms/frmChooseGame.vb @@ -2,16 +2,16 @@ Public Class frmChooseGame - Private oProcess As mgrProcesses + Private oProcess As mgrProcessDetection Private oGame As clsGame Private oGamesHash As New Hashtable Private bGameSelected As Boolean = False - Property Process As mgrProcesses + Property Process As mgrProcessDetection Get Return oProcess End Get - Set(value As mgrProcesses) + Set(value As mgrProcessDetection) oProcess = value End Set End Property diff --git a/GBM/Forms/frmGameManager.Designer.vb b/GBM/Forms/frmGameManager.Designer.vb index b2c2604..7d28f4d 100644 --- a/GBM/Forms/frmGameManager.Designer.vb +++ b/GBM/Forms/frmGameManager.Designer.vb @@ -28,6 +28,7 @@ Partial Class frmGameManager Me.btnBackup = New System.Windows.Forms.Button() Me.btnClose = New System.Windows.Forms.Button() Me.grpConfig = New System.Windows.Forms.GroupBox() + Me.btnGameID = New System.Windows.Forms.Button() Me.chkRegEx = New System.Windows.Forms.CheckBox() Me.lblComments = New System.Windows.Forms.Label() Me.txtComments = New System.Windows.Forms.TextBox() @@ -101,7 +102,7 @@ Partial Class frmGameManager Me.cmsDeleteBackup = New System.Windows.Forms.ContextMenuStrip(Me.components) Me.cmsDeleteOne = New System.Windows.Forms.ToolStripMenuItem() Me.cmsDeleteAll = New System.Windows.Forms.ToolStripMenuItem() - Me.btnGameID = New System.Windows.Forms.Button() + Me.btnProcesses = New System.Windows.Forms.Button() Me.grpConfig.SuspendLayout() CType(Me.nudLimit, System.ComponentModel.ISupportInitialize).BeginInit() Me.grpExtra.SuspendLayout() @@ -190,6 +191,15 @@ Partial Class frmGameManager Me.grpConfig.TabStop = False Me.grpConfig.Text = "Configuration" ' + 'btnGameID + ' + Me.btnGameID.Location = New System.Drawing.Point(402, 17) + Me.btnGameID.Name = "btnGameID" + Me.btnGameID.Size = New System.Drawing.Size(117, 23) + Me.btnGameID.TabIndex = 2 + Me.btnGameID.Text = "&Game ID..." + Me.btnGameID.UseVisualStyleBackColor = True + ' 'chkRegEx ' Me.chkRegEx.AutoSize = True @@ -875,20 +885,21 @@ Partial Class frmGameManager Me.cmsDeleteAll.Size = New System.Drawing.Size(114, 22) Me.cmsDeleteAll.Text = "&All Files" ' - 'btnGameID + 'btnProcesses ' - Me.btnGameID.Location = New System.Drawing.Point(402, 17) - Me.btnGameID.Name = "btnGameID" - Me.btnGameID.Size = New System.Drawing.Size(117, 23) - Me.btnGameID.TabIndex = 2 - Me.btnGameID.Text = "&Game ID..." - Me.btnGameID.UseVisualStyleBackColor = True + Me.btnProcesses.Location = New System.Drawing.Point(454, 437) + Me.btnProcesses.Name = "btnProcesses" + Me.btnProcesses.Size = New System.Drawing.Size(75, 23) + Me.btnProcesses.TabIndex = 20 + Me.btnProcesses.Text = "Processes..." + Me.btnProcesses.UseVisualStyleBackColor = True ' 'frmGameManager ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font Me.ClientSize = New System.Drawing.Size(784, 661) + Me.Controls.Add(Me.btnProcesses) Me.Controls.Add(Me.lblQuickFilter) Me.Controls.Add(Me.txtQuickFilter) Me.Controls.Add(Me.btnExport) @@ -1012,4 +1023,5 @@ Partial Class frmGameManager Friend WithEvents txtComments As TextBox Friend WithEvents chkRegEx As CheckBox Friend WithEvents btnGameID As Button + Friend WithEvents btnProcesses As Button End Class diff --git a/GBM/Forms/frmGameManager.vb b/GBM/Forms/frmGameManager.vb index f1fb9c2..1f97e83 100644 --- a/GBM/Forms/frmGameManager.vb +++ b/GBM/Forms/frmGameManager.vb @@ -10,6 +10,7 @@ Public Class frmGameManager Private oCurrentBackupItem As clsBackup Private oCurrentGame As clsGame Private oTagsToSave As New List(Of KeyValuePair(Of String, String)) + Private oProcessesToSave As New List(Of KeyValuePair(Of String, String)) Private bDisableExternalFunctions As Boolean = False Private bTriggerBackup As Boolean = False Private bTriggerRestore As Boolean = False @@ -35,7 +36,6 @@ Public Class frmGameManager Add = 3 Disabled = 4 MultiSelect = 5 - ViewTemp = 6 End Enum Private eCurrentMode As eModes = eModes.Disabled @@ -581,6 +581,36 @@ Public Class frmGameManager End If End Sub + Private Sub OpenProcesses() + Dim frm As New frmGameProcesses + Dim oApp As clsGame + Dim sMonitorIDS As New List(Of String) + + If eCurrentMode = eModes.Add Then + 'Use a dummy ID + sMonitorIDS.Add(Guid.NewGuid.ToString) + frm.GameName = txtName.Text + frm.NewMode = True + frm.ProcessList = oProcessesToSave + Else + For Each oData In lstGames.SelectedItems + oApp = DirectCast(GameData(oData.Key), clsGame) + sMonitorIDS.Add(oApp.ID) + Next + frm.GameName = CurrentGame.Name + frm.NewMode = False + End If + + frm.IDList = sMonitorIDS + frm.ShowDialog() + + If eCurrentMode = eModes.Add Then + oProcessesToSave = frm.ProcessList + Else + ModeChange() + End If + End Sub + Private Sub OpenTags() Dim frm As New frmGameTags Dim oApp As clsGame @@ -917,6 +947,7 @@ Public Class frmGameManager chkEnabled.Checked = True chkMonitorOnly.Checked = False btnTags.Enabled = True + btnProcesses.Enabled = True lblTags.Text = String.Empty lblTags.Visible = True btnInclude.Text = frmGameManager_btnInclude @@ -944,6 +975,7 @@ Public Class frmGameManager btnOpenBackupFile.Enabled = False btnOpenRestorePath.Enabled = False btnTags.Enabled = True + btnProcesses.Enabled = True lblTags.Visible = True btnImport.Enabled = False btnExport.Enabled = False @@ -963,31 +995,10 @@ Public Class frmGameManager btnDelete.Enabled = True btnBackup.Enabled = True btnTags.Enabled = True + btnProcesses.Enabled = True lblTags.Visible = True btnImport.Enabled = True btnExport.Enabled = True - Case eModes.ViewTemp - grpFilter.Enabled = True - lstGames.Enabled = True - lblQuickFilter.Enabled = True - txtQuickFilter.Enabled = True - grpConfig.Enabled = False - chkEnabled.Enabled = False - chkMonitorOnly.Enabled = False - grpExtra.Enabled = False - grpStats.Enabled = True - btnSave.Enabled = False - btnCancel.Enabled = False - btnAdd.Enabled = True - btnDelete.Enabled = False - btnBackup.Enabled = False - btnOpenRestorePath.Enabled = False - btnTags.Enabled = False - lblTags.Visible = False - btnInclude.Text = frmGameManager_btnInclude - btnExclude.Text = frmGameManager_btnExclude - btnImport.Enabled = True - btnExport.Enabled = True Case eModes.Disabled grpFilter.Enabled = True lstGames.Enabled = True @@ -1010,6 +1021,7 @@ Public Class frmGameManager btnRestore.Enabled = False btnMarkAsRestored.Enabled = False btnTags.Enabled = False + btnProcesses.Enabled = False lblTags.Visible = False btnInclude.Text = frmGameManager_btnInclude btnExclude.Text = frmGameManager_btnExclude @@ -1041,6 +1053,7 @@ Public Class frmGameManager btnRestore.Enabled = True btnMarkAsRestored.Enabled = True btnTags.Enabled = True + btnProcesses.Enabled = True lblTags.Visible = False btnImport.Enabled = True btnExport.Enabled = True @@ -1150,6 +1163,22 @@ Public Class frmGameManager End If End Sub + Private Sub SaveProcesses(ByVal sID As String) + Dim oGameProcess As clsGameProcess + Dim oGameProcesses As List(Of clsGameProcess) + + If oProcessesToSave.Count > 0 Then + oGameProcesses = New List(Of clsGameProcess) + For Each kp As KeyValuePair(Of String, String) In oProcessesToSave + oGameProcess = New clsGameProcess + oGameProcess.MonitorID = sID + oGameProcess.ProcessID = kp.Key + oGameProcesses.Add(oGameProcess) + Next + mgrGameProcesses.DoGameProcessAddBatch(oGameProcesses) + End If + End Sub + Private Sub SaveTags(ByVal sID As String) Dim oGameTag As clsGameTag Dim oGameTags As List(Of clsGameTag) @@ -1210,6 +1239,7 @@ Public Class frmGameManager bSuccess = True mgrMonitorList.DoListAdd(oApp) SaveTags(oApp.ID) + SaveProcesses(oApp.ID) eCurrentMode = eModes.View End If Case eModes.Edit @@ -1696,6 +1726,10 @@ Public Class frmGameManager OpenTags() End Sub + Private Sub btnProcesses_Click(sender As Object, e As EventArgs) Handles btnProcesses.Click + OpenProcesses() + End Sub + Private Sub btnDeleteBackup_Click(sender As Object, e As EventArgs) Handles btnDeleteBackup.Click If cboRemoteBackup.Items.Count > 1 Then cmsDeleteBackup.Show(btnDeleteBackup, New Drawing.Point(btnDeleteBackup.Size.Width - Math.Floor(btnDeleteBackup.Size.Width * 0.1), btnDeleteBackup.Size.Height - Math.Floor(btnDeleteBackup.Size.Height * 0.5)), ToolStripDropDownDirection.AboveRight) diff --git a/GBM/Forms/frmGameProcesses.Designer.vb b/GBM/Forms/frmGameProcesses.Designer.vb new file mode 100644 index 0000000..090fc0e --- /dev/null +++ b/GBM/Forms/frmGameProcesses.Designer.vb @@ -0,0 +1,142 @@ + _ +Partial Class frmGameProcesses + Inherits System.Windows.Forms.Form + + 'Form overrides dispose to clean up the component list. + _ + Protected Overrides Sub Dispose(ByVal disposing As Boolean) + Try + If disposing AndAlso components IsNot Nothing Then + components.Dispose() + End If + Finally + MyBase.Dispose(disposing) + End Try + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + _ + Private Sub InitializeComponent() + Me.btnOpenProcesses = New System.Windows.Forms.Button() + Me.btnClose = New System.Windows.Forms.Button() + Me.lblGameProcesses = New System.Windows.Forms.Label() + Me.lblProcesses = New System.Windows.Forms.Label() + Me.btnRemove = New System.Windows.Forms.Button() + Me.btnAdd = New System.Windows.Forms.Button() + Me.lstGameProcesses = New System.Windows.Forms.ListBox() + Me.lstProcesses = New System.Windows.Forms.ListBox() + Me.SuspendLayout() + ' + 'btnOpenProcesses + ' + Me.btnOpenProcesses.Location = New System.Drawing.Point(12, 229) + Me.btnOpenProcesses.Name = "btnOpenProcesses" + Me.btnOpenProcesses.Size = New System.Drawing.Size(110, 23) + Me.btnOpenProcesses.TabIndex = 12 + Me.btnOpenProcesses.Text = "&Process Manager..." + Me.btnOpenProcesses.UseVisualStyleBackColor = True + ' + 'btnClose + ' + Me.btnClose.Location = New System.Drawing.Point(297, 229) + Me.btnClose.Name = "btnClose" + Me.btnClose.Size = New System.Drawing.Size(75, 23) + Me.btnClose.TabIndex = 13 + Me.btnClose.Text = "&Close" + Me.btnClose.UseVisualStyleBackColor = True + ' + 'lblGameProcesses + ' + Me.lblGameProcesses.AutoSize = True + Me.lblGameProcesses.Location = New System.Drawing.Point(251, 8) + Me.lblGameProcesses.Name = "lblGameProcesses" + Me.lblGameProcesses.Size = New System.Drawing.Size(93, 13) + Me.lblGameProcesses.TabIndex = 6 + Me.lblGameProcesses.Text = "Current Processes" + ' + 'lblProcesses + ' + Me.lblProcesses.AutoSize = True + Me.lblProcesses.Location = New System.Drawing.Point(36, 8) + Me.lblProcesses.Name = "lblProcesses" + Me.lblProcesses.Size = New System.Drawing.Size(102, 13) + Me.lblProcesses.TabIndex = 7 + Me.lblProcesses.Text = "Available Processes" + ' + 'btnRemove + ' + Me.btnRemove.Location = New System.Drawing.Point(168, 114) + Me.btnRemove.Name = "btnRemove" + Me.btnRemove.Size = New System.Drawing.Size(48, 23) + Me.btnRemove.TabIndex = 10 + Me.btnRemove.Text = "<" + Me.btnRemove.UseVisualStyleBackColor = True + ' + 'btnAdd + ' + Me.btnAdd.Location = New System.Drawing.Point(168, 85) + Me.btnAdd.Name = "btnAdd" + Me.btnAdd.Size = New System.Drawing.Size(48, 23) + Me.btnAdd.TabIndex = 9 + Me.btnAdd.Text = ">" + Me.btnAdd.UseVisualStyleBackColor = True + ' + 'lstGameProcesses + ' + Me.lstGameProcesses.FormattingEnabled = True + Me.lstGameProcesses.Location = New System.Drawing.Point(222, 24) + Me.lstGameProcesses.Name = "lstGameProcesses" + Me.lstGameProcesses.SelectionMode = System.Windows.Forms.SelectionMode.MultiExtended + Me.lstGameProcesses.Size = New System.Drawing.Size(150, 199) + Me.lstGameProcesses.Sorted = True + Me.lstGameProcesses.TabIndex = 11 + ' + 'lstProcesses + ' + Me.lstProcesses.FormattingEnabled = True + Me.lstProcesses.Location = New System.Drawing.Point(12, 24) + Me.lstProcesses.Name = "lstProcesses" + Me.lstProcesses.SelectionMode = System.Windows.Forms.SelectionMode.MultiExtended + Me.lstProcesses.Size = New System.Drawing.Size(150, 199) + Me.lstProcesses.Sorted = True + Me.lstProcesses.TabIndex = 8 + ' + 'frmGameProcesses + ' + Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) + Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font + Me.ClientSize = New System.Drawing.Size(384, 261) + Me.Controls.Add(Me.btnOpenProcesses) + Me.Controls.Add(Me.btnClose) + Me.Controls.Add(Me.lblGameProcesses) + Me.Controls.Add(Me.lblProcesses) + Me.Controls.Add(Me.btnRemove) + Me.Controls.Add(Me.btnAdd) + Me.Controls.Add(Me.lstGameProcesses) + Me.Controls.Add(Me.lstProcesses) + Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle + Me.MaximizeBox = False + Me.MinimizeBox = False + Me.Name = "frmGameProcesses" + Me.ShowIcon = False + Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen + Me.Text = "Edit Processes" + Me.ResumeLayout(False) + Me.PerformLayout() + + End Sub + + Friend WithEvents btnOpenProcesses As Button + Friend WithEvents btnClose As Button + Friend WithEvents lblGameProcesses As Label + Friend WithEvents lblProcesses As Label + Friend WithEvents btnRemove As Button + Friend WithEvents btnAdd As Button + Friend WithEvents lstGameProcesses As ListBox + Friend WithEvents lstProcesses As ListBox +End Class diff --git a/GBM/Forms/frmGameProcesses.resx b/GBM/Forms/frmGameProcesses.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/GBM/Forms/frmGameProcesses.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/GBM/Forms/frmGameProcesses.vb b/GBM/Forms/frmGameProcesses.vb new file mode 100644 index 0000000..b621990 --- /dev/null +++ b/GBM/Forms/frmGameProcesses.vb @@ -0,0 +1,247 @@ +Imports GBM.My.Resources + +Public Class frmGameProcesses + Private sMonitorIDs As List(Of String) + Private sGameName As String = String.Empty + Private bNewMode As Boolean = False + Private oProcessList As List(Of KeyValuePair(Of String, String)) + + Public Property IDList As List(Of String) + Get + Return sMonitorIDs + End Get + Set(value As List(Of String)) + sMonitorIDs = value + End Set + End Property + + Public Property GameName As String + Get + Return sGameName + End Get + Set(value As String) + sGameName = value + End Set + End Property + + Public Property NewMode As Boolean + Get + Return bNewMode + End Get + Set(value As Boolean) + bNewMode = value + End Set + End Property + + Public Property ProcessList As List(Of KeyValuePair(Of String, String)) + Get + Return oProcessList + End Get + Set(value As List(Of KeyValuePair(Of String, String))) + oProcessList = value + End Set + End Property + + Private Sub AddProcess() + Dim oData As KeyValuePair(Of String, String) + Dim oProcesss As List(Of KeyValuePair(Of String, String)) + Dim oGameProcess As clsGameProcess + Dim oGameProcesses As List(Of clsGameProcess) + + If lstProcesses.SelectedItems.Count = 1 Then + oData = lstProcesses.SelectedItems(0) + + oGameProcesses = New List(Of clsGameProcess) + For Each sID As String In IDList + oGameProcess = New clsGameProcess + oGameProcess.MonitorID = sID + oGameProcess.ProcessID = oData.Key + oGameProcesses.Add(oGameProcess) + Next + + If Not bNewMode Then mgrGameProcesses.DoGameProcessAddBatch(oGameProcesses) + + lstGameProcesses.Items.Add(oData) + lstProcesses.Items.Remove(oData) + ElseIf lstProcesses.SelectedItems.Count > 1 Then + oProcesss = New List(Of KeyValuePair(Of String, String)) + + For Each oData In lstProcesses.SelectedItems + oProcesss.Add(oData) + Next + + For Each kp As KeyValuePair(Of String, String) In oProcesss + oGameProcesses = New List(Of clsGameProcess) + For Each sID As String In IDList + oGameProcess = New clsGameProcess + oGameProcess.MonitorID = sID + oGameProcess.ProcessID = kp.Key + oGameProcesses.Add(oGameProcess) + Next + + If Not bNewMode Then mgrGameProcesses.DoGameProcessAddBatch(oGameProcesses) + + lstGameProcesses.Items.Add(kp) + lstProcesses.Items.Remove(kp) + Next + End If + + End Sub + + Private Sub RemoveProcess() + Dim oData As KeyValuePair(Of String, String) + Dim oProcesses As List(Of KeyValuePair(Of String, String)) + Dim oGameProcess As clsGameProcess + Dim oGameProcesses As List(Of clsGameProcess) + + If lstGameProcesses.SelectedItems.Count = 1 Then + oData = lstGameProcesses.SelectedItems(0) + + oGameProcesses = New List(Of clsGameProcess) + For Each sID As String In IDList + oGameProcess = New clsGameProcess + oGameProcess.MonitorID = sID + oGameProcess.ProcessID = oData.Key + oGameProcesses.Add(oGameProcess) + Next + + If Not bNewMode Then mgrGameProcesses.DoGameProcessDelete(oGameProcesses) + + lstGameProcesses.Items.Remove(oData) + lstProcesses.Items.Add(oData) + ElseIf lstGameProcesses.SelectedItems.Count > 1 Then + oProcesses = New List(Of KeyValuePair(Of String, String)) + + For Each oData In lstGameProcesses.SelectedItems + oProcesses.Add(oData) + Next + + For Each kp As KeyValuePair(Of String, String) In oProcesses + oGameProcesses = New List(Of clsGameProcess) + For Each sID As String In IDList + oGameProcess = New clsGameProcess + oGameProcess.MonitorID = sID + oGameProcess.ProcessID = kp.Key + oGameProcesses.Add(oGameProcess) + Next + + If Not bNewMode Then mgrGameProcesses.DoGameProcessDelete(oGameProcesses) + + lstGameProcesses.Items.Remove(kp) + lstProcesses.Items.Add(kp) + Next + End If + + End Sub + + Private Sub LoadData() + Dim hshProcesses As Hashtable + Dim hshGameProcesses As Hashtable + Dim oProcess As clsProcess + Dim oData As KeyValuePair(Of String, String) + + 'Load Processes + hshProcesses = mgrProcess.ReadProcesses() + + 'Handle Lists + lstProcesses.Items.Clear() + lstGameProcesses.Items.Clear() + + lstProcesses.ValueMember = "Key" + lstProcesses.DisplayMember = "Value" + lstGameProcesses.ValueMember = "Key" + lstGameProcesses.DisplayMember = "Value" + + If bNewMode Then + For Each kp As KeyValuePair(Of String, String) In oProcessList + 'We need to be sure the tags still exist if the "Process Manager" form was used + If hshProcesses.ContainsKey(kp.Value) Then + lstGameProcesses.Items.Add(kp) + End If + Next + + For Each kp As KeyValuePair(Of String, String) In oProcessList + If hshProcesses.ContainsKey(kp.Value) Then + hshProcesses.Remove(kp.Value) + End If + Next + Else + hshGameProcesses = mgrGameProcesses.GetProcessesByGameMulti(IDList) + + For Each de As DictionaryEntry In hshGameProcesses + oProcess = DirectCast(de.Value, clsProcess) + If hshProcesses.ContainsKey(oProcess.Name) Then + hshProcesses.Remove(oProcess.Name) + End If + Next + + For Each de As DictionaryEntry In hshGameProcesses + oProcess = DirectCast(de.Value, clsProcess) + oData = New KeyValuePair(Of String, String)(oProcess.ID, oProcess.Name) + lstGameProcesses.Items.Add(oData) + Next + End If + + For Each de As DictionaryEntry In hshProcesses + oProcess = DirectCast(de.Value, clsProcess) + oData = New KeyValuePair(Of String, String)(oProcess.ID, oProcess.Name) + lstProcesses.Items.Add(oData) + Next + + End Sub + + Private Sub BuildProcessList() + Dim oData As KeyValuePair(Of String, String) + oProcessList.Clear() + For Each oData In lstGameProcesses.Items + oProcessList.Add(oData) + Next + End Sub + + Private Sub OpenProcessManager() + Dim frm As New frmProcessManager + frm.ShowDialog() + LoadData() + End Sub + + Private Sub SetForm() + 'Set Form Name + If IDList.Count > 1 Then + Me.Text = frmGameProcesses_FormNameMulti + Else + Me.Text = mgrCommon.FormatString(frmGameProcesses_FormNameSingle, GameName) + End If + + 'Set Form Text + btnOpenProcesses.Text = frmGameProcesses_btnOpenProcesses + btnClose.Text = frmGameProcesses_btnClose + lblGameProcesses.Text = frmGameProcesses_lblGameProccesses + lblProcesses.Text = frmGameProcesses_lblProcesses + btnRemove.Text = frmGameProcesses_btnRemove + btnAdd.Text = frmGameProcesses_btnAdd + + End Sub + + Private Sub frmGameProcesses_Load(sender As Object, e As EventArgs) Handles MyBase.Load + LoadData() + SetForm() + End Sub + + Private Sub btnClose_Click(sender As Object, e As EventArgs) Handles btnClose.Click + If bNewMode Then BuildProcessList() + Me.Close() + End Sub + + Private Sub btnAdd_Click(sender As Object, e As EventArgs) Handles btnAdd.Click + AddProcess() + End Sub + + Private Sub btnRemove_Click(sender As Object, e As EventArgs) Handles btnRemove.Click + RemoveProcess() + End Sub + + Private Sub btnOpenProcesses_Click(sender As Object, e As EventArgs) Handles btnOpenProcesses.Click + If bNewMode Then BuildProcessList() + OpenProcessManager() + End Sub +End Class \ No newline at end of file diff --git a/GBM/Forms/frmMain.Designer.vb b/GBM/Forms/frmMain.Designer.vb index 83816fb..d95579d 100644 --- a/GBM/Forms/frmMain.Designer.vb +++ b/GBM/Forms/frmMain.Designer.vb @@ -36,6 +36,7 @@ Partial Class frmMain Me.gMonTraySetupGameManager = New System.Windows.Forms.ToolStripMenuItem() Me.gMonTraySetupCustomVariables = New System.Windows.Forms.ToolStripMenuItem() Me.gMonTraySetupTags = New System.Windows.Forms.ToolStripMenuItem() + Me.gMonTraySetupProcessManager = New System.Windows.Forms.ToolStripMenuItem() Me.gMonTrayTools = New System.Windows.Forms.ToolStripMenuItem() Me.gMonTrayToolsCompact = New System.Windows.Forms.ToolStripMenuItem() Me.gMonTrayToolsLog = New System.Windows.Forms.ToolStripMenuItem() @@ -65,6 +66,7 @@ Partial Class frmMain Me.gMonSetupAddWizard = New System.Windows.Forms.ToolStripMenuItem() Me.gMonSetupCustomVariables = New System.Windows.Forms.ToolStripMenuItem() Me.gMonSetupTags = New System.Windows.Forms.ToolStripMenuItem() + Me.gMonSetupProcessManager = New System.Windows.Forms.ToolStripMenuItem() Me.gMonTools = New System.Windows.Forms.ToolStripMenuItem() Me.gMonToolsCompact = New System.Windows.Forms.ToolStripMenuItem() Me.gMonToolsLog = New System.Windows.Forms.ToolStripMenuItem() @@ -143,7 +145,7 @@ Partial Class frmMain ' 'gMonTraySetup ' - Me.gMonTraySetup.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.gMonTraySetupAddWizard, Me.gMonTraySetupGameManager, Me.gMonTraySetupCustomVariables, Me.gMonTraySetupTags}) + Me.gMonTraySetup.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.gMonTraySetupAddWizard, Me.gMonTraySetupGameManager, Me.gMonTraySetupCustomVariables, Me.gMonTraySetupTags, Me.gMonTraySetupProcessManager}) Me.gMonTraySetup.Name = "gMonTraySetup" Me.gMonTraySetup.Size = New System.Drawing.Size(161, 22) Me.gMonTraySetup.Text = "&Setup" @@ -172,6 +174,12 @@ Partial Class frmMain Me.gMonTraySetupTags.Size = New System.Drawing.Size(201, 22) Me.gMonTraySetupTags.Text = "&Tags..." ' + 'gMonTraySetupProcessManager + ' + Me.gMonTraySetupProcessManager.Name = "gMonTraySetupProcessManager" + Me.gMonTraySetupProcessManager.Size = New System.Drawing.Size(201, 22) + Me.gMonTraySetupProcessManager.Text = "Process &Manager..." + ' 'gMonTrayTools ' Me.gMonTrayTools.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.gMonTrayToolsCompact, Me.gMonTrayToolsLog, Me.gMonTrayToolsSessions, Me.gMonTrayToolsSyncGameID}) @@ -342,7 +350,7 @@ Partial Class frmMain ' 'gMonSetup ' - Me.gMonSetup.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.gMonSetupGameManager, Me.gMonSetupAddWizard, Me.gMonSetupCustomVariables, Me.gMonSetupTags}) + Me.gMonSetup.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.gMonSetupGameManager, Me.gMonSetupAddWizard, Me.gMonSetupCustomVariables, Me.gMonSetupTags, Me.gMonSetupProcessManager}) Me.gMonSetup.Name = "gMonSetup" Me.gMonSetup.Size = New System.Drawing.Size(49, 20) Me.gMonSetup.Text = "&Setup" @@ -371,6 +379,12 @@ Partial Class frmMain Me.gMonSetupTags.Size = New System.Drawing.Size(201, 22) Me.gMonSetupTags.Text = "&Tags..." ' + 'gMonSetupProcessManager + ' + Me.gMonSetupProcessManager.Name = "gMonSetupProcessManager" + Me.gMonSetupProcessManager.Size = New System.Drawing.Size(201, 22) + Me.gMonSetupProcessManager.Text = "Process &Manager..." + ' 'gMonTools ' Me.gMonTools.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.gMonToolsCompact, Me.gMonToolsLog, Me.gMonToolsSessions, Me.gMonToolsSyncGameID}) @@ -419,13 +433,13 @@ Partial Class frmMain 'gMonToolsSyncGameIDOfficial ' Me.gMonToolsSyncGameIDOfficial.Name = "gMonToolsSyncGameIDOfficial" - Me.gMonToolsSyncGameIDOfficial.Size = New System.Drawing.Size(152, 22) + Me.gMonToolsSyncGameIDOfficial.Size = New System.Drawing.Size(142, 22) Me.gMonToolsSyncGameIDOfficial.Text = "&Official List..." ' 'gMonToolsSyncGameIDFile ' Me.gMonToolsSyncGameIDFile.Name = "gMonToolsSyncGameIDFile" - Me.gMonToolsSyncGameIDFile.Size = New System.Drawing.Size(152, 22) + Me.gMonToolsSyncGameIDFile.Size = New System.Drawing.Size(142, 22) Me.gMonToolsSyncGameIDFile.Text = "&File..." ' 'gMonHelp @@ -671,4 +685,6 @@ Partial Class frmMain Friend WithEvents gMonTrayToolsSyncGameID As ToolStripMenuItem Friend WithEvents gMonTrayToolsSyncGameIDOfficial As ToolStripMenuItem Friend WithEvents gMonTrayToolsSyncGameIDFile As ToolStripMenuItem + Friend WithEvents gMonTraySetupProcessManager As ToolStripMenuItem + Friend WithEvents gMonSetupProcessManager As ToolStripMenuItem End Class diff --git a/GBM/Forms/frmMain.vb b/GBM/Forms/frmMain.vb index f4784eb..77628f7 100644 --- a/GBM/Forms/frmMain.vb +++ b/GBM/Forms/frmMain.vb @@ -40,6 +40,7 @@ Public Class frmMain Private sPriorCompany As String Private sPriorVersion As String Private iRestoreTimeOut As Integer + Private oChildProcesses As New Hashtable Private wState As FormWindowState = FormWindowState.Normal 'Developer Debug Flags @@ -52,7 +53,7 @@ Public Class frmMain WithEvents tmRestoreCheck As New System.Timers.Timer WithEvents tmFileWatcherQueue As New System.Timers.Timer - Public WithEvents oProcess As New mgrProcesses + Public WithEvents oProcess As New mgrProcessDetection Public WithEvents oBackup As New mgrBackup Public WithEvents oRestore As New mgrRestore Public hshScanList As Hashtable @@ -844,6 +845,13 @@ Public Class frmMain ResumeScan() End Sub + Private Sub OpenProcessManager() + Dim frm As New frmProcessManager + PauseScan() + frm.ShowDialog() + ResumeScan() + End Sub + Private Sub OpenGameManager(Optional ByVal bPendingRestores As Boolean = False) Dim frm As New frmGameManager PauseScan() @@ -1381,6 +1389,7 @@ Public Class frmMain gMonSetupAddWizard.Text = frmMain_gMonSetupAddWizard gMonSetupCustomVariables.Text = frmMain_gMonSetupCustomVariables gMonSetupTags.Text = frmMain_gMonSetupTags + gMonSetupProcessManager.Text = frmMain_gMonSetupProcessManager gMonTools.Text = frmMain_gMonTools gMonToolsCompact.Text = frmMain_gMonToolsCompact gMonToolsLog.Text = frmMain_gMonToolsLog @@ -1405,6 +1414,7 @@ Public Class frmMain gMonTraySetupAddWizard.Text = frmMain_gMonSetupAddWizard gMonTraySetupCustomVariables.Text = frmMain_gMonSetupCustomVariables gMonTraySetupTags.Text = frmMain_gMonSetupTags + gMonTraySetupProcessManager.Text = frmMain_gMonSetupProcessManager gMonTrayTools.Text = frmMain_gMonTools gMonTrayToolsCompact.Text = frmMain_gMonToolsCompact gMonTrayToolsLog.Text = frmMain_gMonToolsLog @@ -1439,6 +1449,60 @@ Public Class frmMain ResetGameInfo() End Sub + Private Function BuildChildProcesses() As Integer + Dim oCurrentProcess As clsProcess + Dim oProcessList As Hashtable + Dim prsChild As Process + + oChildProcesses.Clear() + + oProcessList = mgrGameProcesses.GetProcessesByGame(oProcess.GameInfo.ID) + + If oProcessList.Count > 0 Then + For Each oCurrentProcess In oProcessList.Values + prsChild = New Process + prsChild.StartInfo.Arguments = oCurrentProcess.Args + prsChild.StartInfo.FileName = oCurrentProcess.Path + prsChild.StartInfo.UseShellExecute = False + prsChild.StartInfo.RedirectStandardOutput = True + prsChild.StartInfo.CreateNoWindow = True + oChildProcesses.Add(oCurrentProcess, prsChild) + Next + End If + + Return oChildProcesses.Count + End Function + + Private Sub StartChildProcesses() + Dim prsChild As Process + + Try + For Each prsChild In oChildProcesses.Values + prsChild.Start() + Next + Catch ex As Exception + UpdateLog(mgrCommon.FormatString(frmMain_ErrorStartChildProcess, oProcess.GameInfo.CroppedName), True, ToolTipIcon.Error) + UpdateLog(mgrCommon.FormatString(App_GenericError, ex.Message), False,, False) + End Try + End Sub + + Private Sub EndChildProcesses() + Dim oCurrentProcess As clsProcess + Dim prsChild As Process + + Try + For Each de As DictionaryEntry In oChildProcesses + oCurrentProcess = DirectCast(de.Key, clsProcess) + prsChild = DirectCast(de.Value, Process) + prsChild.Kill() + Next + + Catch ex As Exception + UpdateLog(mgrCommon.FormatString(frmMain_ErrorEndChildProcess, oProcess.GameInfo.CroppedName), True, ToolTipIcon.Error) + UpdateLog(mgrCommon.FormatString(App_GenericError, ex.Message), False,, False) + End Try + End Sub + 'Functions that control the scanning for games Private Sub StartScan() tmScanTimer.Interval = 5000 @@ -1684,6 +1748,10 @@ Public Class frmMain OpenTags() End Sub + Private Sub gMonSetupProcessManager_Click(sender As Object, e As EventArgs) Handles gMonSetupProcessManager.Click, gMonTraySetupProcessManager.Click + OpenProcessManager() + End Sub + Private Sub gMonHelpAbout_Click(sender As Object, e As EventArgs) Handles gMonHelpAbout.Click OpenAbout() End Sub @@ -1712,6 +1780,14 @@ Public Class frmMain OpenSessions() End Sub + Private Sub gMonToolsSyncGameIDOfficial_Click(sender As Object, e As EventArgs) Handles gMonToolsSyncGameIDOfficial.Click, gMonTrayToolsSyncGameIDOfficial.Click + SyncGameIDs(True) + End Sub + + Private Sub gMonToolsSyncGameIDFile_Click(sender As Object, e As EventArgs) Handles gMonToolsSyncGameIDFile.Click, gMonTrayToolsSyncGameIDFile.Click + SyncGameIDs(False) + End Sub + Private Sub gMonNotification_Click(sender As Object, e As EventArgs) Handles gMonNotification.Click, gMonTrayNotification.Click gMonNotification.Visible = False gMonTrayNotification.Visible = False @@ -1810,18 +1886,23 @@ Public Class frmMain If bContinue = True Then CheckForSavedDuplicate() If oProcess.Duplicate Then - UpdateLog(frmMain_MultipleGamesDetected, oSettings.ShowDetectionToolTips) - UpdateStatus(frmMain_MultipleGamesDetected) - SetGameInfo(True) - Else - UpdateLog(mgrCommon.FormatString(frmMain_GameDetected, oProcess.GameInfo.Name), oSettings.ShowDetectionToolTips) - UpdateStatus(mgrCommon.FormatString(frmMain_GameDetected, oProcess.GameInfo.CroppedName)) - SetGameInfo() - End If - oProcess.StartTime = Now - bwMonitor.RunWorkerAsync() + UpdateLog(frmMain_MultipleGamesDetected, oSettings.ShowDetectionToolTips) + UpdateStatus(frmMain_MultipleGamesDetected) + SetGameInfo(True) Else - StopScan() + UpdateLog(mgrCommon.FormatString(frmMain_GameDetected, oProcess.GameInfo.Name), oSettings.ShowDetectionToolTips) + UpdateStatus(mgrCommon.FormatString(frmMain_GameDetected, oProcess.GameInfo.CroppedName)) + SetGameInfo() + End If + + If BuildChildProcesses() > 0 Then + StartChildProcesses() + End If + + oProcess.StartTime = Now + bwMonitor.RunWorkerAsync() + Else + StopScan() End If End If End Sub @@ -1843,6 +1924,11 @@ Public Class frmMain Private Sub bwMain_RunWorkerCompleted(sender As System.Object, e As System.ComponentModel.RunWorkerCompletedEventArgs) Handles bwMonitor.RunWorkerCompleted Dim bContinue As Boolean = True + + If oChildProcesses.Count > 0 Then + EndChildProcesses() + End If + oProcess.EndTime = Now If Not bCancelledByUser Then @@ -1948,12 +2034,4 @@ Public Class frmMain 'Move focus to first label lblGameTitle.Focus() End Sub - - Private Sub gMonToolsSyncGameIDOfficial_Click(sender As Object, e As EventArgs) Handles gMonToolsSyncGameIDOfficial.Click, gMonTrayToolsSyncGameIDOfficial.Click - SyncGameIDs(True) - End Sub - - Private Sub gMonToolsSyncGameIDFile_Click(sender As Object, e As EventArgs) Handles gMonToolsSyncGameIDFile.Click, gMonTrayToolsSyncGameIDFile.Click - SyncGameIDs(False) - End Sub End Class \ No newline at end of file diff --git a/GBM/Forms/frmProcessManager.Designer.vb b/GBM/Forms/frmProcessManager.Designer.vb new file mode 100644 index 0000000..c461335 --- /dev/null +++ b/GBM/Forms/frmProcessManager.Designer.vb @@ -0,0 +1,241 @@ + _ +Partial Class frmProcessManager + Inherits System.Windows.Forms.Form + + 'Form overrides dispose to clean up the component list. + _ + Protected Overrides Sub Dispose(ByVal disposing As Boolean) + Try + If disposing AndAlso components IsNot Nothing Then + components.Dispose() + End If + Finally + MyBase.Dispose(disposing) + End Try + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + _ + Private Sub InitializeComponent() + Me.grpProcess = New System.Windows.Forms.GroupBox() + Me.txtArguments = New System.Windows.Forms.TextBox() + Me.lblArguments = New System.Windows.Forms.Label() + Me.btnProcessBrowse = New System.Windows.Forms.Button() + Me.txtName = New System.Windows.Forms.TextBox() + Me.txtPath = New System.Windows.Forms.TextBox() + Me.lblProcess = New System.Windows.Forms.Label() + Me.lblName = New System.Windows.Forms.Label() + Me.btnClose = New System.Windows.Forms.Button() + Me.btnDelete = New System.Windows.Forms.Button() + Me.btnAdd = New System.Windows.Forms.Button() + Me.lstProcesses = New System.Windows.Forms.ListBox() + Me.txtID = New System.Windows.Forms.TextBox() + Me.btnCancel = New System.Windows.Forms.Button() + Me.btnSave = New System.Windows.Forms.Button() + Me.chkKillProcess = New System.Windows.Forms.CheckBox() + Me.grpProcess.SuspendLayout() + Me.SuspendLayout() + ' + 'grpProcess + ' + Me.grpProcess.Controls.Add(Me.chkKillProcess) + Me.grpProcess.Controls.Add(Me.txtArguments) + Me.grpProcess.Controls.Add(Me.lblArguments) + Me.grpProcess.Controls.Add(Me.btnProcessBrowse) + Me.grpProcess.Controls.Add(Me.txtName) + Me.grpProcess.Controls.Add(Me.txtPath) + Me.grpProcess.Controls.Add(Me.lblProcess) + Me.grpProcess.Controls.Add(Me.lblName) + Me.grpProcess.Location = New System.Drawing.Point(238, 12) + Me.grpProcess.Name = "grpProcess" + Me.grpProcess.Size = New System.Drawing.Size(334, 120) + Me.grpProcess.TabIndex = 11 + Me.grpProcess.TabStop = False + Me.grpProcess.Text = "Configuration" + ' + 'txtArguments + ' + Me.txtArguments.Location = New System.Drawing.Point(72, 70) + Me.txtArguments.Name = "txtArguments" + Me.txtArguments.Size = New System.Drawing.Size(256, 20) + Me.txtArguments.TabIndex = 5 + ' + 'lblArguments + ' + Me.lblArguments.AutoSize = True + Me.lblArguments.Location = New System.Drawing.Point(6, 73) + Me.lblArguments.Name = "lblArguments" + Me.lblArguments.Size = New System.Drawing.Size(60, 13) + Me.lblArguments.TabIndex = 4 + Me.lblArguments.Text = "Arguments:" + ' + 'btnProcessBrowse + ' + Me.btnProcessBrowse.Location = New System.Drawing.Point(298, 45) + Me.btnProcessBrowse.Name = "btnProcessBrowse" + Me.btnProcessBrowse.Size = New System.Drawing.Size(30, 20) + Me.btnProcessBrowse.TabIndex = 3 + Me.btnProcessBrowse.Text = "..." + Me.btnProcessBrowse.UseVisualStyleBackColor = True + ' + 'txtName + ' + Me.txtName.Location = New System.Drawing.Point(72, 19) + Me.txtName.Name = "txtName" + Me.txtName.Size = New System.Drawing.Size(256, 20) + Me.txtName.TabIndex = 1 + ' + 'txtPath + ' + Me.txtPath.Location = New System.Drawing.Point(72, 45) + Me.txtPath.Name = "txtPath" + Me.txtPath.Size = New System.Drawing.Size(220, 20) + Me.txtPath.TabIndex = 2 + ' + 'lblProcess + ' + Me.lblProcess.AutoSize = True + Me.lblProcess.Location = New System.Drawing.Point(6, 48) + Me.lblProcess.Name = "lblProcess" + Me.lblProcess.Size = New System.Drawing.Size(48, 13) + Me.lblProcess.TabIndex = 1 + Me.lblProcess.Text = "Process:" + ' + 'lblName + ' + Me.lblName.AutoSize = True + Me.lblName.Location = New System.Drawing.Point(6, 22) + Me.lblName.Name = "lblName" + Me.lblName.Size = New System.Drawing.Size(38, 13) + Me.lblName.TabIndex = 0 + Me.lblName.Text = "Name:" + ' + 'btnClose + ' + Me.btnClose.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.btnClose.Location = New System.Drawing.Point(497, 226) + Me.btnClose.Name = "btnClose" + Me.btnClose.Size = New System.Drawing.Size(75, 23) + Me.btnClose.TabIndex = 14 + Me.btnClose.Text = "C&lose" + Me.btnClose.UseVisualStyleBackColor = True + ' + 'btnDelete + ' + Me.btnDelete.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles) + Me.btnDelete.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + Me.btnDelete.Location = New System.Drawing.Point(48, 226) + Me.btnDelete.Name = "btnDelete" + Me.btnDelete.Size = New System.Drawing.Size(30, 23) + Me.btnDelete.TabIndex = 10 + Me.btnDelete.Text = "-" + Me.btnDelete.UseVisualStyleBackColor = True + ' + 'btnAdd + ' + Me.btnAdd.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles) + Me.btnAdd.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + Me.btnAdd.Location = New System.Drawing.Point(12, 226) + Me.btnAdd.Name = "btnAdd" + Me.btnAdd.Size = New System.Drawing.Size(30, 23) + Me.btnAdd.TabIndex = 9 + Me.btnAdd.Text = "+" + Me.btnAdd.UseVisualStyleBackColor = True + ' + 'lstProcesses + ' + Me.lstProcesses.FormattingEnabled = True + Me.lstProcesses.Location = New System.Drawing.Point(12, 12) + Me.lstProcesses.Name = "lstProcesses" + Me.lstProcesses.Size = New System.Drawing.Size(220, 212) + Me.lstProcesses.Sorted = True + Me.lstProcesses.TabIndex = 7 + ' + 'txtID + ' + Me.txtID.Enabled = False + Me.txtID.Location = New System.Drawing.Point(374, 150) + Me.txtID.Name = "txtID" + Me.txtID.Size = New System.Drawing.Size(33, 20) + Me.txtID.TabIndex = 8 + Me.txtID.TabStop = False + Me.txtID.Visible = False + ' + 'btnCancel + ' + Me.btnCancel.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.btnCancel.Location = New System.Drawing.Point(494, 149) + Me.btnCancel.Name = "btnCancel" + Me.btnCancel.Size = New System.Drawing.Size(75, 23) + Me.btnCancel.TabIndex = 13 + Me.btnCancel.Text = "&Cancel" + Me.btnCancel.UseVisualStyleBackColor = True + ' + 'btnSave + ' + Me.btnSave.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.btnSave.Location = New System.Drawing.Point(413, 149) + Me.btnSave.Name = "btnSave" + Me.btnSave.Size = New System.Drawing.Size(75, 23) + Me.btnSave.TabIndex = 12 + Me.btnSave.Text = "&Save" + Me.btnSave.UseVisualStyleBackColor = True + ' + 'chkKillProcess + ' + Me.chkKillProcess.AutoSize = True + Me.chkKillProcess.Location = New System.Drawing.Point(72, 96) + Me.chkKillProcess.Name = "chkKillProcess" + Me.chkKillProcess.Size = New System.Drawing.Size(184, 17) + Me.chkKillProcess.TabIndex = 6 + Me.chkKillProcess.Text = "Kill process when game is closed." + Me.chkKillProcess.UseVisualStyleBackColor = True + ' + 'frmProcessManager + ' + Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) + Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font + Me.ClientSize = New System.Drawing.Size(584, 261) + Me.Controls.Add(Me.grpProcess) + Me.Controls.Add(Me.btnClose) + Me.Controls.Add(Me.btnDelete) + Me.Controls.Add(Me.btnAdd) + Me.Controls.Add(Me.lstProcesses) + Me.Controls.Add(Me.txtID) + Me.Controls.Add(Me.btnCancel) + Me.Controls.Add(Me.btnSave) + Me.MaximizeBox = False + Me.MinimizeBox = False + Me.Name = "frmProcessManager" + Me.ShowIcon = False + Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen + Me.Text = "Process Manager" + Me.grpProcess.ResumeLayout(False) + Me.grpProcess.PerformLayout() + Me.ResumeLayout(False) + Me.PerformLayout() + + End Sub + + Friend WithEvents grpProcess As GroupBox + Friend WithEvents txtArguments As TextBox + Friend WithEvents lblArguments As Label + Friend WithEvents btnProcessBrowse As Button + Friend WithEvents txtName As TextBox + Friend WithEvents txtPath As TextBox + Friend WithEvents lblProcess As Label + Friend WithEvents lblName As Label + Friend WithEvents btnClose As Button + Friend WithEvents btnDelete As Button + Friend WithEvents btnAdd As Button + Friend WithEvents lstProcesses As ListBox + Friend WithEvents txtID As TextBox + Friend WithEvents btnCancel As Button + Friend WithEvents btnSave As Button + Friend WithEvents chkKillProcess As CheckBox +End Class diff --git a/GBM/Forms/frmProcessManager.resx b/GBM/Forms/frmProcessManager.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/GBM/Forms/frmProcessManager.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/GBM/Forms/frmProcessManager.vb b/GBM/Forms/frmProcessManager.vb new file mode 100644 index 0000000..cc56904 --- /dev/null +++ b/GBM/Forms/frmProcessManager.vb @@ -0,0 +1,371 @@ +Imports GBM.My.Resources +Imports System.IO + +Public Class frmProcessManager + Dim hshProcessData As Hashtable + Private bIsDirty As Boolean = False + Private bIsLoading As Boolean = False + Private oCurrentProcess As clsProcess + + Private Property IsDirty As Boolean + Get + Return bIsDirty + End Get + Set(value As Boolean) + bIsDirty = value + End Set + End Property + + Private Property IsLoading As Boolean + Get + Return bIsLoading + End Get + Set(value As Boolean) + bIsLoading = value + End Set + End Property + + Private Enum eModes As Integer + View = 1 + Edit = 2 + Add = 3 + Disabled = 4 + End Enum + + Private eCurrentMode As eModes = eModes.Disabled + + Private Property ProcessData As Hashtable + Get + Return hshProcessData + End Get + Set(value As Hashtable) + hshProcessData = value + End Set + End Property + + Private Sub ProcessBrowse() + Dim sDefaultFolder As String = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + Dim sCurrentPath As String = txtPath.Text + Dim sNewPath As String + + If sCurrentPath <> String.Empty Then + sCurrentPath = Path.GetDirectoryName(txtPath.Text) + If Directory.Exists(sCurrentPath) Then + sDefaultFolder = sCurrentPath + End If + End If + + sNewPath = mgrCommon.OpenFileBrowser("PM_Process", frmProcessManager_ChooseProcess, "exe", + frmProcessManager_Executable, sDefaultFolder, False, True) + + If sNewPath <> String.Empty Then + txtPath.Text = sNewPath + End If + + End Sub + + Private Sub LoadData() + ProcessData = mgrProcess.ReadProcesses + lstProcesses.Items.Clear() + FormatAndFillList() + End Sub + + Private Function HandleDirty() As MsgBoxResult + Dim oResult As MsgBoxResult + + oResult = mgrCommon.ShowMessage(App_ConfirmDirty, MsgBoxStyle.YesNoCancel) + + Select Case oResult + Case MsgBoxResult.Yes + IsDirty = False + Case MsgBoxResult.No + IsDirty = False + Case MsgBoxResult.Cancel + 'No Change + End Select + + Return oResult + + End Function + + Private Sub FormatAndFillList() + IsLoading = True + + For Each oProcess As clsProcess In ProcessData.Values + lstProcesses.Items.Add(oProcess.Name) + Next + + IsLoading = False + End Sub + + Private Sub FillData() + IsLoading = True + + oCurrentProcess = DirectCast(ProcessData(lstProcesses.SelectedItems(0).ToString), clsProcess) + + txtID.Text = oCurrentProcess.ID + txtName.Text = oCurrentProcess.Name + txtPath.Text = oCurrentProcess.Path + txtArguments.Text = oCurrentProcess.Args + chkKillProcess.Checked = oCurrentProcess.Kill + + IsLoading = False + End Sub + + Private Sub DirtyCheck_ValueChanged(sender As Object, e As EventArgs) + If Not IsLoading Then + IsDirty = True + If Not eCurrentMode = eModes.Add Then EditProcess() + End If + End Sub + + Private Sub AssignDirtyHandlers(ByVal oCtls As GroupBox.ControlCollection) + For Each ctl As Control In oCtls + If TypeOf ctl Is TextBox Then + AddHandler DirectCast(ctl, TextBox).TextChanged, AddressOf DirtyCheck_ValueChanged + End If + Next + End Sub + + Private Sub WipeControls(ByVal oCtls As GroupBox.ControlCollection) + For Each ctl As Control In oCtls + If TypeOf ctl Is TextBox Then + DirectCast(ctl, TextBox).Text = String.Empty + End If + Next + txtID.Text = String.Empty + End Sub + + Private Sub ModeChange() + IsLoading = True + + Select Case eCurrentMode + Case eModes.Add + grpProcess.Enabled = True + WipeControls(grpProcess.Controls) + btnSave.Enabled = True + btnCancel.Enabled = True + btnAdd.Enabled = False + btnDelete.Enabled = False + lstProcesses.Enabled = False + chkKillProcess.Checked = True + Case eModes.Edit + lstProcesses.Enabled = False + grpProcess.Enabled = True + btnSave.Enabled = True + btnCancel.Enabled = True + btnAdd.Enabled = False + btnDelete.Enabled = False + Case eModes.View + lstProcesses.Enabled = True + grpProcess.Enabled = True + btnSave.Enabled = False + btnCancel.Enabled = False + btnAdd.Enabled = True + btnDelete.Enabled = True + Case eModes.Disabled + lstProcesses.Enabled = True + WipeControls(grpProcess.Controls) + grpProcess.Enabled = False + btnSave.Enabled = False + btnCancel.Enabled = False + btnAdd.Enabled = True + btnDelete.Enabled = True + End Select + + IsLoading = False + End Sub + + Private Sub EditProcess() + eCurrentMode = eModes.Edit + ModeChange() + End Sub + + Private Sub AddProcess() + eCurrentMode = eModes.Add + ModeChange() + txtName.Focus() + End Sub + + Private Sub CancelEdit() + If bIsDirty Then + Select Case HandleDirty() + Case MsgBoxResult.Yes + SaveProcess() + Case MsgBoxResult.No + If lstProcesses.SelectedItems.Count > 0 Then + eCurrentMode = eModes.View + ModeChange() + FillData() + lstProcesses.Focus() + Else + eCurrentMode = eModes.Disabled + ModeChange() + End If + Case MsgBoxResult.Cancel + 'Do Nothing + End Select + Else + If lstProcesses.SelectedItems.Count > 0 Then + eCurrentMode = eModes.View + ModeChange() + FillData() + lstProcesses.Focus() + Else + eCurrentMode = eModes.Disabled + ModeChange() + End If + End If + End Sub + + Private Sub SaveProcess() + Dim oProcess As New clsProcess + Dim bSuccess As Boolean = False + + If txtID.Text <> String.Empty Then + oProcess.ID = txtID.Text + End If + oProcess.Name = txtName.Text + oProcess.Path = txtPath.Text + oProcess.Args = txtArguments.Text + oProcess.Kill = chkKillProcess.Checked + + Select Case eCurrentMode + Case eModes.Add + If CoreValidatation(oProcess) Then + bSuccess = True + mgrProcess.DoProcessAdd(oProcess) + eCurrentMode = eModes.View + End If + Case eModes.Edit + If CoreValidatation(oProcess) Then + bSuccess = True + mgrProcess.DoProcessUpdate(oProcess) + eCurrentMode = eModes.View + End If + End Select + + If bSuccess Then + IsDirty = False + LoadData() + ModeChange() + If eCurrentMode = eModes.View Then lstProcesses.SelectedIndex = lstProcesses.Items.IndexOf(oProcess.Name) + End If + End Sub + + Private Sub DeleteProcess() + Dim oProcess As clsProcess + + If lstProcesses.SelectedItems.Count > 0 Then + oProcess = DirectCast(ProcessData(lstProcesses.SelectedItems(0).ToString), clsProcess) + + If mgrCommon.ShowMessage(frmProcessManager_ConfirmDelete, oProcess.Name, MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then + mgrProcess.DoProcessDelete(oProcess.ID) + LoadData() + eCurrentMode = eModes.Disabled + ModeChange() + End If + End If + End Sub + + Private Sub SwitchProcess() + If lstProcesses.SelectedItems.Count > 0 Then + eCurrentMode = eModes.View + FillData() + ModeChange() + End If + End Sub + + Private Function CoreValidatation(ByVal oProcess As clsProcess) As Boolean + If txtName.Text.Trim = String.Empty Then + mgrCommon.ShowMessage(frmProcessManager_ErrorValidName, MsgBoxStyle.Exclamation) + txtName.Focus() + Return False + End If + + If txtPath.Text.Trim = String.Empty Then + mgrCommon.ShowMessage(frmProcessManager_ErrorValidPath, MsgBoxStyle.Exclamation) + txtPath.Focus() + Return False + Else + If Not File.Exists(txtPath.Text.Trim) Then + mgrCommon.ShowMessage(frmProcessManager_ErrorPathNotFound, MsgBoxStyle.Exclamation) + txtPath.Focus() + Return False + End If + End If + + If mgrProcess.DoCheckDuplicate(oProcess.Name, oProcess.ID) Then + mgrCommon.ShowMessage(frmProcessManager_ErrorDupe, MsgBoxStyle.Exclamation) + txtName.Focus() + Return False + End If + + Return True + End Function + + Private Sub SetForm() + 'Set Form Name + Me.Text = frmProcessManager_FormName + + 'Set Form Text + btnCancel.Text = frmProcessManager_btnCancel + btnSave.Text = frmProcessManager_btnSave + grpProcess.Text = frmProcessManager_grpProcess + btnProcessBrowse.Text = frmProcessManager_btnProcessBrowse + lblProcess.Text = frmProcessManager_lblPath + lblName.Text = frmProcessManager_lblName + btnClose.Text = frmProcessManager_btnClose + btnDelete.Text = frmProcessManager_btnDelete + btnAdd.Text = frmProcessManager_btnAdd + chkKillProcess.Text = frmProcessManager_chkKillProcess + End Sub + + Private Sub frmProcessManager_Load(sender As Object, e As EventArgs) Handles MyBase.Load + SetForm() + LoadData() + ModeChange() + AssignDirtyHandlers(grpProcess.Controls) + End Sub + + Private Sub lstProcesses_SelectedIndexChanged(sender As Object, e As EventArgs) Handles lstProcesses.SelectedIndexChanged + SwitchProcess() + End Sub + + Private Sub btnAdd_Click(sender As Object, e As EventArgs) Handles btnAdd.Click + AddProcess() + End Sub + + Private Sub btnDelete_Click(sender As Object, e As EventArgs) Handles btnDelete.Click + DeleteProcess() + End Sub + + Private Sub btnSave_Click(sender As Object, e As EventArgs) Handles btnSave.Click + SaveProcess() + End Sub + + Private Sub btnCancel_Click(sender As Object, e As EventArgs) Handles btnCancel.Click + CancelEdit() + End Sub + + Private Sub btnClose_Click(sender As Object, e As EventArgs) Handles btnClose.Click + Me.Close() + End Sub + + Private Sub btnPathBrowse_Click(sender As Object, e As EventArgs) Handles btnProcessBrowse.Click + ProcessBrowse() + End Sub + + Private Sub frmProcessManager_FormClosing(sender As Object, e As FormClosingEventArgs) Handles MyBase.FormClosing + If bIsDirty Then + Select Case HandleDirty() + Case MsgBoxResult.Yes + SaveProcess() + Case MsgBoxResult.No + 'Do Nothing + Case MsgBoxResult.Cancel + e.Cancel = True + End Select + End If + End Sub +End Class \ No newline at end of file diff --git a/GBM/Game Backup Monitor.vbproj b/GBM/Game Backup Monitor.vbproj index 88a2cc1..703c302 100644 --- a/GBM/Game Backup Monitor.vbproj +++ b/GBM/Game Backup Monitor.vbproj @@ -122,6 +122,8 @@ + + @@ -159,6 +161,12 @@ Form + + frmGameProcesses.vb + + + Form + frmGameTags.vb @@ -171,6 +179,12 @@ Form + + frmProcessManager.vb + + + Form + frmSessionExport.vb @@ -232,6 +246,8 @@ Form + + @@ -247,7 +263,7 @@ - + True @@ -277,12 +293,18 @@ frmFileFolderSearch.vb + + frmGameProcesses.vb + frmGameTags.vb frmIncludeExclude.vb + + frmProcessManager.vb + frmSessionExport.vb diff --git a/GBM/Managers/mgrGameProcesses.vb b/GBM/Managers/mgrGameProcesses.vb new file mode 100644 index 0000000..9e1565a --- /dev/null +++ b/GBM/Managers/mgrGameProcesses.vb @@ -0,0 +1,163 @@ +Public Class mgrGameProcesses + + Public Shared Sub DoGameProcessAdd(ByVal oGameProcess As clsGameProcess) + Dim oDatabase As New mgrSQLite(mgrSQLite.Database.Local) + Dim sSQL As String + Dim hshParams As New Hashtable + + sSQL = "INSERT INTO gameprocesses VALUES (@ProcessID, @MonitorID)" + hshParams.Add("ProcessID", oGameProcess.ProcessID) + hshParams.Add("MonitorID", oGameProcess.MonitorID) + oDatabase.RunParamQuery(sSQL, hshParams) + End Sub + + Public Shared Sub DoGameProcessAddBatch(ByVal oGameProcesss As List(Of clsGameProcess)) + Dim oDatabase As New mgrSQLite(mgrSQLite.Database.Local) + Dim sSQL As String + Dim hshParams As Hashtable + Dim oParamList As New List(Of Hashtable) + + sSQL = "INSERT INTO gameprocesses VALUES (@ProcessID, @MonitorID);" + + For Each oGameProcess As clsGameProcess In oGameProcesss + hshParams = New Hashtable + hshParams.Add("ProcessID", oGameProcess.ProcessID) + hshParams.Add("MonitorID", oGameProcess.MonitorID) + oParamList.Add(hshParams) + Next + + oDatabase.RunMassParamQuery(sSQL, oParamList) + End Sub + + Public Shared Sub DoGameProcessDelete(ByVal oGameProcesss As List(Of clsGameProcess)) + Dim oDatabase As New mgrSQLite(mgrSQLite.Database.Local) + Dim sSQL As String + Dim hshParams As Hashtable + Dim oParamList As New List(Of Hashtable) + + sSQL = "DELETE FROM gameprocesses " + sSQL &= "WHERE ProcessID = @ProcessID AND MonitorID = @MonitorID;" + + For Each oGameProcess As clsGameProcess In oGameProcesss + hshParams = New Hashtable + hshParams.Add("ProcessID", oGameProcess.ProcessID) + hshParams.Add("MonitorID", oGameProcess.MonitorID) + oParamList.Add(hshParams) + Next + + oDatabase.RunMassParamQuery(sSQL, oParamList) + End Sub + + Public Shared Sub DoGameProcessDeleteByGame(ByVal sMonitorID As String) + Dim oDatabase As New mgrSQLite(mgrSQLite.Database.Local) + Dim sSQL As String + Dim hshParams As New Hashtable + + sSQL = "DELETE FROM gameprocesses " + sSQL &= "WHERE MonitorID = @ID;" + + hshParams.Add("ID", sMonitorID) + + oDatabase.RunParamQuery(sSQL, hshParams) + End Sub + + + Public Shared Sub DoGameProcessDeleteByProcess(ByVal sProcessID As String) + Dim oDatabase As New mgrSQLite(mgrSQLite.Database.Local) + Dim sSQL As String + Dim hshParams As New Hashtable + + sSQL = "DELETE FROM gameprocesses " + sSQL &= "WHERE ProcessID = @ID;" + + hshParams.Add("ID", sProcessID) + + oDatabase.RunParamQuery(sSQL, hshParams) + + End Sub + + Public Shared Function GetProcessesByGame(ByVal sMonitorID As String) As Hashtable + Dim oDatabase As New mgrSQLite(mgrSQLite.Database.Local) + Dim oData As DataSet + Dim sSQL As String + Dim hshList As New Hashtable + Dim hshParams As New Hashtable + Dim oProcess As clsProcess + + sSQL = "SELECT ProcessID, processes.Name, processes.Path, processes.Args, processes.Kill FROM gameprocesses NATURAL JOIN processes WHERE MonitorID = @ID" + + hshParams.Add("ID", sMonitorID) + + oData = oDatabase.ReadParamData(sSQL, hshParams) + + For Each dr As DataRow In oData.Tables(0).Rows + oProcess = New clsProcess + oProcess.ID = CStr(dr("ProcessID")) + oProcess.Name = CStr(dr("Name")) + oProcess.Path = CStr(dr("Path")) + If Not IsDBNull(dr("Args")) Then oProcess.Args = CStr(dr("Args")) + oProcess.Kill = CBool(dr("Kill")) + + hshList.Add(oProcess.ID, oProcess) + Next + + Return hshList + End Function + + Public Shared Function GetProcessesByGameMulti(ByVal sMonitorIDs As List(Of String)) As Hashtable + Dim oDatabase As New mgrSQLite(mgrSQLite.Database.Local) + Dim oData As DataSet + Dim sSQL As String + Dim hshList As New Hashtable + Dim hshParams As New Hashtable + Dim oProcess As clsProcess + Dim iCounter As Integer + + sSQL = "SELECT DISTINCT ProcessID, processes.Name, processes.Path, processes.Args, processes.Kill FROM gameprocesses NATURAL JOIN processes WHERE MonitorID IN (" + + For Each s As String In sMonitorIDs + sSQL &= "@MonitorID" & iCounter & "," + hshParams.Add("MonitorID" & iCounter, s) + iCounter += 1 + Next + + sSQL = sSQL.TrimEnd(",") + sSQL &= ")" + + oData = oDatabase.ReadParamData(sSQL, hshParams) + + For Each dr As DataRow In oData.Tables(0).Rows + oProcess = New clsProcess + oProcess.ID = CStr(dr("ProcessID")) + oProcess.Name = CStr(dr("Name")) + oProcess.Path = CStr(dr("Path")) + If Not IsDBNull(dr("Args")) Then oProcess.Args = CStr(dr("Args")) + oProcess.Kill = CBool(dr("Kill")) + hshList.Add(oProcess.ID, oProcess) + Next + + Return hshList + End Function + + Public Shared Function ReadGameProcesss() As Hashtable + Dim oDatabase As New mgrSQLite(mgrSQLite.Database.Local) + Dim oData As DataSet + Dim sSQL As String + Dim sCompoundKey As String + Dim hshList As New Hashtable + Dim oGameProcess As clsGameProcess + + sSQL = "SELECT * from gameprocesses" + oData = oDatabase.ReadParamData(sSQL, New Hashtable) + + For Each dr As DataRow In oData.Tables(0).Rows + oGameProcess = New clsGameProcess + oGameProcess.ProcessID = CStr(dr("ProcessID")) + oGameProcess.MonitorID = CStr(dr("MonitorID")) + sCompoundKey = oGameProcess.ProcessID & ":" & oGameProcess.MonitorID + hshList.Add(sCompoundKey, oGameProcess) + Next + + Return hshList + End Function +End Class diff --git a/GBM/Managers/mgrMonitorList.vb b/GBM/Managers/mgrMonitorList.vb index eb17a5b..f944788 100644 --- a/GBM/Managers/mgrMonitorList.vb +++ b/GBM/Managers/mgrMonitorList.vb @@ -152,7 +152,11 @@ Public Class mgrMonitorList sSQL &= "Hours=@Hours, Version=@Version, Company=@Company, Enabled=@Enabled, MonitorOnly=@MonitorOnly, BackupLimit=@BackupLimit, " sSQL &= "CleanFolder=@CleanFolder, Parameter=@Parameter, Comments=@Comments, IsRegEx=@IsRegEx WHERE MonitorID=@QueryID;" sSQL &= "UPDATE gametags SET MonitorID=@ID WHERE MonitorID=@QueryID;" - sSQL &= "UPDATE sessions SET MonitorID=@ID WHERE MonitorID=@QueryID;" + + If iSelectDB = mgrSQLite.Database.Local Then + sSQL &= "UPDATE gameprocesses SET MonitorID=@ID WHERE MonitorID=@QueryID;" + sSQL &= "UPDATE sessions SET MonitorID=@ID WHERE MonitorID=@QueryID;" + End If 'Parameters hshParams = SetCoreParameters(oGame) @@ -200,6 +204,8 @@ Public Class mgrMonitorList sSQL &= "DELETE FROM gametags " sSQL &= "WHERE MonitorID = @MonitorID;" If iSelectDB = mgrSQLite.Database.Local Then + sSQL &= "DELETE FROM gameprocesses " + sSQL &= "WHERE MonitorID = @MonitorID;" sSQL &= "DELETE FROM sessions " sSQL &= "WHERE MonitorID = @MonitorID;" End If @@ -243,6 +249,18 @@ Public Class mgrMonitorList sSQL &= ");" If iSelectDB = mgrSQLite.Database.Local Then + sSQL &= "DELETE FROM gameprocesses " + sSQL &= "WHERE MonitorID IN (" + + For Each s As String In sMonitorIDs + sSQL &= "@MonitorID" & iCounter & "," + hshParams.Add("MonitorID" & iCounter, s) + iCounter += 1 + Next + + sSQL = sSQL.TrimEnd(",") + sSQL &= ");" + sSQL &= "DELETE FROM sessions " sSQL &= "WHERE MonitorID IN (" @@ -456,6 +474,8 @@ Public Class mgrMonitorList sSQL &= "DELETE FROM gametags " sSQL &= "WHERE MonitorID = @MonitorID;" If iSelectDB = mgrSQLite.Database.Local Then + sSQL &= "DELETE FROM gameprocesses " + sSQL &= "WHERE MonitorID = @MonitorID;" sSQL &= "DELETE FROM sessions " sSQL &= "WHERE MonitorID = @MonitorID;" End If diff --git a/GBM/Managers/mgrProcess.vb b/GBM/Managers/mgrProcess.vb new file mode 100644 index 0000000..db62916 --- /dev/null +++ b/GBM/Managers/mgrProcess.vb @@ -0,0 +1,152 @@ +Public Class mgrProcess + + Private Shared Function MapToObject(ByVal dr As DataRow) As clsProcess + Dim oProcess As New clsProcess + + oProcess.ID = CStr(dr("ProcessID")) + oProcess.Name = CStr(dr("Name")) + oProcess.Path = CStr(dr("Path")) + If Not IsDBNull(dr("Args")) Then oProcess.Args = CStr(dr("Args")) + oProcess.Kill = CBool(dr("Kill")) + + Return oProcess + End Function + + Private Shared Function SetCoreParameters(ByVal oProcess As clsProcess) As Hashtable + Dim hshParams As New Hashtable + + hshParams.Add("ProcessID", oProcess.ID) + hshParams.Add("Name", oProcess.Name) + hshParams.Add("Path", oProcess.Path) + hshParams.Add("Args", oProcess.Args) + hshParams.Add("Kill", oProcess.Kill) + + Return hshParams + End Function + + Public Shared Sub DoProcessAdd(ByVal oProcess As clsProcess) + Dim oDatabase As New mgrSQLite(mgrSQLite.Database.Local) + Dim sSQL As String + Dim hshParams As Hashtable + + sSQL = "INSERT INTO processes VALUES (@ProcessID, @Name, @Path, @Args, @Kill)" + hshParams = SetCoreParameters(oProcess) + oDatabase.RunParamQuery(sSQL, hshParams) + End Sub + + Public Shared Sub DoProcessUpdate(ByVal oProcess As clsProcess) + Dim oDatabase As New mgrSQLite(mgrSQLite.Database.Local) + Dim sSQL As String + Dim hshParams As Hashtable + + sSQL = "UPDATE processes SET Name=@Name, Path=@Path, Args=@Args, Kill=@Kill " + sSQL &= "WHERE ProcessID = @ProcessID" + + hshParams = SetCoreParameters(oProcess) + + oDatabase.RunParamQuery(sSQL, hshParams) + + End Sub + + Public Shared Sub DoProcessDelete(ByVal sProcessID As String) + Dim oDatabase As New mgrSQLite(mgrSQLite.Database.Local) + Dim sSQL As String + Dim hshParams As New Hashtable + + sSQL = "DELETE FROM gameprocesses " + sSQL &= "WHERE ProcessID = @ProcessID;" + sSQL &= "DELETE FROM processes " + sSQL &= "WHERE ProcessID = @ProcessID;" + + hshParams.Add("ProcessID", sProcessID) + + oDatabase.RunParamQuery(sSQL, hshParams) + + End Sub + + Public Shared Function DoProcessGetbyID(ByVal sProcessID As String) As clsProcess + Dim oDatabase As New mgrSQLite(mgrSQLite.Database.Local) + Dim sSQL As String + Dim oData As DataSet + Dim oProcess As New clsProcess + Dim hshParams As New Hashtable + + sSQL = "SELECT * FROM processes " + sSQL &= "WHERE ProcessID = @ProcessID" + + hshParams.Add("ProcessID", sProcessID) + + oData = oDatabase.ReadParamData(sSQL, hshParams) + + For Each dr As DataRow In oData.Tables(0).Rows + oProcess = MapToObject(dr) + Next + + Return oProcess + End Function + + Public Shared Function DoProcessGetbyName(ByVal sProcessName As String) As clsProcess + Dim oDatabase As New mgrSQLite(mgrSQLite.Database.Local) + Dim sSQL As String + Dim oData As DataSet + Dim oProcess As New clsProcess + Dim hshParams As New Hashtable + + sSQL = "SELECT * FROM processes " + sSQL &= "WHERE Name = @Name" + + hshParams.Add("Name", sProcessName) + + oData = oDatabase.ReadParamData(sSQL, hshParams) + + For Each dr As DataRow In oData.Tables(0).Rows + oProcess = MapToObject(dr) + Next + + Return oProcess + End Function + + Public Shared Function DoCheckDuplicate(ByVal sName As String, Optional ByVal sExcludeID As String = "") As Boolean + Dim oDatabase As New mgrSQLite(mgrSQLite.Database.Local) + Dim sSQL As String + Dim oData As DataSet + Dim hshParams As New Hashtable + + sSQL = "SELECT * FROM processes " + sSQL &= "WHERE Name = @Name" + + hshParams.Add("Name", sName) + + If sExcludeID <> String.Empty Then + sSQL &= " AND ProcessID <> @ProcessID" + hshParams.Add("ProcessID", sExcludeID) + End If + + oData = oDatabase.ReadParamData(sSQL, hshParams) + + If oData.Tables(0).Rows.Count > 0 Then + Return True + Else + Return False + End If + End Function + + Public Shared Function ReadProcesses() As Hashtable + Dim oDatabase As New mgrSQLite(mgrSQLite.Database.Local) + Dim oData As DataSet + Dim sSQL As String + Dim hshList As New Hashtable + Dim oProcess As clsProcess + + sSQL = "SELECT * from processes" + oData = oDatabase.ReadParamData(sSQL, New Hashtable) + + For Each dr As DataRow In oData.Tables(0).Rows + oProcess = MapToObject(dr) + hshList.Add(oProcess.Name, oProcess) + Next + + Return hshList + End Function + +End Class diff --git a/GBM/Managers/mgrProcesses.vb b/GBM/Managers/mgrProcessDetection.vb similarity index 99% rename from GBM/Managers/mgrProcesses.vb rename to GBM/Managers/mgrProcessDetection.vb index 7d4d230..cfc4216 100644 --- a/GBM/Managers/mgrProcesses.vb +++ b/GBM/Managers/mgrProcessDetection.vb @@ -2,7 +2,7 @@ Imports System.Management Imports System.Text.RegularExpressions -Public Class mgrProcesses +Public Class mgrProcessDetection Private prsFoundProcess As Process Private dStartTime As DateTime = Now, dEndTime As DateTime = Now diff --git a/GBM/Managers/mgrSQLite.vb b/GBM/Managers/mgrSQLite.vb index 667b692..ef1a751 100644 --- a/GBM/Managers/mgrSQLite.vb +++ b/GBM/Managers/mgrSQLite.vb @@ -102,6 +102,12 @@ Public Class mgrSQLite 'Add Tables (Sessions) sSql &= "CREATE TABLE sessions (MonitorID TEXT NOT NULL, Start INTEGER NOT NULL, End INTEGER NOT NULL, PRIMARY KEY(MonitorID, Start));" + 'Add Tables (Processes) + sSql &= "CREATE TABLE processes (ProcessID TEXT NOT NULL PRIMARY KEY, Name Text NOT NULL, Path TEXT NOT NULL, Args TEXT, Kill BOOLEAN NOT NULL);" + + 'Add Tables (Game Processes) + sSql &= "CREATE TABLE gameprocesses (ProcessID TEXT NOT NULL, MonitorID TEXT NOT NULL, PRIMARY KEY(ProcessID, MonitorID));" + 'Set Version sSql &= "PRAGMA user_version=" & mgrCommon.AppVersion @@ -767,6 +773,10 @@ Public Class mgrSQLite 'Backup DB before starting BackupDB("v108") + 'Add Tables + sSQL = "CREATE TABLE processes (ProcessID TEXT NOT NULL PRIMARY KEY, Name Text NOT NULL, Path TEXT NOT NULL, Args TEXT, Kill BOOLEAN NOT NULL);" + sSQL &= "CREATE TABLE gameprocesses (ProcessID TEXT NOT NULL, MonitorID TEXT NOT NULL, PRIMARY KEY(ProcessID, MonitorID));" + 'Overhaul Tables sSQL = "CREATE TABLE settings_new (SettingsID INTEGER NOT NULL PRIMARY KEY, MonitorOnStartup BOOLEAN NOT NULL, StartToTray BOOLEAN NOT NULL, ShowDetectionToolTips BOOLEAN NOT NULL, " & "DisableConfirmation BOOLEAN NOT NULL, CreateSubFolder BOOLEAN NOT NULL, ShowOverwriteWarning BOOLEAN NOT NULL, RestoreOnLaunch BOOLEAN NOT NULL, " & diff --git a/GBM/My Project/Resources.Designer.vb b/GBM/My Project/Resources.Designer.vb index d1f6800..b659a16 100644 --- a/GBM/My Project/Resources.Designer.vb +++ b/GBM/My Project/Resources.Designer.vb @@ -105,6 +105,15 @@ Namespace My.Resources End Get End Property + ''' + ''' Looks up a localized string similar to Error: [PARAM]. + ''' + Friend ReadOnly Property App_GenericError() As String + Get + Return ResourceManager.GetString("App_GenericError", resourceCulture) + End Get + End Property + ''' ''' Looks up a localized string similar to 7-Zip (7za.exe) is invalid and has been prevented from running.. ''' @@ -2382,6 +2391,78 @@ Namespace My.Resources End Get End Property + ''' + ''' Looks up a localized string similar to >. + ''' + Friend ReadOnly Property frmGameProcesses_btnAdd() As String + Get + Return ResourceManager.GetString("frmGameProcesses_btnAdd", resourceCulture) + End Get + End Property + + ''' + ''' Looks up a localized string similar to &Close. + ''' + Friend ReadOnly Property frmGameProcesses_btnClose() As String + Get + Return ResourceManager.GetString("frmGameProcesses_btnClose", resourceCulture) + End Get + End Property + + ''' + ''' Looks up a localized string similar to Process &Manager.... + ''' + Friend ReadOnly Property frmGameProcesses_btnOpenProcesses() As String + Get + Return ResourceManager.GetString("frmGameProcesses_btnOpenProcesses", resourceCulture) + End Get + End Property + + ''' + ''' Looks up a localized string similar to <. + ''' + Friend ReadOnly Property frmGameProcesses_btnRemove() As String + Get + Return ResourceManager.GetString("frmGameProcesses_btnRemove", resourceCulture) + End Get + End Property + + ''' + ''' Looks up a localized string similar to Edit Processes for Multiple Games. + ''' + Friend ReadOnly Property frmGameProcesses_FormNameMulti() As String + Get + Return ResourceManager.GetString("frmGameProcesses_FormNameMulti", resourceCulture) + End Get + End Property + + ''' + ''' Looks up a localized string similar to Edit Processes for [PARAM]. + ''' + Friend ReadOnly Property frmGameProcesses_FormNameSingle() As String + Get + Return ResourceManager.GetString("frmGameProcesses_FormNameSingle", resourceCulture) + End Get + End Property + + ''' + ''' Looks up a localized string similar to Current Processes. + ''' + Friend ReadOnly Property frmGameProcesses_lblGameProccesses() As String + Get + Return ResourceManager.GetString("frmGameProcesses_lblGameProccesses", resourceCulture) + End Get + End Property + + ''' + ''' Looks up a localized string similar to Available Processes. + ''' + Friend ReadOnly Property frmGameProcesses_lblProcesses() As String + Get + Return ResourceManager.GetString("frmGameProcesses_lblProcesses", resourceCulture) + End Get + End Property + ''' ''' Looks up a localized string similar to >. ''' @@ -2994,6 +3075,15 @@ Namespace My.Resources End Get End Property + ''' + ''' Looks up a localized string similar to An error occured when attempting to end a process associated with [PARAM].. + ''' + Friend ReadOnly Property frmMain_ErrorEndChildProcess() As String + Get + Return ResourceManager.GetString("frmMain_ErrorEndChildProcess", resourceCulture) + End Get + End Property + ''' ''' Looks up a localized string similar to An unexpected error occured while initializing GBM.[BR][BR][PARAM][BR][BR]Do you wish to continue anyway? (Not Recommended). ''' @@ -3066,6 +3156,15 @@ Namespace My.Resources End Get End Property + ''' + ''' Looks up a localized string similar to An error occured when attempting to start a process associated with [PARAM].. + ''' + Friend ReadOnly Property frmMain_ErrorStartChildProcess() As String + Get + Return ResourceManager.GetString("frmMain_ErrorStartChildProcess", resourceCulture) + End Get + End Property + ''' ''' Looks up a localized string similar to [PARAM] (Executable Path). ''' @@ -3264,6 +3363,15 @@ Namespace My.Resources End Get End Property + ''' + ''' Looks up a localized string similar to Process &Manager.... + ''' + Friend ReadOnly Property frmMain_gMonSetupProcessManager() As String + Get + Return ResourceManager.GetString("frmMain_gMonSetupProcessManager", resourceCulture) + End Get + End Property + ''' ''' Looks up a localized string similar to &Tags.... ''' @@ -3723,6 +3831,168 @@ Namespace My.Resources End Get End Property + ''' + ''' Looks up a localized string similar to +. + ''' + Friend ReadOnly Property frmProcessManager_btnAdd() As String + Get + Return ResourceManager.GetString("frmProcessManager_btnAdd", resourceCulture) + End Get + End Property + + ''' + ''' Looks up a localized string similar to &Cancel. + ''' + Friend ReadOnly Property frmProcessManager_btnCancel() As String + Get + Return ResourceManager.GetString("frmProcessManager_btnCancel", resourceCulture) + End Get + End Property + + ''' + ''' Looks up a localized string similar to C&lose. + ''' + Friend ReadOnly Property frmProcessManager_btnClose() As String + Get + Return ResourceManager.GetString("frmProcessManager_btnClose", resourceCulture) + End Get + End Property + + ''' + ''' Looks up a localized string similar to -. + ''' + Friend ReadOnly Property frmProcessManager_btnDelete() As String + Get + Return ResourceManager.GetString("frmProcessManager_btnDelete", resourceCulture) + End Get + End Property + + ''' + ''' Looks up a localized string similar to .... + ''' + Friend ReadOnly Property frmProcessManager_btnProcessBrowse() As String + Get + Return ResourceManager.GetString("frmProcessManager_btnProcessBrowse", resourceCulture) + End Get + End Property + + ''' + ''' Looks up a localized string similar to &Save. + ''' + Friend ReadOnly Property frmProcessManager_btnSave() As String + Get + Return ResourceManager.GetString("frmProcessManager_btnSave", resourceCulture) + End Get + End Property + + ''' + ''' Looks up a localized string similar to Kill process when game is closed.. + ''' + Friend ReadOnly Property frmProcessManager_chkKillProcess() As String + Get + Return ResourceManager.GetString("frmProcessManager_chkKillProcess", resourceCulture) + End Get + End Property + + ''' + ''' Looks up a localized string similar to Choose a file that starts the process. + ''' + Friend ReadOnly Property frmProcessManager_ChooseProcess() As String + Get + Return ResourceManager.GetString("frmProcessManager_ChooseProcess", resourceCulture) + End Get + End Property + + ''' + ''' Looks up a localized string similar to Are you sure you want to delete [PARAM]? This cannot be undone.. + ''' + Friend ReadOnly Property frmProcessManager_ConfirmDelete() As String + Get + Return ResourceManager.GetString("frmProcessManager_ConfirmDelete", resourceCulture) + End Get + End Property + + ''' + ''' Looks up a localized string similar to A process with this name already exists.. + ''' + Friend ReadOnly Property frmProcessManager_ErrorDupe() As String + Get + Return ResourceManager.GetString("frmProcessManager_ErrorDupe", resourceCulture) + End Get + End Property + + ''' + ''' Looks up a localized string similar to The process does not exist.. + ''' + Friend ReadOnly Property frmProcessManager_ErrorPathNotFound() As String + Get + Return ResourceManager.GetString("frmProcessManager_ErrorPathNotFound", resourceCulture) + End Get + End Property + + ''' + ''' Looks up a localized string similar to You must enter a valid name for this process.. + ''' + Friend ReadOnly Property frmProcessManager_ErrorValidName() As String + Get + Return ResourceManager.GetString("frmProcessManager_ErrorValidName", resourceCulture) + End Get + End Property + + ''' + ''' Looks up a localized string similar to You must choose a valid process.. + ''' + Friend ReadOnly Property frmProcessManager_ErrorValidPath() As String + Get + Return ResourceManager.GetString("frmProcessManager_ErrorValidPath", resourceCulture) + End Get + End Property + + ''' + ''' Looks up a localized string similar to Executable. + ''' + Friend ReadOnly Property frmProcessManager_Executable() As String + Get + Return ResourceManager.GetString("frmProcessManager_Executable", resourceCulture) + End Get + End Property + + ''' + ''' Looks up a localized string similar to Process Manager. + ''' + Friend ReadOnly Property frmProcessManager_FormName() As String + Get + Return ResourceManager.GetString("frmProcessManager_FormName", resourceCulture) + End Get + End Property + + ''' + ''' Looks up a localized string similar to Configuration. + ''' + Friend ReadOnly Property frmProcessManager_grpProcess() As String + Get + Return ResourceManager.GetString("frmProcessManager_grpProcess", resourceCulture) + End Get + End Property + + ''' + ''' Looks up a localized string similar to Name:. + ''' + Friend ReadOnly Property frmProcessManager_lblName() As String + Get + Return ResourceManager.GetString("frmProcessManager_lblName", resourceCulture) + End Get + End Property + + ''' + ''' Looks up a localized string similar to Path:. + ''' + Friend ReadOnly Property frmProcessManager_lblPath() As String + Get + Return ResourceManager.GetString("frmProcessManager_lblPath", resourceCulture) + End Get + End Property + ''' ''' Looks up a localized string similar to &Cancel. ''' diff --git a/GBM/My Project/Resources.resx b/GBM/My Project/Resources.resx index 5f53281..ffdbbd1 100644 --- a/GBM/My Project/Resources.resx +++ b/GBM/My Project/Resources.resx @@ -2068,4 +2068,94 @@ Backup GBM data files on launch + + An error occured when attempting to end a process associated with [PARAM]. + + + An error occured when attempting to start a process associated with [PARAM]. + + + + + + + &Cancel + + + C&lose + + + - + + + ... + + + &Save + + + Are you sure you want to delete [PARAM]? This cannot be undone. + + + A process with this name already exists. + + + The process does not exist. + + + You must enter a valid name for this process. + + + You must choose a valid process. + + + Process Manager + + + Configuration + + + Name: + + + Path: + + + Process &Manager... + + + Choose a file that starts the process + + + Executable + + + Kill process when game is closed. + + + > + + + &Close + + + Process &Manager... + + + < + + + Edit Processes for Multiple Games + + + Edit Processes for [PARAM] + + + Current Processes + + + Available Processes + + + Error: [PARAM] + \ No newline at end of file diff --git a/GBM/readme.txt b/GBM/readme.txt index 0753b4d..dc452b6 100644 --- a/GBM/readme.txt +++ b/GBM/readme.txt @@ -22,6 +22,12 @@ All Platforms: - When a game is deleted via Game Manager (or sync), all backup manifest entries for that particular game are now deleted. The backup files themselves are not. - The Game Manager now syncs changes to the remote database immediately, instead of only when closed. - Feature Changes + - Added the ability to start another process (or multiple process) whenever a game is detected. (Thanks for the suggestion Naliel Supremo) + - This is useful to automatically start utilities, such as custom control schemes or overlays, for specific games. + - The "Process Manager" allows you to manage any programs you'd like to launch. + - The "Processes..." button on the Game Manager allows you to assign processes to any selected game. + - A process can be set to end when the game is closed. + - Processes and related settings are specific to the local machine only. They are not synced to the backup folder and are not part of the import/export. - Added "Backup GBM data files on launch" to the settings. A long overdue feature, this will backup both the remote and local databases (as gbm.s3db.launch.bak) each time GBM starts. - This new setting is enabled by default. - Only one backup is kept, the prior one will be overwritten. @@ -57,6 +63,7 @@ Known Issues: - If one or more Game IDs are changed on one computer and these changes are synced to another PC sharing the same backup folder: - The local session data on that PC for the changed game(s) will be lost. + - Any processes assigned to the changed games(s) on that PC will be lost. - The local backup manifest data for the changed game(s) on that PC will be reset. GBM will see any backups for the changed game(s) as new and will handle them accordingly. - Backup files made prior to v1.1.0 are not being renamed or removed when a new backup is created. - This is due to file name now being generated by the Game ID and not the name. @@ -65,5 +72,8 @@ Known Issues: - Configurations on the official game list are no longer fully compatible with older GBM versions. - Technically they will work. But any game imported with a special character in it's name, such as a colon, will not create backup files correctly. - These characters can be manually removed from the game name after importing, then the configurations will function properly. +- The error "The requested operation requires elevation" occurs when GBM tries to launch a process associated with a game. + - This means the process you're trying to launch with GBM requires administrator privilege. + - Click the blue "user" icon on the bottom left of the GBM window to quickly switch to administrator mode. The entire version history of GBM releases is available at http://mikemaximus.github.io/gbm-web/versionhistory.html \ No newline at end of file From 108ab4931fb7eeef476e6df8dc562ff46b04bad1 Mon Sep 17 00:00:00 2001 From: MikeMaximus Date: Thu, 8 Mar 2018 18:49:11 -0600 Subject: [PATCH 31/38] Minor changes to process and tag features --- GBM/Forms/frmGameProcesses.Designer.vb | 16 ++++---- GBM/Forms/frmMain.Designer.vb | 16 ++++---- GBM/Forms/frmMain.vb | 11 +++++- GBM/Forms/frmProcessManager.Designer.vb | 50 ++++++++++++------------- GBM/My Project/Resources.Designer.vb | 30 ++++++++++++--- GBM/My Project/Resources.resx | 18 ++++++--- GBM/readme.txt | 2 +- 7 files changed, 87 insertions(+), 56 deletions(-) diff --git a/GBM/Forms/frmGameProcesses.Designer.vb b/GBM/Forms/frmGameProcesses.Designer.vb index 090fc0e..d34356f 100644 --- a/GBM/Forms/frmGameProcesses.Designer.vb +++ b/GBM/Forms/frmGameProcesses.Designer.vb @@ -37,7 +37,7 @@ Partial Class frmGameProcesses Me.btnOpenProcesses.Location = New System.Drawing.Point(12, 229) Me.btnOpenProcesses.Name = "btnOpenProcesses" Me.btnOpenProcesses.Size = New System.Drawing.Size(110, 23) - Me.btnOpenProcesses.TabIndex = 12 + Me.btnOpenProcesses.TabIndex = 4 Me.btnOpenProcesses.Text = "&Process Manager..." Me.btnOpenProcesses.UseVisualStyleBackColor = True ' @@ -46,7 +46,7 @@ Partial Class frmGameProcesses Me.btnClose.Location = New System.Drawing.Point(297, 229) Me.btnClose.Name = "btnClose" Me.btnClose.Size = New System.Drawing.Size(75, 23) - Me.btnClose.TabIndex = 13 + Me.btnClose.TabIndex = 5 Me.btnClose.Text = "&Close" Me.btnClose.UseVisualStyleBackColor = True ' @@ -56,7 +56,7 @@ Partial Class frmGameProcesses Me.lblGameProcesses.Location = New System.Drawing.Point(251, 8) Me.lblGameProcesses.Name = "lblGameProcesses" Me.lblGameProcesses.Size = New System.Drawing.Size(93, 13) - Me.lblGameProcesses.TabIndex = 6 + Me.lblGameProcesses.TabIndex = 0 Me.lblGameProcesses.Text = "Current Processes" ' 'lblProcesses @@ -65,7 +65,7 @@ Partial Class frmGameProcesses Me.lblProcesses.Location = New System.Drawing.Point(36, 8) Me.lblProcesses.Name = "lblProcesses" Me.lblProcesses.Size = New System.Drawing.Size(102, 13) - Me.lblProcesses.TabIndex = 7 + Me.lblProcesses.TabIndex = 0 Me.lblProcesses.Text = "Available Processes" ' 'btnRemove @@ -73,7 +73,7 @@ Partial Class frmGameProcesses Me.btnRemove.Location = New System.Drawing.Point(168, 114) Me.btnRemove.Name = "btnRemove" Me.btnRemove.Size = New System.Drawing.Size(48, 23) - Me.btnRemove.TabIndex = 10 + Me.btnRemove.TabIndex = 2 Me.btnRemove.Text = "<" Me.btnRemove.UseVisualStyleBackColor = True ' @@ -82,7 +82,7 @@ Partial Class frmGameProcesses Me.btnAdd.Location = New System.Drawing.Point(168, 85) Me.btnAdd.Name = "btnAdd" Me.btnAdd.Size = New System.Drawing.Size(48, 23) - Me.btnAdd.TabIndex = 9 + Me.btnAdd.TabIndex = 1 Me.btnAdd.Text = ">" Me.btnAdd.UseVisualStyleBackColor = True ' @@ -94,7 +94,7 @@ Partial Class frmGameProcesses Me.lstGameProcesses.SelectionMode = System.Windows.Forms.SelectionMode.MultiExtended Me.lstGameProcesses.Size = New System.Drawing.Size(150, 199) Me.lstGameProcesses.Sorted = True - Me.lstGameProcesses.TabIndex = 11 + Me.lstGameProcesses.TabIndex = 3 ' 'lstProcesses ' @@ -104,7 +104,7 @@ Partial Class frmGameProcesses Me.lstProcesses.SelectionMode = System.Windows.Forms.SelectionMode.MultiExtended Me.lstProcesses.Size = New System.Drawing.Size(150, 199) Me.lstProcesses.Sorted = True - Me.lstProcesses.TabIndex = 8 + Me.lstProcesses.TabIndex = 0 ' 'frmGameProcesses ' diff --git a/GBM/Forms/frmMain.Designer.vb b/GBM/Forms/frmMain.Designer.vb index d95579d..8e2d291 100644 --- a/GBM/Forms/frmMain.Designer.vb +++ b/GBM/Forms/frmMain.Designer.vb @@ -145,7 +145,7 @@ Partial Class frmMain ' 'gMonTraySetup ' - Me.gMonTraySetup.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.gMonTraySetupAddWizard, Me.gMonTraySetupGameManager, Me.gMonTraySetupCustomVariables, Me.gMonTraySetupTags, Me.gMonTraySetupProcessManager}) + Me.gMonTraySetup.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.gMonTraySetupAddWizard, Me.gMonTraySetupGameManager, Me.gMonTraySetupTags, Me.gMonTraySetupProcessManager, Me.gMonTraySetupCustomVariables}) Me.gMonTraySetup.Name = "gMonTraySetup" Me.gMonTraySetup.Size = New System.Drawing.Size(161, 22) Me.gMonTraySetup.Text = "&Setup" @@ -166,19 +166,19 @@ Partial Class frmMain ' Me.gMonTraySetupCustomVariables.Name = "gMonTraySetupCustomVariables" Me.gMonTraySetupCustomVariables.Size = New System.Drawing.Size(201, 22) - Me.gMonTraySetupCustomVariables.Text = "Custom &Path Variables..." + Me.gMonTraySetupCustomVariables.Text = "Custom Path &Variables..." ' 'gMonTraySetupTags ' Me.gMonTraySetupTags.Name = "gMonTraySetupTags" Me.gMonTraySetupTags.Size = New System.Drawing.Size(201, 22) - Me.gMonTraySetupTags.Text = "&Tags..." + Me.gMonTraySetupTags.Text = "&Tag Manager..." ' 'gMonTraySetupProcessManager ' Me.gMonTraySetupProcessManager.Name = "gMonTraySetupProcessManager" Me.gMonTraySetupProcessManager.Size = New System.Drawing.Size(201, 22) - Me.gMonTraySetupProcessManager.Text = "Process &Manager..." + Me.gMonTraySetupProcessManager.Text = "&Process Manager..." ' 'gMonTrayTools ' @@ -350,7 +350,7 @@ Partial Class frmMain ' 'gMonSetup ' - Me.gMonSetup.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.gMonSetupGameManager, Me.gMonSetupAddWizard, Me.gMonSetupCustomVariables, Me.gMonSetupTags, Me.gMonSetupProcessManager}) + Me.gMonSetup.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.gMonSetupGameManager, Me.gMonSetupAddWizard, Me.gMonSetupTags, Me.gMonSetupProcessManager, Me.gMonSetupCustomVariables}) Me.gMonSetup.Name = "gMonSetup" Me.gMonSetup.Size = New System.Drawing.Size(49, 20) Me.gMonSetup.Text = "&Setup" @@ -371,19 +371,19 @@ Partial Class frmMain ' Me.gMonSetupCustomVariables.Name = "gMonSetupCustomVariables" Me.gMonSetupCustomVariables.Size = New System.Drawing.Size(201, 22) - Me.gMonSetupCustomVariables.Text = "Custom &Path Variables..." + Me.gMonSetupCustomVariables.Text = "Custom Path &Variables..." ' 'gMonSetupTags ' Me.gMonSetupTags.Name = "gMonSetupTags" Me.gMonSetupTags.Size = New System.Drawing.Size(201, 22) - Me.gMonSetupTags.Text = "&Tags..." + Me.gMonSetupTags.Text = "&Tag Manager..." ' 'gMonSetupProcessManager ' Me.gMonSetupProcessManager.Name = "gMonSetupProcessManager" Me.gMonSetupProcessManager.Size = New System.Drawing.Size(201, 22) - Me.gMonSetupProcessManager.Text = "Process &Manager..." + Me.gMonSetupProcessManager.Text = "&Process Manager..." ' 'gMonTools ' diff --git a/GBM/Forms/frmMain.vb b/GBM/Forms/frmMain.vb index 77628f7..3862a08 100644 --- a/GBM/Forms/frmMain.vb +++ b/GBM/Forms/frmMain.vb @@ -1474,11 +1474,15 @@ Public Class frmMain End Function Private Sub StartChildProcesses() + Dim oCurrentProcess As clsProcess Dim prsChild As Process Try - For Each prsChild In oChildProcesses.Values + For Each de As DictionaryEntry In oChildProcesses + oCurrentProcess = DirectCast(de.Key, clsProcess) + prsChild = DirectCast(de.Value, Process) prsChild.Start() + UpdateLog(mgrCommon.FormatString(frmMain_ProcessStarted, oCurrentProcess.Name), False) Next Catch ex As Exception UpdateLog(mgrCommon.FormatString(frmMain_ErrorStartChildProcess, oProcess.GameInfo.CroppedName), True, ToolTipIcon.Error) @@ -1494,7 +1498,10 @@ Public Class frmMain For Each de As DictionaryEntry In oChildProcesses oCurrentProcess = DirectCast(de.Key, clsProcess) prsChild = DirectCast(de.Value, Process) - prsChild.Kill() + If oCurrentProcess.Kill Then + prsChild.Kill() + UpdateLog(mgrCommon.FormatString(frmMain_ProcessKilled, oCurrentProcess.Name), False) + End If Next Catch ex As Exception diff --git a/GBM/Forms/frmProcessManager.Designer.vb b/GBM/Forms/frmProcessManager.Designer.vb index c461335..daa977c 100644 --- a/GBM/Forms/frmProcessManager.Designer.vb +++ b/GBM/Forms/frmProcessManager.Designer.vb @@ -23,6 +23,7 @@ Partial Class frmProcessManager _ Private Sub InitializeComponent() Me.grpProcess = New System.Windows.Forms.GroupBox() + Me.chkKillProcess = New System.Windows.Forms.CheckBox() Me.txtArguments = New System.Windows.Forms.TextBox() Me.lblArguments = New System.Windows.Forms.Label() Me.btnProcessBrowse = New System.Windows.Forms.Button() @@ -37,7 +38,6 @@ Partial Class frmProcessManager Me.txtID = New System.Windows.Forms.TextBox() Me.btnCancel = New System.Windows.Forms.Button() Me.btnSave = New System.Windows.Forms.Button() - Me.chkKillProcess = New System.Windows.Forms.CheckBox() Me.grpProcess.SuspendLayout() Me.SuspendLayout() ' @@ -54,16 +54,26 @@ Partial Class frmProcessManager Me.grpProcess.Location = New System.Drawing.Point(238, 12) Me.grpProcess.Name = "grpProcess" Me.grpProcess.Size = New System.Drawing.Size(334, 120) - Me.grpProcess.TabIndex = 11 + Me.grpProcess.TabIndex = 3 Me.grpProcess.TabStop = False Me.grpProcess.Text = "Configuration" ' + 'chkKillProcess + ' + Me.chkKillProcess.AutoSize = True + Me.chkKillProcess.Location = New System.Drawing.Point(72, 96) + Me.chkKillProcess.Name = "chkKillProcess" + Me.chkKillProcess.Size = New System.Drawing.Size(184, 17) + Me.chkKillProcess.TabIndex = 4 + Me.chkKillProcess.Text = "Kill process when game is closed." + Me.chkKillProcess.UseVisualStyleBackColor = True + ' 'txtArguments ' Me.txtArguments.Location = New System.Drawing.Point(72, 70) Me.txtArguments.Name = "txtArguments" Me.txtArguments.Size = New System.Drawing.Size(256, 20) - Me.txtArguments.TabIndex = 5 + Me.txtArguments.TabIndex = 3 ' 'lblArguments ' @@ -71,7 +81,7 @@ Partial Class frmProcessManager Me.lblArguments.Location = New System.Drawing.Point(6, 73) Me.lblArguments.Name = "lblArguments" Me.lblArguments.Size = New System.Drawing.Size(60, 13) - Me.lblArguments.TabIndex = 4 + Me.lblArguments.TabIndex = 0 Me.lblArguments.Text = "Arguments:" ' 'btnProcessBrowse @@ -79,7 +89,7 @@ Partial Class frmProcessManager Me.btnProcessBrowse.Location = New System.Drawing.Point(298, 45) Me.btnProcessBrowse.Name = "btnProcessBrowse" Me.btnProcessBrowse.Size = New System.Drawing.Size(30, 20) - Me.btnProcessBrowse.TabIndex = 3 + Me.btnProcessBrowse.TabIndex = 2 Me.btnProcessBrowse.Text = "..." Me.btnProcessBrowse.UseVisualStyleBackColor = True ' @@ -88,14 +98,14 @@ Partial Class frmProcessManager Me.txtName.Location = New System.Drawing.Point(72, 19) Me.txtName.Name = "txtName" Me.txtName.Size = New System.Drawing.Size(256, 20) - Me.txtName.TabIndex = 1 + Me.txtName.TabIndex = 0 ' 'txtPath ' Me.txtPath.Location = New System.Drawing.Point(72, 45) Me.txtPath.Name = "txtPath" Me.txtPath.Size = New System.Drawing.Size(220, 20) - Me.txtPath.TabIndex = 2 + Me.txtPath.TabIndex = 1 ' 'lblProcess ' @@ -103,7 +113,7 @@ Partial Class frmProcessManager Me.lblProcess.Location = New System.Drawing.Point(6, 48) Me.lblProcess.Name = "lblProcess" Me.lblProcess.Size = New System.Drawing.Size(48, 13) - Me.lblProcess.TabIndex = 1 + Me.lblProcess.TabIndex = 0 Me.lblProcess.Text = "Process:" ' 'lblName @@ -121,7 +131,7 @@ Partial Class frmProcessManager Me.btnClose.Location = New System.Drawing.Point(497, 226) Me.btnClose.Name = "btnClose" Me.btnClose.Size = New System.Drawing.Size(75, 23) - Me.btnClose.TabIndex = 14 + Me.btnClose.TabIndex = 6 Me.btnClose.Text = "C&lose" Me.btnClose.UseVisualStyleBackColor = True ' @@ -132,7 +142,7 @@ Partial Class frmProcessManager Me.btnDelete.Location = New System.Drawing.Point(48, 226) Me.btnDelete.Name = "btnDelete" Me.btnDelete.Size = New System.Drawing.Size(30, 23) - Me.btnDelete.TabIndex = 10 + Me.btnDelete.TabIndex = 2 Me.btnDelete.Text = "-" Me.btnDelete.UseVisualStyleBackColor = True ' @@ -143,7 +153,7 @@ Partial Class frmProcessManager Me.btnAdd.Location = New System.Drawing.Point(12, 226) Me.btnAdd.Name = "btnAdd" Me.btnAdd.Size = New System.Drawing.Size(30, 23) - Me.btnAdd.TabIndex = 9 + Me.btnAdd.TabIndex = 1 Me.btnAdd.Text = "+" Me.btnAdd.UseVisualStyleBackColor = True ' @@ -154,7 +164,7 @@ Partial Class frmProcessManager Me.lstProcesses.Name = "lstProcesses" Me.lstProcesses.Size = New System.Drawing.Size(220, 212) Me.lstProcesses.Sorted = True - Me.lstProcesses.TabIndex = 7 + Me.lstProcesses.TabIndex = 0 ' 'txtID ' @@ -162,7 +172,7 @@ Partial Class frmProcessManager Me.txtID.Location = New System.Drawing.Point(374, 150) Me.txtID.Name = "txtID" Me.txtID.Size = New System.Drawing.Size(33, 20) - Me.txtID.TabIndex = 8 + Me.txtID.TabIndex = 0 Me.txtID.TabStop = False Me.txtID.Visible = False ' @@ -172,7 +182,7 @@ Partial Class frmProcessManager Me.btnCancel.Location = New System.Drawing.Point(494, 149) Me.btnCancel.Name = "btnCancel" Me.btnCancel.Size = New System.Drawing.Size(75, 23) - Me.btnCancel.TabIndex = 13 + Me.btnCancel.TabIndex = 5 Me.btnCancel.Text = "&Cancel" Me.btnCancel.UseVisualStyleBackColor = True ' @@ -182,20 +192,10 @@ Partial Class frmProcessManager Me.btnSave.Location = New System.Drawing.Point(413, 149) Me.btnSave.Name = "btnSave" Me.btnSave.Size = New System.Drawing.Size(75, 23) - Me.btnSave.TabIndex = 12 + Me.btnSave.TabIndex = 4 Me.btnSave.Text = "&Save" Me.btnSave.UseVisualStyleBackColor = True ' - 'chkKillProcess - ' - Me.chkKillProcess.AutoSize = True - Me.chkKillProcess.Location = New System.Drawing.Point(72, 96) - Me.chkKillProcess.Name = "chkKillProcess" - Me.chkKillProcess.Size = New System.Drawing.Size(184, 17) - Me.chkKillProcess.TabIndex = 6 - Me.chkKillProcess.Text = "Kill process when game is closed." - Me.chkKillProcess.UseVisualStyleBackColor = True - ' 'frmProcessManager ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) diff --git a/GBM/My Project/Resources.Designer.vb b/GBM/My Project/Resources.Designer.vb index b659a16..c2343c9 100644 --- a/GBM/My Project/Resources.Designer.vb +++ b/GBM/My Project/Resources.Designer.vb @@ -2410,7 +2410,7 @@ Namespace My.Resources End Property ''' - ''' Looks up a localized string similar to Process &Manager.... + ''' Looks up a localized string similar to &Process Manager.... ''' Friend ReadOnly Property frmGameProcesses_btnOpenProcesses() As String Get @@ -2482,7 +2482,7 @@ Namespace My.Resources End Property ''' - ''' Looks up a localized string similar to Setup &Tags.... + ''' Looks up a localized string similar to &Tag Manager.... ''' Friend ReadOnly Property frmGameTags_btnOpenTags() As String Get @@ -3346,7 +3346,7 @@ Namespace My.Resources End Property ''' - ''' Looks up a localized string similar to Custom &Path Variables.... + ''' Looks up a localized string similar to Custom Path &Variables.... ''' Friend ReadOnly Property frmMain_gMonSetupCustomVariables() As String Get @@ -3364,7 +3364,7 @@ Namespace My.Resources End Property ''' - ''' Looks up a localized string similar to Process &Manager.... + ''' Looks up a localized string similar to &Process Manager.... ''' Friend ReadOnly Property frmMain_gMonSetupProcessManager() As String Get @@ -3373,7 +3373,7 @@ Namespace My.Resources End Property ''' - ''' Looks up a localized string similar to &Tags.... + ''' Looks up a localized string similar to &Tag Manager.... ''' Friend ReadOnly Property frmMain_gMonSetupTags() As String Get @@ -3696,6 +3696,24 @@ Namespace My.Resources End Get End Property + ''' + ''' Looks up a localized string similar to Kill signal was sent for [PARAM].. + ''' + Friend ReadOnly Property frmMain_ProcessKilled() As String + Get + Return ResourceManager.GetString("frmMain_ProcessKilled", resourceCulture) + End Get + End Property + + ''' + ''' Looks up a localized string similar to [PARAM] has been started.. + ''' + Friend ReadOnly Property frmMain_ProcessStarted() As String + Get + Return ResourceManager.GetString("frmMain_ProcessStarted", resourceCulture) + End Get + End Property + ''' ''' Looks up a localized string similar to Remote Database Vacuum Completed: [PARAM] KB. ''' @@ -5146,7 +5164,7 @@ Namespace My.Resources End Property ''' - ''' Looks up a localized string similar to Tags. + ''' Looks up a localized string similar to Tag Manager. ''' Friend ReadOnly Property frmTags_FormName() As String Get diff --git a/GBM/My Project/Resources.resx b/GBM/My Project/Resources.resx index ffdbbd1..8418cd3 100644 --- a/GBM/My Project/Resources.resx +++ b/GBM/My Project/Resources.resx @@ -392,13 +392,13 @@ Add Game &Wizard... - Custom &Path Variables... + Custom Path &Variables... &Game Manager... - &Tags... + &Tag Manager... Monitor Status: @@ -923,7 +923,7 @@ &Close - Setup &Tags... + &Tag Manager... < @@ -1211,7 +1211,7 @@ You must enter a valid tag name. - Tags + Tag Manager Configuration @@ -2120,7 +2120,7 @@ Path: - Process &Manager... + &Process Manager... Choose a file that starts the process @@ -2138,7 +2138,7 @@ &Close - Process &Manager... + &Process Manager... < @@ -2158,4 +2158,10 @@ Error: [PARAM] + + Kill signal was sent for [PARAM]. + + + [PARAM] has been started. + \ No newline at end of file diff --git a/GBM/readme.txt b/GBM/readme.txt index dc452b6..c998f47 100644 --- a/GBM/readme.txt +++ b/GBM/readme.txt @@ -2,7 +2,7 @@ Game Backup Monitor v1.1.0 Readme http://mikemaximus.github.io/gbm-web/ gamebackupmonitor@gmail.com -March 7th, 2018 +March 8th, 2018 New in 1.1.0 From f4a54f87812221f473a560292864b00b81c59dbf Mon Sep 17 00:00:00 2001 From: MikeMaximus Date: Thu, 8 Mar 2018 21:53:01 -0600 Subject: [PATCH 32/38] Minor label updates and updated readme.txt --- GBM/Forms/frmProcessManager.Designer.vb | 4 +-- GBM/My Project/Resources.Designer.vb | 2 +- GBM/My Project/Resources.resx | 2 +- GBM/readme.txt | 38 +++++++++++++++---------- 4 files changed, 27 insertions(+), 19 deletions(-) diff --git a/GBM/Forms/frmProcessManager.Designer.vb b/GBM/Forms/frmProcessManager.Designer.vb index daa977c..c41fc46 100644 --- a/GBM/Forms/frmProcessManager.Designer.vb +++ b/GBM/Forms/frmProcessManager.Designer.vb @@ -63,9 +63,9 @@ Partial Class frmProcessManager Me.chkKillProcess.AutoSize = True Me.chkKillProcess.Location = New System.Drawing.Point(72, 96) Me.chkKillProcess.Name = "chkKillProcess" - Me.chkKillProcess.Size = New System.Drawing.Size(184, 17) + Me.chkKillProcess.Size = New System.Drawing.Size(181, 17) Me.chkKillProcess.TabIndex = 4 - Me.chkKillProcess.Text = "Kill process when game is closed." + Me.chkKillProcess.Text = "Kill process when game is closed" Me.chkKillProcess.UseVisualStyleBackColor = True ' 'txtArguments diff --git a/GBM/My Project/Resources.Designer.vb b/GBM/My Project/Resources.Designer.vb index c2343c9..685a29b 100644 --- a/GBM/My Project/Resources.Designer.vb +++ b/GBM/My Project/Resources.Designer.vb @@ -3904,7 +3904,7 @@ Namespace My.Resources End Property ''' - ''' Looks up a localized string similar to Kill process when game is closed.. + ''' Looks up a localized string similar to Kill process when game is closed. ''' Friend ReadOnly Property frmProcessManager_chkKillProcess() As String Get diff --git a/GBM/My Project/Resources.resx b/GBM/My Project/Resources.resx index 8418cd3..88d8056 100644 --- a/GBM/My Project/Resources.resx +++ b/GBM/My Project/Resources.resx @@ -2129,7 +2129,7 @@ Executable - Kill process when game is closed. + Kill process when game is closed > diff --git a/GBM/readme.txt b/GBM/readme.txt index c998f47..48e1b33 100644 --- a/GBM/readme.txt +++ b/GBM/readme.txt @@ -8,10 +8,12 @@ New in 1.1.0 Disclaimer: -Version 1.1.0 makes fundamental changes to how GBM works with game configurations and backup data, in addition to many other changes. Please read the changes below carefully before upgrading. +Version 1.1.0 makes fundamental changes to how GBM works with game configurations and backup data, in addition to many other updates. Please read the changes below carefully before upgrading. I've done my best to make sure the upgrade process allows everyone to continue using their existing data and configurations. +However, users who are sharing a backup folder between multiple PCs will experience some data loss at some point due to the changes in this upgrade. Please read "Known Issue #1" in this file for details. + All Platforms: - Core Design Changes (Game Configuration) @@ -21,7 +23,13 @@ All Platforms: - Game Name can now contain any character. - When a game is deleted via Game Manager (or sync), all backup manifest entries for that particular game are now deleted. The backup files themselves are not. - The Game Manager now syncs changes to the remote database immediately, instead of only when closed. -- Feature Changes + +- Feature Addtions & Changes + - Added Regular Expression support for game detection + - This feature allows GBM to detect games based on a pattern instead of a single process name. + - This allows GBM to better support games that run from multiple executables and games that use interpreters or emulators. + - Use the new "Regular Expression" checkbox on the Game Manager and enter the pattern in the "Process" field. + - GBM will validate patterns and offer to help troubleshoot (using regexr.com) when validation fails. - Added the ability to start another process (or multiple process) whenever a game is detected. (Thanks for the suggestion Naliel Supremo) - This is useful to automatically start utilities, such as custom control schemes or overlays, for specific games. - The "Process Manager" allows you to manage any programs you'd like to launch. @@ -36,17 +44,16 @@ All Platforms: - The "Clean Local Manifest" feature has been removed. It is not required because manfiest entries are no longer orphaned by design. Existing orphaned entries will be removed during the v1.1.0 database upgrade. - Added "Sync Game IDs" feature. This allows the user to update their game configuration identifiers to match the official list or an export file. - The sync is based on similarly named game configurations, therefore it's not 100% effective. Some data may be missed and require manual changes. - - This is mainly an optional upgrade tool for users with existing data from older versions. + - This is an optional upgrade tool for users with existing data from older versions. It allows the import feature to properly recognize and update game configurations. + - If you share a backup folder with multiple PCs, this feature will cause some data loss when the new IDs are synced to the other PCs. See "Known Issue #1" + - Import / Export Changes - - GBM will offer to "Sync Game IDs" when importing from the official list after upgrading to v1.1.0. - - This offer only appears once and only appears for users that have upgraded from an older version. - GBM now uses the Game ID to determine if a game is new or has an updated configuration. + - GBM will offer to "Sync Game IDs" when importing from the official list after upgrading to v1.1.0. + - This allows the import to recognize and update your configurations from older versions. + - This offer only appears once and only appears for users that have upgraded from an older version. - Added icons to the import list to indicate a "New" or "Updated" game. -- Added Regular Expression support for game detection - - This feature allows GBM to detect games based on a pattern instead of a single process name. - - This allows GBM to better support games that run from multiple executables and games that use interpreters or emulators. - - Use the new "Regular Expression" checkbox on the Game Manager and enter the pattern in the "Process" field. - - GBM will validate patterns and offer to help troubleshoot (using regexr.com) when validation fails. + - Updated session CSV export to adhere to RFC 4180. It now handles commas, quotes and line breaks correctly. Windows Only: @@ -61,18 +68,19 @@ Linux Only: Known Issues: -- If one or more Game IDs are changed on one computer and these changes are synced to another PC sharing the same backup folder: +1. If one or more Game IDs are changed (manually or via Game ID Sync) on one computer and these changes are synced to another PC sharing the same backup folder, the following data will be lost. - The local session data on that PC for the changed game(s) will be lost. + - The local backup manifest data for the changed game(s) on that PC will be lost. GBM will see any backups for the changed game(s) as new and will handle them accordingly. - Any processes assigned to the changed games(s) on that PC will be lost. - - The local backup manifest data for the changed game(s) on that PC will be reset. GBM will see any backups for the changed game(s) as new and will handle them accordingly. -- Backup files made prior to v1.1.0 are not being renamed or removed when a new backup is created. + Once your PCs are back in sync, this will no longer be an issue unless you are constantly changing your Game IDs, which is not recommended. +2. Backup files made prior to v1.1.0 are not being renamed or removed when a new backup is created. - This is due to file name now being generated by the Game ID and not the name. - Only backups made prior to v1.1.0 are affected by this issue. - After new backup files are created, these files can be deleted at the user's discretion. -- Configurations on the official game list are no longer fully compatible with older GBM versions. +3. Configurations on the official game list are no longer fully compatible with older GBM versions. - Technically they will work. But any game imported with a special character in it's name, such as a colon, will not create backup files correctly. - These characters can be manually removed from the game name after importing, then the configurations will function properly. -- The error "The requested operation requires elevation" occurs when GBM tries to launch a process associated with a game. +4. The error "The requested operation requires elevation" occurs when GBM tries to launch a process associated with a game. - This means the process you're trying to launch with GBM requires administrator privilege. - Click the blue "user" icon on the bottom left of the GBM window to quickly switch to administrator mode. From bba4d3a0a8a48a2039408af1c28a0a22391b59cb Mon Sep 17 00:00:00 2001 From: MikeMaximus Date: Fri, 9 Mar 2018 08:50:36 -0600 Subject: [PATCH 33/38] Fixed adding processes on a new game config --- GBM/Forms/frmGameManager.vb | 1 + GBM/readme.txt | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/GBM/Forms/frmGameManager.vb b/GBM/Forms/frmGameManager.vb index 1f97e83..bc04ac9 100644 --- a/GBM/Forms/frmGameManager.vb +++ b/GBM/Forms/frmGameManager.vb @@ -919,6 +919,7 @@ Public Class frmGameManager Select Case eCurrentMode Case eModes.Add oTagsToSave.Clear() + oProcessesToSave.Clear() grpFilter.Enabled = False lstGames.Enabled = False lblQuickFilter.Enabled = False diff --git a/GBM/readme.txt b/GBM/readme.txt index 48e1b33..f3bdad0 100644 --- a/GBM/readme.txt +++ b/GBM/readme.txt @@ -8,11 +8,11 @@ New in 1.1.0 Disclaimer: -Version 1.1.0 makes fundamental changes to how GBM works with game configurations and backup data, in addition to many other updates. Please read the changes below carefully before upgrading. +Version 1.1.0 makes fundamental changes to how GBM works with game configurations and backup data, in addition to many other updates. Read the changes below carefully before upgrading. I've done my best to make sure the upgrade process allows everyone to continue using their existing data and configurations. -However, users who are sharing a backup folder between multiple PCs will experience some data loss at some point due to the changes in this upgrade. Please read "Known Issue #1" in this file for details. +However, users who are sharing a backup folder between multiple PCs will experience data loss at some point due to the changes in this version. Please read "Known Issue #1" in this file for details. All Platforms: @@ -30,8 +30,8 @@ All Platforms: - This allows GBM to better support games that run from multiple executables and games that use interpreters or emulators. - Use the new "Regular Expression" checkbox on the Game Manager and enter the pattern in the "Process" field. - GBM will validate patterns and offer to help troubleshoot (using regexr.com) when validation fails. - - Added the ability to start another process (or multiple process) whenever a game is detected. (Thanks for the suggestion Naliel Supremo) - - This is useful to automatically start utilities, such as custom control schemes or overlays, for specific games. + - Added the ability to start another process (or multiple processes) whenever a game is detected. (Thanks for the suggestion Naliel Supremo) + - This is useful to automatically start utilities, such as custom control schemes or overlays when a specific game is detected. - The "Process Manager" allows you to manage any programs you'd like to launch. - The "Processes..." button on the Game Manager allows you to assign processes to any selected game. - A process can be set to end when the game is closed. From 5ae238360d60dad6b5ff4cdb8a51e4026635e092 Mon Sep 17 00:00:00 2001 From: MikeMaximus Date: Fri, 9 Mar 2018 09:01:16 -0600 Subject: [PATCH 34/38] Fixed process launching when dupes are detected --- GBM/Forms/frmMain.vb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/GBM/Forms/frmMain.vb b/GBM/Forms/frmMain.vb index 3862a08..73aebfb 100644 --- a/GBM/Forms/frmMain.vb +++ b/GBM/Forms/frmMain.vb @@ -1902,7 +1902,7 @@ Public Class frmMain SetGameInfo() End If - If BuildChildProcesses() > 0 Then + If BuildChildProcesses() > 0 And Not oProcess.Duplicate Then StartChildProcesses() End If @@ -1932,7 +1932,7 @@ Public Class frmMain Private Sub bwMain_RunWorkerCompleted(sender As System.Object, e As System.ComponentModel.RunWorkerCompletedEventArgs) Handles bwMonitor.RunWorkerCompleted Dim bContinue As Boolean = True - If oChildProcesses.Count > 0 Then + If oChildProcesses.Count > 0 And Not oProcess.Duplicate Then EndChildProcesses() End If From 9eb095523ea751d03b2f50c2bb5dc1c4682cf8bb Mon Sep 17 00:00:00 2001 From: MikeMaximus Date: Sat, 10 Mar 2018 10:52:39 -0600 Subject: [PATCH 35/38] Fixed some settings and database update issues --- GBM/Forms/frmStartUpWizard.vb | 1 - GBM/Managers/mgrSQLite.vb | 14 ++++++++------ GBM/Managers/mgrSettings.vb | 2 +- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/GBM/Forms/frmStartUpWizard.vb b/GBM/Forms/frmStartUpWizard.vb index cbcae36..401d3a7 100644 --- a/GBM/Forms/frmStartUpWizard.vb +++ b/GBM/Forms/frmStartUpWizard.vb @@ -131,7 +131,6 @@ Public Class frmStartUpWizard frm.DisableExternalFunctions = True frm.ShowDialog() LoadGameSettings() - mgrMonitorList.SyncMonitorLists(oSettings.SyncFields) End Sub Private Function ValidateBackupPath(ByVal strPath As String, ByRef sErrorMessage As String) As Boolean diff --git a/GBM/Managers/mgrSQLite.vb b/GBM/Managers/mgrSQLite.vb index ef1a751..6767210 100644 --- a/GBM/Managers/mgrSQLite.vb +++ b/GBM/Managers/mgrSQLite.vb @@ -778,7 +778,7 @@ Public Class mgrSQLite sSQL &= "CREATE TABLE gameprocesses (ProcessID TEXT NOT NULL, MonitorID TEXT NOT NULL, PRIMARY KEY(ProcessID, MonitorID));" 'Overhaul Tables - sSQL = "CREATE TABLE settings_new (SettingsID INTEGER NOT NULL PRIMARY KEY, MonitorOnStartup BOOLEAN NOT NULL, StartToTray BOOLEAN NOT NULL, ShowDetectionToolTips BOOLEAN NOT NULL, " & + sSQL &= "CREATE TABLE settings_new (SettingsID INTEGER NOT NULL PRIMARY KEY, MonitorOnStartup BOOLEAN NOT NULL, StartToTray BOOLEAN NOT NULL, ShowDetectionToolTips BOOLEAN NOT NULL, " & "DisableConfirmation BOOLEAN NOT NULL, CreateSubFolder BOOLEAN NOT NULL, ShowOverwriteWarning BOOLEAN NOT NULL, RestoreOnLaunch BOOLEAN NOT NULL, " & "BackupFolder TEXT NOT NULL, StartWithWindows BOOLEAN NOT NULL, TimeTracking BOOLEAN NOT NULL, " & "SupressBackup BOOLEAN NOT NULL, SupressBackupThreshold INTEGER NOT NULL, CompressionLevel INTEGER NOT NULL, Custom7zArguments TEXT, " & @@ -813,11 +813,6 @@ Public Class mgrSQLite 'Backup DB before starting BackupDB("v108") - 'The remote manifest now requires a synced monitorlist to function. We need to force a sync for users that had it disabled, otherwise their manifest will be lost. - Dim oSettings As New mgrSettings - oSettings.LoadSettings() - mgrMonitorList.SyncMonitorLists(oSettings.SyncFields) - 'Overhaul Tables sSQL = "CREATE TABLE monitorlist_new (MonitorID TEXT NOT NULL PRIMARY KEY, Name TEXT NOT NULL, Process TEXT NOT NULL, Path TEXT, " & "AbsolutePath BOOLEAN NOT NULL, FolderSave BOOLEAN NOT NULL, FileType TEXT, TimeStamp BOOLEAN NOT NULL, ExcludeList TEXT NOT NULL, " & @@ -828,6 +823,13 @@ Public Class mgrSQLite "SELECT MonitorID, Name, Process, Path, AbsolutePath, FolderSave, FileType, TimeStamp, ExcludeList, " & "ProcessPath, Icon, Hours, Version, Company, Enabled, MonitorOnly, BackupLimit, CleanFolder, Parameter, Comments, IsRegEx FROM monitorlist;" & "DROP TABLE monitorlist; ALTER TABLE monitorlist_new RENAME TO monitorlist;" + + 'We need to push the local database game list against the remote database in case they had syncing disabled + Dim hshMonitorList As Hashtable = mgrMonitorList.ReadList(mgrMonitorList.eListTypes.FullList, mgrSQLite.Database.Local) + Dim oSettings As New mgrSettings + oSettings.LoadSettings() + mgrMonitorList.DoListAddUpdateSync(hshMonitorList, Database.Remote, oSettings.SyncFields) + sSQL &= "CREATE TABLE manifest_new (ManifestID TEXT NOT NULL PRIMARY KEY, MonitorID TEXT NOT NULL, FileName TEXT NOT NULL, " & "DateUpdated TEXT NOT NULL, UpdatedBy TEXT NOT NULL, CheckSum TEXT);" sSQL &= "INSERT INTO manifest_new (ManifestID, MonitorID, FileName, DateUpdated, UpdatedBy, CheckSum) " & diff --git a/GBM/Managers/mgrSettings.vb b/GBM/Managers/mgrSettings.vb index 84f1d4d..3668cbc 100644 --- a/GBM/Managers/mgrSettings.vb +++ b/GBM/Managers/mgrSettings.vb @@ -277,7 +277,7 @@ Public Class mgrSettings Sub New() 'The GameIDsync message should be supressed on all new databases - SetMessageField(SupressMessages, eSupressMessages.GameIDSync) + SupressMessages = SetMessageField(SupressMessages, eSupressMessages.GameIDSync) End Sub Private Sub SaveFromClass() From 8e26e97fd42a50ee4b48e20d1ae386d20dcc12ff Mon Sep 17 00:00:00 2001 From: "Michael J. Seiferling" Date: Mon, 12 Mar 2018 13:03:32 -0600 Subject: [PATCH 36/38] Added file name option to settings --- GBM/Classes/clsGame.vb | 6 ++++ GBM/Forms/frmSettings.Designer.vb | 43 ++++++++++++++++++---------- GBM/Forms/frmSettings.vb | 3 ++ GBM/Managers/mgrBackup.vb | 22 ++++++++++---- GBM/Managers/mgrSQLite.vb | 8 +++--- GBM/Managers/mgrSettings.vb | 14 ++++++++- GBM/My Project/Resources.Designer.vb | 11 ++++++- GBM/My Project/Resources.resx | 5 +++- 8 files changed, 85 insertions(+), 27 deletions(-) diff --git a/GBM/Classes/clsGame.vb b/GBM/Classes/clsGame.vb index ddaf18a..e62e89a 100644 --- a/GBM/Classes/clsGame.vb +++ b/GBM/Classes/clsGame.vb @@ -62,6 +62,12 @@ Public Class clsGame End Get End Property + ReadOnly Property FileSafeName As String + Get + Return mgrPath.ValidateForFileSystem(sGameName) + End Get + End Property + Property Name As String Set(value As String) sGameName = value diff --git a/GBM/Forms/frmSettings.Designer.vb b/GBM/Forms/frmSettings.Designer.vb index 336c32e..73ee18e 100644 --- a/GBM/Forms/frmSettings.Designer.vb +++ b/GBM/Forms/frmSettings.Designer.vb @@ -24,6 +24,7 @@ Partial Class frmSettings Private Sub InitializeComponent() Me.chkMonitorOnStartup = New System.Windows.Forms.CheckBox() Me.grpStartup = New System.Windows.Forms.GroupBox() + Me.chkBackupOnLaunch = New System.Windows.Forms.CheckBox() Me.chkStartWindows = New System.Windows.Forms.CheckBox() Me.chkStartToTray = New System.Windows.Forms.CheckBox() Me.chkAutoSaveLog = New System.Windows.Forms.CheckBox() @@ -66,7 +67,7 @@ Partial Class frmSettings Me.chkSessionTracking = New System.Windows.Forms.CheckBox() Me.lstSettings = New System.Windows.Forms.ListBox() Me.btnResetMessages = New System.Windows.Forms.Button() - Me.chkBackupOnLaunch = New System.Windows.Forms.CheckBox() + Me.chkUseNames = New System.Windows.Forms.CheckBox() Me.grpStartup.SuspendLayout() Me.grpFolderOptions.SuspendLayout() Me.grp7zGeneral.SuspendLayout() @@ -103,6 +104,16 @@ Partial Class frmSettings Me.grpStartup.TabStop = False Me.grpStartup.Text = "Startup" ' + 'chkBackupOnLaunch + ' + Me.chkBackupOnLaunch.AutoSize = True + Me.chkBackupOnLaunch.Location = New System.Drawing.Point(6, 88) + Me.chkBackupOnLaunch.Name = "chkBackupOnLaunch" + Me.chkBackupOnLaunch.Size = New System.Drawing.Size(185, 17) + Me.chkBackupOnLaunch.TabIndex = 3 + Me.chkBackupOnLaunch.Text = "Backup GBM data files on launch" + Me.chkBackupOnLaunch.UseVisualStyleBackColor = True + ' 'chkStartWindows ' Me.chkStartWindows.AutoSize = True @@ -164,16 +175,17 @@ Partial Class frmSettings ' 'grpFolderOptions ' + Me.grpFolderOptions.Controls.Add(Me.chkUseNames) Me.grpFolderOptions.Controls.Add(Me.btnBackupFolder) Me.grpFolderOptions.Controls.Add(Me.lblBackupFolder) Me.grpFolderOptions.Controls.Add(Me.txtBackupFolder) Me.grpFolderOptions.Controls.Add(Me.chkCreateFolder) Me.grpFolderOptions.Location = New System.Drawing.Point(6, 12) Me.grpFolderOptions.Name = "grpFolderOptions" - Me.grpFolderOptions.Size = New System.Drawing.Size(354, 70) + Me.grpFolderOptions.Size = New System.Drawing.Size(354, 90) Me.grpFolderOptions.TabIndex = 0 Me.grpFolderOptions.TabStop = False - Me.grpFolderOptions.Text = "Folders" + Me.grpFolderOptions.Text = "Files and Folders" ' 'btnBackupFolder ' @@ -341,7 +353,7 @@ Partial Class frmSettings 'chkBackupConfirm ' Me.chkBackupConfirm.AutoSize = True - Me.chkBackupConfirm.Location = New System.Drawing.Point(14, 180) + Me.chkBackupConfirm.Location = New System.Drawing.Point(14, 199) Me.chkBackupConfirm.Name = "chkBackupConfirm" Me.chkBackupConfirm.Size = New System.Drawing.Size(160, 17) Me.chkBackupConfirm.TabIndex = 2 @@ -351,7 +363,7 @@ Partial Class frmSettings 'chkOverwriteWarning ' Me.chkOverwriteWarning.AutoSize = True - Me.chkOverwriteWarning.Location = New System.Drawing.Point(14, 203) + Me.chkOverwriteWarning.Location = New System.Drawing.Point(14, 222) Me.chkOverwriteWarning.Name = "chkOverwriteWarning" Me.chkOverwriteWarning.Size = New System.Drawing.Size(139, 17) Me.chkOverwriteWarning.TabIndex = 3 @@ -363,7 +375,7 @@ Partial Class frmSettings Me.grpBackupHandling.Controls.Add(Me.chkAutoRestore) Me.grpBackupHandling.Controls.Add(Me.chkRestoreNotify) Me.grpBackupHandling.Controls.Add(Me.chkAutoMark) - Me.grpBackupHandling.Location = New System.Drawing.Point(6, 88) + Me.grpBackupHandling.Location = New System.Drawing.Point(6, 107) Me.grpBackupHandling.Margin = New System.Windows.Forms.Padding(2) Me.grpBackupHandling.Name = "grpBackupHandling" Me.grpBackupHandling.Padding = New System.Windows.Forms.Padding(2) @@ -519,24 +531,24 @@ Partial Class frmSettings Me.btnResetMessages.Text = "&Reset Warnings" Me.btnResetMessages.UseVisualStyleBackColor = True ' - 'chkBackupOnLaunch + 'chkUseNames ' - Me.chkBackupOnLaunch.AutoSize = True - Me.chkBackupOnLaunch.Location = New System.Drawing.Point(6, 88) - Me.chkBackupOnLaunch.Name = "chkBackupOnLaunch" - Me.chkBackupOnLaunch.Size = New System.Drawing.Size(185, 17) - Me.chkBackupOnLaunch.TabIndex = 3 - Me.chkBackupOnLaunch.Text = "Backup GBM data files on launch" - Me.chkBackupOnLaunch.UseVisualStyleBackColor = True + Me.chkUseNames.AutoSize = True + Me.chkUseNames.Location = New System.Drawing.Point(9, 65) + Me.chkUseNames.Name = "chkUseNames" + Me.chkUseNames.Size = New System.Drawing.Size(254, 17) + Me.chkUseNames.TabIndex = 3 + Me.chkUseNames.Text = "Use Name instead of ID for folder and file names" + Me.chkUseNames.UseVisualStyleBackColor = True ' 'frmSettings ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font Me.ClientSize = New System.Drawing.Size(554, 361) + Me.Controls.Add(Me.pnlBackup) Me.Controls.Add(Me.btnResetMessages) Me.Controls.Add(Me.pnlGeneral) - Me.Controls.Add(Me.pnlBackup) Me.Controls.Add(Me.pnl7z) Me.Controls.Add(Me.lstSettings) Me.Controls.Add(Me.btnDefaults) @@ -617,4 +629,5 @@ Partial Class frmSettings Friend WithEvents chkSupressBackup As CheckBox Friend WithEvents btnResetMessages As Button Friend WithEvents chkBackupOnLaunch As CheckBox + Friend WithEvents chkUseNames As CheckBox End Class diff --git a/GBM/Forms/frmSettings.vb b/GBM/Forms/frmSettings.vb index 7f01dae..e6f4094 100644 --- a/GBM/Forms/frmSettings.vb +++ b/GBM/Forms/frmSettings.vb @@ -52,6 +52,7 @@ Public Class frmSettings oSettings.AutoSaveLog = chkAutoSaveLog.Checked oSettings.DisableConfirmation = chkBackupConfirm.Checked oSettings.CreateSubFolder = chkCreateFolder.Checked + oSettings.UseNames = chkUseNames.Checked oSettings.ShowOverwriteWarning = chkOverwriteWarning.Checked oSettings.RestoreOnLaunch = chkRestoreNotify.Checked oSettings.AutoRestore = chkAutoRestore.Checked @@ -178,6 +179,7 @@ Public Class frmSettings chkAutoSaveLog.Checked = oSettings.AutoSaveLog chkBackupConfirm.Checked = oSettings.DisableConfirmation chkCreateFolder.Checked = oSettings.CreateSubFolder + chkUseNames.Checked = oSettings.UseNames chkOverwriteWarning.Checked = oSettings.ShowOverwriteWarning chkRestoreNotify.Checked = oSettings.RestoreOnLaunch chkAutoRestore.Checked = oSettings.AutoRestore @@ -278,6 +280,7 @@ Public Class frmSettings chkAutoMark.Text = frmSettings_chkAutoMark chkOverwriteWarning.Text = frmSettings_chkOverwriteWarning chkCreateFolder.Text = frmSettings_chkCreateFolder + chkUseNames.Text = frmSettings_chkUseNames chkBackupConfirm.Text = frmSettings_chkBackupConfirm btnCancel.Text = frmSettings_btnCancel btnSave.Text = frmSettings_btnSave diff --git a/GBM/Managers/mgrBackup.vb b/GBM/Managers/mgrBackup.vb index 74394a2..9e25a3a 100644 --- a/GBM/Managers/mgrBackup.vb +++ b/GBM/Managers/mgrBackup.vb @@ -101,14 +101,26 @@ Public Class mgrBackup Return sSavePath End Function + Private Function GetFileName(ByVal oGame As clsGame) As String + Dim sName As String + + If oSettings.UseNames Then + sName = oGame.FileSafeName + Else + sName = oGame.ID + End If + + Return sName + End Function + Public Function CheckBackupPrereq(ByVal oGame As clsGame) As Boolean Dim sBackupFile As String = oSettings.BackupFolder Dim sSavePath As String Dim lAvailableSpace As Long Dim lFolderSize As Long - If oSettings.CreateSubFolder Then sBackupFile = sBackupFile & Path.DirectorySeparatorChar & oGame.ID - sBackupFile = sBackupFile & Path.DirectorySeparatorChar & oGame.ID & ".7z" + If oSettings.CreateSubFolder Then sBackupFile = sBackupFile & Path.DirectorySeparatorChar & GetFileName(oGame) + sBackupFile = sBackupFile & Path.DirectorySeparatorChar & GetFileName(oGame) & ".7z" 'Verify saved game path sSavePath = VerifySavePath(oGame) @@ -199,7 +211,7 @@ Public Class mgrBackup RaiseEvent UpdateBackupInfo(oGame) If oSettings.CreateSubFolder Then - sBackupFile = sBackupFile & Path.DirectorySeparatorChar & oGame.ID + sBackupFile = sBackupFile & Path.DirectorySeparatorChar & GetFileName(oGame) Try If Not Directory.Exists(sBackupFile) Then Directory.CreateDirectory(sBackupFile) @@ -212,9 +224,9 @@ Public Class mgrBackup If oGame.AppendTimeStamp Then CheckOldBackups(oGame) - sBackupFile = sBackupFile & Path.DirectorySeparatorChar & oGame.ID & sTimeStamp & ".7z" + sBackupFile = sBackupFile & Path.DirectorySeparatorChar & GetFileName(oGame) & sTimeStamp & ".7z" Else - sBackupFile = sBackupFile & Path.DirectorySeparatorChar & oGame.ID & ".7z" + sBackupFile = sBackupFile & Path.DirectorySeparatorChar & GetFileName(oGame) & ".7z" End If If bDoBackup Then diff --git a/GBM/Managers/mgrSQLite.vb b/GBM/Managers/mgrSQLite.vb index 6767210..2b58eee 100644 --- a/GBM/Managers/mgrSQLite.vb +++ b/GBM/Managers/mgrSQLite.vb @@ -75,7 +75,7 @@ Public Class mgrSQLite "BackupFolder TEXT NOT NULL, StartWithWindows BOOLEAN NOT NULL, TimeTracking BOOLEAN NOT NULL, " & "SupressBackup BOOLEAN NOT NULL, SupressBackupThreshold INTEGER NOT NULL, CompressionLevel INTEGER NOT NULL, Custom7zArguments TEXT, " & "Custom7zLocation TEXT, SyncFields INTEGER NOT NULL, AutoSaveLog BOOLEAN NOT NULL, AutoRestore BOOLEAN NOT NULL, AutoMark BOOLEAN NOT NULL, SessionTracking BOOLEAN NOT NULL, " & - "SupressMessages INTEGER NOT NULL, BackupOnLaunch BOOLEAN NOT NULL);" + "SupressMessages INTEGER NOT NULL, BackupOnLaunch BOOLEAN NOT NULL, UseNames BOOLEAN NOT NULL);" 'Add Tables (SavedPath) sSql &= "CREATE TABLE savedpath (PathName TEXT NOT NULL PRIMARY KEY, Path TEXT NOT NULL);" @@ -783,12 +783,12 @@ Public Class mgrSQLite "BackupFolder TEXT NOT NULL, StartWithWindows BOOLEAN NOT NULL, TimeTracking BOOLEAN NOT NULL, " & "SupressBackup BOOLEAN NOT NULL, SupressBackupThreshold INTEGER NOT NULL, CompressionLevel INTEGER NOT NULL, Custom7zArguments TEXT, " & "Custom7zLocation TEXT, SyncFields INTEGER NOT NULL, AutoSaveLog BOOLEAN NOT NULL, AutoRestore BOOLEAN NOT NULL, AutoMark BOOLEAN NOT NULL, SessionTracking BOOLEAN NOT NULL, " & - "SupressMessages INTEGER NOT NULL, BackupOnLaunch BOOLEAN NOT NULL);" + "SupressMessages INTEGER NOT NULL, BackupOnLaunch BOOLEAN NOT NULL, UseNames BOOLEAN NOT NULL);" sSQL &= "INSERT INTO settings_new(SettingsID, MonitorOnStartup, StartToTray, ShowDetectionToolTips, DisableConfirmation, CreateSubFolder, ShowOverwriteWarning, RestoreOnLaunch, " & "BackupFolder, StartWithWindows, TimeTracking, SupressBackup, SupressBackupThreshold, CompressionLevel, Custom7zArguments, Custom7zLocation, SyncFields, AutoSaveLog, " & - "AutoRestore, AutoMark, SessionTracking, SupressMessages, BackupOnLaunch) SELECT SettingsID, MonitorOnStartup, StartToTray, ShowDetectionToolTips, DisableConfirmation, CreateSubFolder, ShowOverwriteWarning, RestoreOnLaunch, " & + "AutoRestore, AutoMark, SessionTracking, SupressMessages, BackupOnLaunch, UseNames) SELECT SettingsID, MonitorOnStartup, StartToTray, ShowDetectionToolTips, DisableConfirmation, CreateSubFolder, ShowOverwriteWarning, RestoreOnLaunch, " & "BackupFolder, StartWithWindows, TimeTracking, SupressBackup, SupressBackupThreshold, CompressionLevel, Custom7zArguments, Custom7zLocation, SyncFields, AutoSaveLog, " & - "AutoRestore, AutoMark, SessionTracking, 0, 1 FROM settings;" & + "AutoRestore, AutoMark, SessionTracking, 0, 1, 1 FROM settings;" & "DROP TABLE settings; ALTER TABLE settings_new RENAME TO settings;" sSQL &= "CREATE TABLE monitorlist_new (MonitorID TEXT NOT NULL PRIMARY KEY, Name TEXT NOT NULL, Process TEXT NOT NULL, Path TEXT, " & "AbsolutePath BOOLEAN NOT NULL, FolderSave BOOLEAN NOT NULL, FileType TEXT, TimeStamp BOOLEAN NOT NULL, ExcludeList TEXT NOT NULL, " & diff --git a/GBM/Managers/mgrSettings.vb b/GBM/Managers/mgrSettings.vb index 3668cbc..f6721da 100644 --- a/GBM/Managers/mgrSettings.vb +++ b/GBM/Managers/mgrSettings.vb @@ -23,6 +23,7 @@ Public Class mgrSettings Private eMessages As eSupressMessages = eSupressMessages.None Private bAutoSaveLog As Boolean = False Private bBackupOnLaunch As Boolean = True + Private bUseNames As Boolean = False Public Enum eSupressMessages None = 0 @@ -275,6 +276,15 @@ Public Class mgrSettings End Set End Property + Property UseNames As Boolean + Get + Return bUseNames + End Get + Set(value As Boolean) + bUseNames = value + End Set + End Property + Sub New() 'The GameIDsync message should be supressed on all new databases SupressMessages = SetMessageField(SupressMessages, eSupressMessages.GameIDSync) @@ -291,7 +301,7 @@ Public Class mgrSettings sSQL = "INSERT INTO settings VALUES (1, @MonitorOnStartup, @StartToTray, @ShowDetectionToolTips, @DisableConfirmation, " sSQL &= "@CreateSubFolder, @ShowOverwriteWarning, @RestoreOnLaunch, @BackupFolder, @StartWithWindows, " sSQL &= "@TimeTracking, @SupressBackup, @SupressBackupThreshold, @CompressionLevel, @Custom7zArguments, @Custom7zLocation, " - sSQL &= "@SyncFields, @AutoSaveLog, @AutoRestore, @AutoMark, @SessionTracking, @SupressMessages, @BackupOnLaunch)" + sSQL &= "@SyncFields, @AutoSaveLog, @AutoRestore, @AutoMark, @SessionTracking, @SupressMessages, @BackupOnLaunch, @UseNames)" hshParams.Add("MonitorOnStartup", MonitorOnStartup) hshParams.Add("StartToTray", StartToTray) @@ -315,6 +325,7 @@ Public Class mgrSettings hshParams.Add("SessionTracking", SessionTracking) hshParams.Add("SupressMessages", SupressMessages) hshParams.Add("BackupOnLaunch", BackupOnLaunch) + hshParams.Add("UseNames", UseNames) oDatabase.RunParamQuery(sSQL, hshParams) End Sub @@ -351,6 +362,7 @@ Public Class mgrSettings SessionTracking = CBool(dr("SessionTracking")) SupressMessages = CInt(dr("SupressMessages")) BackupOnLaunch = CBool(dr("BackupOnLaunch")) + UseNames = CBool(dr("UseNames")) Next oDatabase.Disconnect() diff --git a/GBM/My Project/Resources.Designer.vb b/GBM/My Project/Resources.Designer.vb index 685a29b..558ec1a 100644 --- a/GBM/My Project/Resources.Designer.vb +++ b/GBM/My Project/Resources.Designer.vb @@ -4542,6 +4542,15 @@ Namespace My.Resources End Get End Property + ''' + ''' Looks up a localized string similar to Use Name instead of ID for folder and file names. + ''' + Friend ReadOnly Property frmSettings_chkUseNames() As String + Get + Return ResourceManager.GetString("frmSettings_chkUseNames", resourceCulture) + End Get + End Property + ''' ''' Looks up a localized string similar to Do you want to revert all settings to their defaults?. ''' @@ -4624,7 +4633,7 @@ Namespace My.Resources End Property ''' - ''' Looks up a localized string similar to Folders. + ''' Looks up a localized string similar to Files and Folders. ''' Friend ReadOnly Property frmSettings_grpFolderOptions() As String Get diff --git a/GBM/My Project/Resources.resx b/GBM/My Project/Resources.resx index 88d8056..9abb3d1 100644 --- a/GBM/My Project/Resources.resx +++ b/GBM/My Project/Resources.resx @@ -1094,7 +1094,7 @@ Startup - Folders + Files and Folders Backup Folder: @@ -2164,4 +2164,7 @@ [PARAM] has been started. + + Use Name instead of ID for folder and file names + \ No newline at end of file From 2f668551662482a21b540f4e753ed56da6a5934c Mon Sep 17 00:00:00 2001 From: MikeMaximus Date: Mon, 12 Mar 2018 14:49:18 -0600 Subject: [PATCH 37/38] Changes to new setting --- GBM/Forms/frmSettings.Designer.vb | 26 +++++++++++++------------- GBM/Forms/frmSettings.vb | 6 +++--- GBM/Managers/mgrBackup.vb | 6 +++--- GBM/Managers/mgrSQLite.vb | 8 ++++---- GBM/Managers/mgrSettings.vb | 14 +++++++------- GBM/My Project/Resources.Designer.vb | 6 +++--- GBM/My Project/Resources.resx | 4 ++-- GBM/readme.txt | 15 +++++++++------ 8 files changed, 44 insertions(+), 41 deletions(-) diff --git a/GBM/Forms/frmSettings.Designer.vb b/GBM/Forms/frmSettings.Designer.vb index 73ee18e..1b1ad24 100644 --- a/GBM/Forms/frmSettings.Designer.vb +++ b/GBM/Forms/frmSettings.Designer.vb @@ -32,6 +32,7 @@ Partial Class frmSettings Me.chkTimeTracking = New System.Windows.Forms.CheckBox() Me.chkShowDetectionTips = New System.Windows.Forms.CheckBox() Me.grpFolderOptions = New System.Windows.Forms.GroupBox() + Me.chkUseGameID = New System.Windows.Forms.CheckBox() Me.btnBackupFolder = New System.Windows.Forms.Button() Me.lblBackupFolder = New System.Windows.Forms.Label() Me.txtBackupFolder = New System.Windows.Forms.TextBox() @@ -67,7 +68,6 @@ Partial Class frmSettings Me.chkSessionTracking = New System.Windows.Forms.CheckBox() Me.lstSettings = New System.Windows.Forms.ListBox() Me.btnResetMessages = New System.Windows.Forms.Button() - Me.chkUseNames = New System.Windows.Forms.CheckBox() Me.grpStartup.SuspendLayout() Me.grpFolderOptions.SuspendLayout() Me.grp7zGeneral.SuspendLayout() @@ -175,7 +175,7 @@ Partial Class frmSettings ' 'grpFolderOptions ' - Me.grpFolderOptions.Controls.Add(Me.chkUseNames) + Me.grpFolderOptions.Controls.Add(Me.chkUseGameID) Me.grpFolderOptions.Controls.Add(Me.btnBackupFolder) Me.grpFolderOptions.Controls.Add(Me.lblBackupFolder) Me.grpFolderOptions.Controls.Add(Me.txtBackupFolder) @@ -187,6 +187,16 @@ Partial Class frmSettings Me.grpFolderOptions.TabStop = False Me.grpFolderOptions.Text = "Files and Folders" ' + 'chkUseGameID + ' + Me.chkUseGameID.AutoSize = True + Me.chkUseGameID.Location = New System.Drawing.Point(9, 65) + Me.chkUseGameID.Name = "chkUseGameID" + Me.chkUseGameID.Size = New System.Drawing.Size(205, 17) + Me.chkUseGameID.TabIndex = 3 + Me.chkUseGameID.Text = "Use Game ID for folder and file names" + Me.chkUseGameID.UseVisualStyleBackColor = True + ' 'btnBackupFolder ' Me.btnBackupFolder.Location = New System.Drawing.Point(313, 17) @@ -531,16 +541,6 @@ Partial Class frmSettings Me.btnResetMessages.Text = "&Reset Warnings" Me.btnResetMessages.UseVisualStyleBackColor = True ' - 'chkUseNames - ' - Me.chkUseNames.AutoSize = True - Me.chkUseNames.Location = New System.Drawing.Point(9, 65) - Me.chkUseNames.Name = "chkUseNames" - Me.chkUseNames.Size = New System.Drawing.Size(254, 17) - Me.chkUseNames.TabIndex = 3 - Me.chkUseNames.Text = "Use Name instead of ID for folder and file names" - Me.chkUseNames.UseVisualStyleBackColor = True - ' 'frmSettings ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) @@ -629,5 +629,5 @@ Partial Class frmSettings Friend WithEvents chkSupressBackup As CheckBox Friend WithEvents btnResetMessages As Button Friend WithEvents chkBackupOnLaunch As CheckBox - Friend WithEvents chkUseNames As CheckBox + Friend WithEvents chkUseGameID As CheckBox End Class diff --git a/GBM/Forms/frmSettings.vb b/GBM/Forms/frmSettings.vb index e6f4094..798d600 100644 --- a/GBM/Forms/frmSettings.vb +++ b/GBM/Forms/frmSettings.vb @@ -52,7 +52,7 @@ Public Class frmSettings oSettings.AutoSaveLog = chkAutoSaveLog.Checked oSettings.DisableConfirmation = chkBackupConfirm.Checked oSettings.CreateSubFolder = chkCreateFolder.Checked - oSettings.UseNames = chkUseNames.Checked + oSettings.UseGameID = chkUseGameID.Checked oSettings.ShowOverwriteWarning = chkOverwriteWarning.Checked oSettings.RestoreOnLaunch = chkRestoreNotify.Checked oSettings.AutoRestore = chkAutoRestore.Checked @@ -179,7 +179,7 @@ Public Class frmSettings chkAutoSaveLog.Checked = oSettings.AutoSaveLog chkBackupConfirm.Checked = oSettings.DisableConfirmation chkCreateFolder.Checked = oSettings.CreateSubFolder - chkUseNames.Checked = oSettings.UseNames + chkUseGameID.Checked = oSettings.UseGameID chkOverwriteWarning.Checked = oSettings.ShowOverwriteWarning chkRestoreNotify.Checked = oSettings.RestoreOnLaunch chkAutoRestore.Checked = oSettings.AutoRestore @@ -280,7 +280,7 @@ Public Class frmSettings chkAutoMark.Text = frmSettings_chkAutoMark chkOverwriteWarning.Text = frmSettings_chkOverwriteWarning chkCreateFolder.Text = frmSettings_chkCreateFolder - chkUseNames.Text = frmSettings_chkUseNames + chkUseGameID.Text = frmSettings_chkUseGameID chkBackupConfirm.Text = frmSettings_chkBackupConfirm btnCancel.Text = frmSettings_btnCancel btnSave.Text = frmSettings_btnSave diff --git a/GBM/Managers/mgrBackup.vb b/GBM/Managers/mgrBackup.vb index 9e25a3a..708e4ba 100644 --- a/GBM/Managers/mgrBackup.vb +++ b/GBM/Managers/mgrBackup.vb @@ -104,10 +104,10 @@ Public Class mgrBackup Private Function GetFileName(ByVal oGame As clsGame) As String Dim sName As String - If oSettings.UseNames Then - sName = oGame.FileSafeName - Else + If oSettings.UseGameID Then sName = oGame.ID + Else + sName = oGame.FileSafeName End If Return sName diff --git a/GBM/Managers/mgrSQLite.vb b/GBM/Managers/mgrSQLite.vb index 2b58eee..81f2cee 100644 --- a/GBM/Managers/mgrSQLite.vb +++ b/GBM/Managers/mgrSQLite.vb @@ -75,7 +75,7 @@ Public Class mgrSQLite "BackupFolder TEXT NOT NULL, StartWithWindows BOOLEAN NOT NULL, TimeTracking BOOLEAN NOT NULL, " & "SupressBackup BOOLEAN NOT NULL, SupressBackupThreshold INTEGER NOT NULL, CompressionLevel INTEGER NOT NULL, Custom7zArguments TEXT, " & "Custom7zLocation TEXT, SyncFields INTEGER NOT NULL, AutoSaveLog BOOLEAN NOT NULL, AutoRestore BOOLEAN NOT NULL, AutoMark BOOLEAN NOT NULL, SessionTracking BOOLEAN NOT NULL, " & - "SupressMessages INTEGER NOT NULL, BackupOnLaunch BOOLEAN NOT NULL, UseNames BOOLEAN NOT NULL);" + "SupressMessages INTEGER NOT NULL, BackupOnLaunch BOOLEAN NOT NULL, UseGameID BOOLEAN NOT NULL);" 'Add Tables (SavedPath) sSql &= "CREATE TABLE savedpath (PathName TEXT NOT NULL PRIMARY KEY, Path TEXT NOT NULL);" @@ -783,12 +783,12 @@ Public Class mgrSQLite "BackupFolder TEXT NOT NULL, StartWithWindows BOOLEAN NOT NULL, TimeTracking BOOLEAN NOT NULL, " & "SupressBackup BOOLEAN NOT NULL, SupressBackupThreshold INTEGER NOT NULL, CompressionLevel INTEGER NOT NULL, Custom7zArguments TEXT, " & "Custom7zLocation TEXT, SyncFields INTEGER NOT NULL, AutoSaveLog BOOLEAN NOT NULL, AutoRestore BOOLEAN NOT NULL, AutoMark BOOLEAN NOT NULL, SessionTracking BOOLEAN NOT NULL, " & - "SupressMessages INTEGER NOT NULL, BackupOnLaunch BOOLEAN NOT NULL, UseNames BOOLEAN NOT NULL);" + "SupressMessages INTEGER NOT NULL, BackupOnLaunch BOOLEAN NOT NULL, UseGameID BOOLEAN NOT NULL);" sSQL &= "INSERT INTO settings_new(SettingsID, MonitorOnStartup, StartToTray, ShowDetectionToolTips, DisableConfirmation, CreateSubFolder, ShowOverwriteWarning, RestoreOnLaunch, " & "BackupFolder, StartWithWindows, TimeTracking, SupressBackup, SupressBackupThreshold, CompressionLevel, Custom7zArguments, Custom7zLocation, SyncFields, AutoSaveLog, " & - "AutoRestore, AutoMark, SessionTracking, SupressMessages, BackupOnLaunch, UseNames) SELECT SettingsID, MonitorOnStartup, StartToTray, ShowDetectionToolTips, DisableConfirmation, CreateSubFolder, ShowOverwriteWarning, RestoreOnLaunch, " & + "AutoRestore, AutoMark, SessionTracking, SupressMessages, BackupOnLaunch, UseGameID) SELECT SettingsID, MonitorOnStartup, StartToTray, ShowDetectionToolTips, DisableConfirmation, CreateSubFolder, ShowOverwriteWarning, RestoreOnLaunch, " & "BackupFolder, StartWithWindows, TimeTracking, SupressBackup, SupressBackupThreshold, CompressionLevel, Custom7zArguments, Custom7zLocation, SyncFields, AutoSaveLog, " & - "AutoRestore, AutoMark, SessionTracking, 0, 1, 1 FROM settings;" & + "AutoRestore, AutoMark, SessionTracking, 0, 1, 0 FROM settings;" & "DROP TABLE settings; ALTER TABLE settings_new RENAME TO settings;" sSQL &= "CREATE TABLE monitorlist_new (MonitorID TEXT NOT NULL PRIMARY KEY, Name TEXT NOT NULL, Process TEXT NOT NULL, Path TEXT, " & "AbsolutePath BOOLEAN NOT NULL, FolderSave BOOLEAN NOT NULL, FileType TEXT, TimeStamp BOOLEAN NOT NULL, ExcludeList TEXT NOT NULL, " & diff --git a/GBM/Managers/mgrSettings.vb b/GBM/Managers/mgrSettings.vb index f6721da..bd5e608 100644 --- a/GBM/Managers/mgrSettings.vb +++ b/GBM/Managers/mgrSettings.vb @@ -23,7 +23,7 @@ Public Class mgrSettings Private eMessages As eSupressMessages = eSupressMessages.None Private bAutoSaveLog As Boolean = False Private bBackupOnLaunch As Boolean = True - Private bUseNames As Boolean = False + Private bUseGameID As Boolean = False Public Enum eSupressMessages None = 0 @@ -276,12 +276,12 @@ Public Class mgrSettings End Set End Property - Property UseNames As Boolean + Property UseGameID As Boolean Get - Return bUseNames + Return bUseGameID End Get Set(value As Boolean) - bUseNames = value + bUseGameID = value End Set End Property @@ -301,7 +301,7 @@ Public Class mgrSettings sSQL = "INSERT INTO settings VALUES (1, @MonitorOnStartup, @StartToTray, @ShowDetectionToolTips, @DisableConfirmation, " sSQL &= "@CreateSubFolder, @ShowOverwriteWarning, @RestoreOnLaunch, @BackupFolder, @StartWithWindows, " sSQL &= "@TimeTracking, @SupressBackup, @SupressBackupThreshold, @CompressionLevel, @Custom7zArguments, @Custom7zLocation, " - sSQL &= "@SyncFields, @AutoSaveLog, @AutoRestore, @AutoMark, @SessionTracking, @SupressMessages, @BackupOnLaunch, @UseNames)" + sSQL &= "@SyncFields, @AutoSaveLog, @AutoRestore, @AutoMark, @SessionTracking, @SupressMessages, @BackupOnLaunch, @UseGameID)" hshParams.Add("MonitorOnStartup", MonitorOnStartup) hshParams.Add("StartToTray", StartToTray) @@ -325,7 +325,7 @@ Public Class mgrSettings hshParams.Add("SessionTracking", SessionTracking) hshParams.Add("SupressMessages", SupressMessages) hshParams.Add("BackupOnLaunch", BackupOnLaunch) - hshParams.Add("UseNames", UseNames) + hshParams.Add("UseGameID", UseGameID) oDatabase.RunParamQuery(sSQL, hshParams) End Sub @@ -362,7 +362,7 @@ Public Class mgrSettings SessionTracking = CBool(dr("SessionTracking")) SupressMessages = CInt(dr("SupressMessages")) BackupOnLaunch = CBool(dr("BackupOnLaunch")) - UseNames = CBool(dr("UseNames")) + UseGameID = CBool(dr("UseGameID")) Next oDatabase.Disconnect() diff --git a/GBM/My Project/Resources.Designer.vb b/GBM/My Project/Resources.Designer.vb index 558ec1a..c904e1b 100644 --- a/GBM/My Project/Resources.Designer.vb +++ b/GBM/My Project/Resources.Designer.vb @@ -4543,11 +4543,11 @@ Namespace My.Resources End Property ''' - ''' Looks up a localized string similar to Use Name instead of ID for folder and file names. + ''' Looks up a localized string similar to Use Game ID for folder and file names. ''' - Friend ReadOnly Property frmSettings_chkUseNames() As String + Friend ReadOnly Property frmSettings_chkUseGameID() As String Get - Return ResourceManager.GetString("frmSettings_chkUseNames", resourceCulture) + Return ResourceManager.GetString("frmSettings_chkUseGameID", resourceCulture) End Get End Property diff --git a/GBM/My Project/Resources.resx b/GBM/My Project/Resources.resx index 9abb3d1..0e1ac6f 100644 --- a/GBM/My Project/Resources.resx +++ b/GBM/My Project/Resources.resx @@ -2164,7 +2164,7 @@ [PARAM] has been started. - - Use Name instead of ID for folder and file names + + Use Game ID for folder and file names \ No newline at end of file diff --git a/GBM/readme.txt b/GBM/readme.txt index f3bdad0..68a10fd 100644 --- a/GBM/readme.txt +++ b/GBM/readme.txt @@ -2,7 +2,7 @@ Game Backup Monitor v1.1.0 Readme http://mikemaximus.github.io/gbm-web/ gamebackupmonitor@gmail.com -March 8th, 2018 +March 12th, 2018 New in 1.1.0 @@ -19,7 +19,10 @@ All Platforms: - Core Design Changes (Game Configuration) - Game ID is now exposed to the user and can be changed. This feature is mainly for developer and contributer usage. - Game ID is generated automatically by GBM or acquired from an import, the user doesn't need to set it unless they want to. - - Game ID is now used to name game backup files and folders. + - Game ID (instead of Game Name) can now be used to name backup files and folders. + - GBM will continue to use the name by default for ease of use. + - This behavior can be toggled in the "Backup and Restore" section of Settings. + - Using the game Name for backup files has a minor risk associated with it. See "Known Issue #2 and #5" for more details. - Game Name can now contain any character. - When a game is deleted via Game Manager (or sync), all backup manifest entries for that particular game are now deleted. The backup files themselves are not. - The Game Manager now syncs changes to the remote database immediately, instead of only when closed. @@ -73,15 +76,15 @@ Known Issues: - The local backup manifest data for the changed game(s) on that PC will be lost. GBM will see any backups for the changed game(s) as new and will handle them accordingly. - Any processes assigned to the changed games(s) on that PC will be lost. Once your PCs are back in sync, this will no longer be an issue unless you are constantly changing your Game IDs, which is not recommended. -2. Backup files made prior to v1.1.0 are not being renamed or removed when a new backup is created. - - This is due to file name now being generated by the Game ID and not the name. - - Only backups made prior to v1.1.0 are affected by this issue. - - After new backup files are created, these files can be deleted at the user's discretion. +2. Backup files are not being renamed or removed when a new backup is created. + - This happens on the first backup after toggling between using the Name or ID for your file names. It's best to choose one setting and stick with it. 3. Configurations on the official game list are no longer fully compatible with older GBM versions. - Technically they will work. But any game imported with a special character in it's name, such as a colon, will not create backup files correctly. - These characters can be manually removed from the game name after importing, then the configurations will function properly. 4. The error "The requested operation requires elevation" occurs when GBM tries to launch a process associated with a game. - This means the process you're trying to launch with GBM requires administrator privilege. - Click the blue "user" icon on the bottom left of the GBM window to quickly switch to administrator mode. +5. Game configurations using the same name, and configurations that end up with the same name when special characters are stripped will overwrite each other's backup files. + - For most users this should be a non-issue. Toggle "Use Game ID for folder and file names" to on in the Settings screen if this is a problem for you. The entire version history of GBM releases is available at http://mikemaximus.github.io/gbm-web/versionhistory.html \ No newline at end of file From 79fd874f60a9a9531da0ce816d3686eb7698ab35 Mon Sep 17 00:00:00 2001 From: "Michael J. Seiferling" Date: Mon, 12 Mar 2018 20:17:34 -0600 Subject: [PATCH 38/38] Updated readme.txt --- GBM/readme.txt | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/GBM/readme.txt b/GBM/readme.txt index 68a10fd..0b18f8e 100644 --- a/GBM/readme.txt +++ b/GBM/readme.txt @@ -12,7 +12,7 @@ Version 1.1.0 makes fundamental changes to how GBM works with game configuration I've done my best to make sure the upgrade process allows everyone to continue using their existing data and configurations. -However, users who are sharing a backup folder between multiple PCs will experience data loss at some point due to the changes in this version. Please read "Known Issue #1" in this file for details. +However, users who are sharing a backup folder between multiple PCs may experience data loss at some point due to the changes in this version. Please read "Known Issue #1" in this file for details. All Platforms: @@ -22,12 +22,12 @@ All Platforms: - Game ID (instead of Game Name) can now be used to name backup files and folders. - GBM will continue to use the name by default for ease of use. - This behavior can be toggled in the "Backup and Restore" section of Settings. - - Using the game Name for backup files has a minor risk associated with it. See "Known Issue #2 and #5" for more details. + - Using the game Name for backup files has a minor risk associated with it. See "Known Issue #2 and #4" for more details. - Game Name can now contain any character. - When a game is deleted via Game Manager (or sync), all backup manifest entries for that particular game are now deleted. The backup files themselves are not. - The Game Manager now syncs changes to the remote database immediately, instead of only when closed. -- Feature Addtions & Changes +- Feature Additions & Changes - Added Regular Expression support for game detection - This feature allows GBM to detect games based on a pattern instead of a single process name. - This allows GBM to better support games that run from multiple executables and games that use interpreters or emulators. @@ -42,12 +42,12 @@ All Platforms: - Added "Backup GBM data files on launch" to the settings. A long overdue feature, this will backup both the remote and local databases (as gbm.s3db.launch.bak) each time GBM starts. - This new setting is enabled by default. - Only one backup is kept, the prior one will be overwritten. - - Added the ability to display messages that can be supressed. These messages can be reset via the Settings screen. + - Added the ability to display messages or warnings that can be supressed after one view. These messages can be reset via the Settings screen. - The "Enable Sync" feature is now mandatory and the option been removed from Settings. - The "Clean Local Manifest" feature has been removed. It is not required because manfiest entries are no longer orphaned by design. Existing orphaned entries will be removed during the v1.1.0 database upgrade. - Added "Sync Game IDs" feature. This allows the user to update their game configuration identifiers to match the official list or an export file. - - The sync is based on similarly named game configurations, therefore it's not 100% effective. Some data may be missed and require manual changes. - - This is an optional upgrade tool for users with existing data from older versions. It allows the import feature to properly recognize and update game configurations. + - This is mainly an optional upgrade tool for users with existing data from older versions. It allows the import feature to properly recognize and update game configurations. + - The sync is based on similarly named game configurations, therefore it's not 100% effective. Some games may be missed and require manual changes. - If you share a backup folder with multiple PCs, this feature will cause some data loss when the new IDs are synced to the other PCs. See "Known Issue #1" - Import / Export Changes @@ -67,7 +67,7 @@ Linux Only: - GBM now uses notify-send (libnotify) if it's available to display notifications on Linux. - Mono style notifications will be displayed if notify-send is not available. - - The GBM icon will be displayed on notifications if it's been installed to the correct location (via makefile or deb). + - The GBM icon will be displayed on notifications if it's been installed via the makefile or a package installer. Known Issues: @@ -78,13 +78,16 @@ Known Issues: Once your PCs are back in sync, this will no longer be an issue unless you are constantly changing your Game IDs, which is not recommended. 2. Backup files are not being renamed or removed when a new backup is created. - This happens on the first backup after toggling between using the Name or ID for your file names. It's best to choose one setting and stick with it. -3. Configurations on the official game list are no longer fully compatible with older GBM versions. - - Technically they will work. But any game imported with a special character in it's name, such as a colon, will not create backup files correctly. - - These characters can be manually removed from the game name after importing, then the configurations will function properly. -4. The error "The requested operation requires elevation" occurs when GBM tries to launch a process associated with a game. +3. The error "The requested operation requires elevation" occurs when GBM tries to launch a process associated with a game. - This means the process you're trying to launch with GBM requires administrator privilege. - Click the blue "user" icon on the bottom left of the GBM window to quickly switch to administrator mode. -5. Game configurations using the same name, and configurations that end up with the same name when special characters are stripped will overwrite each other's backup files. +4. Game configurations using the same name, and configurations that end up with the same name when special characters are stripped will overwrite each other's backup files. - For most users this should be a non-issue. Toggle "Use Game ID for folder and file names" to on in the Settings screen if this is a problem for you. +Important Notices: + +1. Configurations on the official game list are no longer fully compatible with older GBM versions. + - Technically they will work, but any game imported with a special character in it's name, such as a colon, will not create backup files correctly. + - These characters can be manually removed from the game name after importing in an older version, then the configurations will function properly. + The entire version history of GBM releases is available at http://mikemaximus.github.io/gbm-web/versionhistory.html \ No newline at end of file