From 708e9ce1fe1994bf5a868fa2592647644f2a9d84 Mon Sep 17 00:00:00 2001 From: "Michael J. Seiferling" Date: Tue, 4 Jul 2017 20:46:59 -0600 Subject: [PATCH 1/9] Cleaned up filter function --- GBM/Managers/mgrMonitorList.vb | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/GBM/Managers/mgrMonitorList.vb b/GBM/Managers/mgrMonitorList.vb index 3dd8a4b..c4b1682 100644 --- a/GBM/Managers/mgrMonitorList.vb +++ b/GBM/Managers/mgrMonitorList.vb @@ -499,12 +499,13 @@ Public Class mgrMonitorList Private Shared Function BuildFilterQuery(ByVal oTagFilters As List(Of clsTag), ByVal hshStringFilters As Hashtable, eFilterType As frmFilter.eFilterType, ByRef hshParams As Hashtable) As String Dim sSQL As String = String.Empty Dim iCounter As Integer = 0 + Dim sBaseSelect As String = "MonitorID, Name, Process, Path, AbsolutePath, FolderSave, FileType, TimeStamp, ExcludeList, ProcessPath, Icon, Hours, Version, Company, Enabled, MonitorOnly, BackupLimit, CleanFolder, Parameter FROM monitorlist" Select Case eFilterType Case frmFilter.eFilterType.NoFilter - sSQL = "SELECT MonitorID, Name, Process, Path, AbsolutePath, FolderSave, FileType, TimeStamp, ExcludeList, ProcessPath, Icon, Hours, Version, Company, Enabled, MonitorOnly, BackupLimit, CleanFolder, Parameter FROM monitorlist ORDER BY Name Asc" + sSQL = "SELECT " & sBaseSelect & " ORDER BY Name Asc" Case frmFilter.eFilterType.FieldAnd, frmFilter.eFilterType.FieldOr - sSQL = "SELECT MonitorID, Name, Process, Path, AbsolutePath, FolderSave, FileType, TimeStamp, ExcludeList, ProcessPath, Icon, Hours, Version, Company, Enabled, MonitorOnly, BackupLimit, CleanFolder, Parameter FROM monitorlist" + sSQL = "SELECT " & sBaseSelect If hshStringFilters.Count > 0 Then sSQL &= " WHERE (" @@ -526,8 +527,8 @@ Public Class mgrMonitorList End If sSQL &= " ORDER BY Name Asc" Case frmFilter.eFilterType.AnyTag - sSQL = "SELECT DISTINCT MonitorID, Name, Process, Path, AbsolutePath, FolderSave, FileType, TimeStamp, ExcludeList, ProcessPath, Icon, Hours, Version, Company, Enabled, MonitorOnly, BackupLimit, CleanFolder, Parameter FROM monitorlist " - sSQL &= "NATURAL JOIN gametags WHERE gametags.TagID IN (" + sSQL = "SELECT DISTINCT " & sBaseSelect + sSQL &= " NATURAL JOIN gametags WHERE gametags.TagID IN (" For Each oTag As clsTag In oTagFilters sSQL &= "@TagID" & iCounter & "," @@ -538,7 +539,7 @@ Public Class mgrMonitorList sSQL = sSQL.TrimEnd(",") sSQL &= ") ORDER BY Name Asc" Case frmFilter.eFilterType.AllTags - sSQL = "SELECT MonitorID, Name, Process, Path, AbsolutePath, FolderSave, FileType, TimeStamp, ExcludeList, ProcessPath, Icon, Hours, Version, Company, Enabled, MonitorOnly, BackupLimit, CleanFolder, Parameter FROM monitorlist WHERE MonitorID IN " + sSQL = "SELECT " & sBaseSelect & " WHERE MonitorID IN " For Each oTag As clsTag In oTagFilters sSQL &= "(SELECT MonitorID FROM gametags WHERE monitorlist.MonitorID = gametags.MonitorID And TagID = @TagID" & iCounter & ")" @@ -551,7 +552,7 @@ Public Class mgrMonitorList sSQL &= " ORDER BY Name Asc" Case frmFilter.eFilterType.NoTags - sSQL = "SELECT MonitorID, Name, Process, Path, AbsolutePath, FolderSave, FileType, TimeStamp, ExcludeList, ProcessPath, Icon, Hours, Version, Company, Enabled, MonitorOnly, BackupLimit, CleanFolder, Parameter FROM monitorlist WHERE MonitorID NOT IN (SELECT MonitorID FROM gametags) ORDER BY Name Asc" + sSQL = "SELECT " & sBaseSelect & " WHERE MonitorID NOT IN (SELECT MonitorID FROM gametags) ORDER BY Name Asc" End Select Return sSQL From fd815f0c461fe49c3ed4a479bfece9bfc8064122 Mon Sep 17 00:00:00 2001 From: "Michael J. Seiferling" Date: Thu, 6 Jul 2017 09:17:14 -0600 Subject: [PATCH 2/9] Fixed incorrect tray menu options --- GBM/Forms/frmMain.vb | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/GBM/Forms/frmMain.vb b/GBM/Forms/frmMain.vb index e1e47a1..6498d26 100644 --- a/GBM/Forms/frmMain.vb +++ b/GBM/Forms/frmMain.vb @@ -1132,7 +1132,7 @@ Public Class frmMain End If End Sub - Private Sub ToggleMenuEnable() + Private Sub ToggleMenuEnable(Optional ByVal bGameDetected As Boolean = False) If bMenuEnabled Then ToggleMenuItems(False, gMonFile) ToggleMenuItems(False, gMonSetup) @@ -1144,6 +1144,10 @@ Public Class frmMain gMonNotification.Enabled = False gMonTrayNotification.Enabled = False gMonTraySettings.Enabled = False + If Not bGameDetected Then + gMonTrayMon.Enabled = False + gMonTrayShow.Enabled = False + End If bMenuEnabled = False Else ToggleMenuItems(True, gMonFile) @@ -1156,6 +1160,8 @@ Public Class frmMain gMonNotification.Enabled = True gMonTrayNotification.Enabled = True gMonTraySettings.Enabled = True + gMonTrayMon.Enabled = True + gMonTrayShow.Enabled = True bMenuEnabled = True End If End Sub @@ -1338,7 +1344,7 @@ Public Class frmMain ToggleMenuText() End Sub - Private Sub PauseScan() + Private Sub PauseScan(Optional ByVal bGameDetected As Boolean = False) If eCurrentStatus = eStatus.Running Then StopSyncWatcher() tmScanTimer.Stop() @@ -1348,7 +1354,7 @@ Public Class frmMain gMonTray.Icon = GBM_Tray_Detected End If ToggleMenuText() - ToggleMenuEnable() + ToggleMenuEnable(bGameDetected) End Sub Private Sub ResumeScan() @@ -1682,7 +1688,7 @@ Public Class frmMain Dim sErrorMessage As String = String.Empty If oProcess.SearchRunningProcesses(hshScanList, bNeedsPath, iErrorCode, bProcessDebugMode) Then - PauseScan() + PauseScan(True) If bNeedsPath Then bContinue = False From f245dee7810c72410535d3aaf05008d14d410e0e Mon Sep 17 00:00:00 2001 From: "Michael J. Seiferling" Date: Fri, 7 Jul 2017 18:19:59 -0600 Subject: [PATCH 3/9] Updated .gitignore for Visual Studio 2017 --- .gitignore | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 9d3a855..1697b12 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,8 @@ *.suo *.user *.sln.docstates +slnx.* +VSWorkspaceState.json # Build results [Dd]ebug/ @@ -185,4 +187,6 @@ FakesAssemblies/ # LightSwitch generated files GeneratedArtifacts/ _Pvt_Extensions/ -ModelManifest.xml \ No newline at end of file +ModelManifest.xml +/.vs/slnx.sqlite +/.vs/VSWorkspaceState.json From e09e38a5c472b816dcee3198fbe2c8ac02362cfc Mon Sep 17 00:00:00 2001 From: "Michael J. Seiferling" Date: Fri, 7 Jul 2017 18:45:15 -0600 Subject: [PATCH 4/9] Updated .gitignore for Visual Studio 2017 --- .gitignore | 2 -- 1 file changed, 2 deletions(-) diff --git a/.gitignore b/.gitignore index 1697b12..50e9066 100644 --- a/.gitignore +++ b/.gitignore @@ -5,8 +5,6 @@ *.suo *.user *.sln.docstates -slnx.* -VSWorkspaceState.json # Build results [Dd]ebug/ From 9c8cbad7d5579e94d5f51699ed090a3575a06fbe Mon Sep 17 00:00:00 2001 From: MikeMaximus Date: Thu, 13 Jul 2017 13:57:28 -0600 Subject: [PATCH 5/9] Fix for issue #93 --- GBM/Managers/mgrSQLite.vb | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/GBM/Managers/mgrSQLite.vb b/GBM/Managers/mgrSQLite.vb index bad4fa5..d34e808 100644 --- a/GBM/Managers/mgrSQLite.vb +++ b/GBM/Managers/mgrSQLite.vb @@ -170,6 +170,15 @@ Public Class mgrSQLite db.Close() End Sub + Private Sub RollBack(ByRef trans As SqliteTransaction) + Try + trans.Rollback() + Catch + 'SQLite may or may not perform an auto-rollback when certain failures occur, such as disk full or out of memory. + 'Multiple rollbacks will cause an exception, therefore lets just do nothing when that happens. + End Try + End Sub + Private Sub BuildParams(ByRef command As SqliteCommand, ByRef hshParams As Hashtable) For Each de As DictionaryEntry In hshParams command.Parameters.AddWithValue(de.Key, de.Value) @@ -189,7 +198,7 @@ Public Class mgrSQLite command.ExecuteNonQuery() trans.Commit() Catch ex As Exception - trans.Rollback() + RollBack(trans) mgrCommon.ShowMessage(mgrSQLite_ErrorQueryFailure, New String() {sSQL, ex.Message}, MsgBoxStyle.Exclamation) Return False Finally @@ -215,7 +224,7 @@ Public Class mgrSQLite Next trans.Commit() Catch ex As Exception - trans.Rollback() + RollBack(trans) mgrCommon.ShowMessage(mgrSQLite_ErrorQueryFailure, New String() {sSQL, ex.Message}, MsgBoxStyle.Exclamation) Return False Finally From d3d6482bfddaf6c0b3390c91fe8b5bb9ca1831f2 Mon Sep 17 00:00:00 2001 From: MikeMaximus Date: Sat, 15 Jul 2017 10:46:37 -0600 Subject: [PATCH 6/9] Fix for issue #94 --- GBM/Managers/mgrCommon.vb | 37 +++++++++++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/GBM/Managers/mgrCommon.vb b/GBM/Managers/mgrCommon.vb index 49d2025..5820c5c 100644 --- a/GBM/Managers/mgrCommon.vb +++ b/GBM/Managers/mgrCommon.vb @@ -322,8 +322,32 @@ Public Class mgrCommon Return lSize End Function - 'Get available disk space on a drive - Public Shared Function GetAvailableDiskSpace(ByVal sPath As String) As Long + 'Get available disk space on a drive (Unix) + Private Shared Function GetAvailableDiskSpaceLinux(ByVal sPath As String) As Long + Dim prsdf As Process + Dim sOutput As String + Dim sAvailableSpace As String + Try + prsdf = New Process + prsdf.StartInfo.FileName = "/bin/df" + prsdf.StartInfo.Arguments = sPath + prsdf.StartInfo.UseShellExecute = False + prsdf.StartInfo.RedirectStandardOutput = True + prsdf.StartInfo.CreateNoWindow = True + prsdf.Start() + sOutput = prsdf.StandardOutput.ReadToEnd + 'Parse df output to grab "Available" value + sAvailableSpace = sOutput.Split(vbLf)(1).Split(New Char() {" "}, StringSplitOptions.RemoveEmptyEntries)(3) + 'Return value in bytes + Return CLng(sAvailableSpace) * 1024 + Catch + Return 0 + End Try + Return 0 + End Function + + 'Get available disk space on a drive (Windows) + Private Shared Function GetAvailableDiskSpaceWindows(ByVal sPath As String) As Long Dim oDrive As DriveInfo Dim lAvailableSpace As Long = 0 Try @@ -335,6 +359,15 @@ Public Class mgrCommon Return lAvailableSpace End Function + 'Get available disk space on a drive + Public Shared Function GetAvailableDiskSpace(ByVal sPath As String) As Long + If IsUnix() Then + Return GetAvailableDiskSpaceLinux(sPath) + Else + Return GetAvailableDiskSpaceWindows(sPath) + End If + End Function + 'Delete file based on OS type Public Shared Sub DeleteFile(ByVal sPath As String, Optional ByVal bRecycle As Boolean = True) If File.Exists(sPath) Then From b5859d6541673eb1f683df941a7106f01d79c7a5 Mon Sep 17 00:00:00 2001 From: MikeMaximus Date: Sat, 15 Jul 2017 10:54:15 -0600 Subject: [PATCH 7/9] Cleaned up fix for issue #94 --- GBM/Managers/mgrCommon.vb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/GBM/Managers/mgrCommon.vb b/GBM/Managers/mgrCommon.vb index 5820c5c..e9c8bc9 100644 --- a/GBM/Managers/mgrCommon.vb +++ b/GBM/Managers/mgrCommon.vb @@ -323,7 +323,7 @@ Public Class mgrCommon End Function 'Get available disk space on a drive (Unix) - Private Shared Function GetAvailableDiskSpaceLinux(ByVal sPath As String) As Long + Private Shared Function GetAvailableDiskSpaceUnix(ByVal sPath As String) As Long Dim prsdf As Process Dim sOutput As String Dim sAvailableSpace As String @@ -343,7 +343,6 @@ Public Class mgrCommon Catch Return 0 End Try - Return 0 End Function 'Get available disk space on a drive (Windows) @@ -362,7 +361,7 @@ Public Class mgrCommon 'Get available disk space on a drive Public Shared Function GetAvailableDiskSpace(ByVal sPath As String) As Long If IsUnix() Then - Return GetAvailableDiskSpaceLinux(sPath) + Return GetAvailableDiskSpaceUnix(sPath) Else Return GetAvailableDiskSpaceWindows(sPath) End If From 44fdc4160e77c1d774dd3960083a64054f29dbf7 Mon Sep 17 00:00:00 2001 From: "Michael J. Seiferling" Date: Wed, 2 Aug 2017 11:39:19 -0600 Subject: [PATCH 8/9] Fixed some long standing system tray bugs --- GBM/Forms/frmMain.vb | 23 +++++++++++------------ GBM/My Project/Resources.Designer.vb | 9 +++++++++ GBM/My Project/Resources.resx | 3 +++ 3 files changed, 23 insertions(+), 12 deletions(-) diff --git a/GBM/Forms/frmMain.vb b/GBM/Forms/frmMain.vb index 6498d26..31c81b2 100644 --- a/GBM/Forms/frmMain.vb +++ b/GBM/Forms/frmMain.vb @@ -1037,11 +1037,15 @@ Public Class frmMain Me.ShowInTaskbar = True Me.Focus() Else - bShowToggle = False - wState = Me.WindowState - Me.WindowState = FormWindowState.Minimized - Me.ShowInTaskbar = False - Me.Visible = False + If Me.CanFocus Then + bShowToggle = False + wState = Me.WindowState + Me.WindowState = FormWindowState.Minimized + Me.ShowInTaskbar = False + Me.Visible = False + Else + gMonTray.ShowBalloonTip(5000, App_NameLong, App_ErrorFocus, ToolTipIcon.Info) + End If End If End Sub @@ -1147,6 +1151,7 @@ Public Class frmMain If Not bGameDetected Then gMonTrayMon.Enabled = False gMonTrayShow.Enabled = False + gMonTrayExit.Enabled = False End If bMenuEnabled = False Else @@ -1162,6 +1167,7 @@ Public Class frmMain gMonTraySettings.Enabled = True gMonTrayMon.Enabled = True gMonTrayShow.Enabled = True + gMonTrayExit.Enabled = True bMenuEnabled = True End If End Sub @@ -1631,13 +1637,6 @@ Public Class frmMain End If End Sub - Private Sub gMonTray_BalloonTipClicked(sender As System.Object, e As System.EventArgs) Handles gMonTray.BalloonTipClicked - bShowToggle = True - Me.Visible = True - Me.ShowInTaskbar = True - Me.Focus() - End Sub - Private Sub btnCancelOperation_Click(sender As Object, e As EventArgs) Handles btnCancelOperation.Click OperationCancel() End Sub diff --git a/GBM/My Project/Resources.Designer.vb b/GBM/My Project/Resources.Designer.vb index 89ad774..7eae80c 100644 --- a/GBM/My Project/Resources.Designer.vb +++ b/GBM/My Project/Resources.Designer.vb @@ -78,6 +78,15 @@ Namespace My.Resources End Get End Property + ''' + ''' Looks up a localized string similar to GBM is busy with an open window on your desktop.. + ''' + Friend ReadOnly Property App_ErrorFocus() As String + Get + Return ResourceManager.GetString("App_ErrorFocus", resourceCulture) + End Get + End Property + ''' ''' Looks up a localized string similar to This function is currently not available on a Unix based operating system.. ''' diff --git a/GBM/My Project/Resources.resx b/GBM/My Project/Resources.resx index b9a5d75..be8cac5 100644 --- a/GBM/My Project/Resources.resx +++ b/GBM/My Project/Resources.resx @@ -1798,4 +1798,7 @@ [PARAM] backup failed due to an error. + + GBM is busy with an open window on your desktop. + \ No newline at end of file From 89aa57e6d6ab6b25fb9cb0e70424426f5a063aaf Mon Sep 17 00:00:00 2001 From: "Michael J. Seiferling" Date: Wed, 2 Aug 2017 12:27:19 -0600 Subject: [PATCH 9/9] Final v103 changes --- GBM/My Project/AssemblyInfo.vb | 4 ++-- GBM/readme.txt | 27 +++++++-------------------- 2 files changed, 9 insertions(+), 22 deletions(-) diff --git a/GBM/My Project/AssemblyInfo.vb b/GBM/My Project/AssemblyInfo.vb index 0e26d81..f79cf5e 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 diff --git a/GBM/readme.txt b/GBM/readme.txt index 018258c..9b96e04 100644 --- a/GBM/readme.txt +++ b/GBM/readme.txt @@ -1,27 +1,14 @@ -Game Backup Monitor v1.02 Readme +Game Backup Monitor v1.03 Readme http://mikemaximus.github.io/gbm-web/ gamebackupmonitor@gmail.com -July 1, 2017 +August 2, 2017 -New in 1.02 +New in 1.03 -- (Windows) Upgraded SQLite to 3.19.3. -- (All) The SQLite version is displayed on the "About" screen. -- (All) Added the ability to detect command parameters. - - Use parameter detection for better detection of games running in emulators or interpreters like DOSBox. - - This is an advanced optional feature and is not available in the "Add Game Wizard", please read the manual (http://mikemaximus.github.io/gbm-web/manual.html) for more details. - - (Linux) Please note that Wine detection is still handled automatically by GBM and only requires a Windows process name. But this feature does work with Wine if you need to detect parameters! -- (All) Added the ability to resize and maximize the main program window. - - The log is now displayed by default and resizes with the window. - - The "Show/Hide Log" button has been removed due to technical issues with this change. - - The minimum window size will let you easily hide the log as in past versions. -- (All) The last browse location in various dialogs is now saved, such as when using the Import/Export feature. -- (All) Available disk space is checked before attempting a backup. The log now displays available disk space and save folder size. -- (Linux) Using the keyboard to navigate the game list in the Game Manager now works correctly. -- (All) Tags can now be added to a new game configuration before saving on the Game Manager. -- (All) Fixed various issues when adding new game configurations while using filters on the Game Manager. -- (All) Added better handling of 7-Zip warnings and errors. -- (Linux) GBM now requires the "readlink" utility to properly handle Wine games. However bash, ls and grep are no longer required. +- (Windows) You can no longer Alt-Tab to GBM while it's minimized to the system tray. This was an unintentional change in v1.02 and caused various bugs. +- (Windows) Fixed various issues and inconsistent behavior when using the system tray and menu. +- (Linux) Free drive space is now checked correctly when performing a backup. GBM now requires "df" (Coreutils) on Linux. +- (All) Error messages related to SQLite will now be displayed correctly, instead of forcing the application to exit. The entire version history of GBM releases is available at http://mikemaximus.github.io/gbm-web/versionhistory.html \ No newline at end of file