v0.94 bug fixes and feature additions

This commit is contained in:
Michael J. Seiferling
2015-11-12 16:28:00 -06:00
parent 0c3f3fd5f4
commit 3743e71288
6 changed files with 94 additions and 17 deletions
+34 -4
View File
@@ -367,8 +367,10 @@ Public Class frmMain
lblGameTitle.Text = "Last Game: " & oProcess.GameInfo.CroppedName
pbIcon.Image = oPriorImage
txtGameInfo.Text = sPriorDetails
lblTimeTitle.Visible = True
lblTimeSpent.Visible = True
If oSettings.TimeTracking Then
lblTimeTitle.Visible = True
lblTimeSpent.Visible = True
End If
Else
pbIcon.Image = My.Resources.Searching
lblGameTitle.Text = "No Game Detected"
@@ -451,7 +453,7 @@ Public Class frmMain
End If
'Do Time Update
UpdateTimeSpent(oProcess.GameInfo.Hours, 0)
If oSettings.TimeTracking Then UpdateTimeSpent(oProcess.GameInfo.Hours, 0)
'Set Details
If sFileName = String.Empty Then
@@ -703,6 +705,13 @@ Public Class frmMain
UpdateLog("The correct version of 7-Zip was not found! Please re-install GBM, you may experience an application crash if a backup or restore is performed.", True, ToolTipIcon.Error)
End If
'Verify the "Start with Windows" setting
If oSettings.StartWithWindows Then
If Not VerifyStartWithWindows() Then
UpdateLog("GBM is running from a new location, the Windows startup entry has been updated.", True, ToolTipIcon.Info)
End If
End If
End Sub
'Functions that handle buttons, menus and other GUI features on this form
@@ -1047,6 +1056,27 @@ Public Class frmMain
End If
End Sub
Private Function VerifyStartWithWindows() As Boolean
Dim oKey As Microsoft.Win32.RegistryKey
Dim sAppName As String = Application.ProductName
Dim sAppPath As String = Application.ExecutablePath
Dim sRegPath As String
oKey = Microsoft.Win32.Registry.CurrentUser.OpenSubKey("SOFTWARE\Microsoft\Windows\CurrentVersion\Run", True)
sRegPath = oKey.GetValue(sAppName, String.Empty).ToString.Replace("""", "")
oKey.Close()
If sAppPath.ToLower <> sRegPath.ToLower Then
oKey = Microsoft.Win32.Registry.CurrentUser.OpenSubKey("SOFTWARE\Microsoft\Windows\CurrentVersion\Run", True)
oKey.SetValue(sAppName, """" & sAppPath & """")
oKey.Close()
Return False
Else
Return True
End If
End Function
Private Sub CheckForSavedDuplicate()
For Each o As clsGame In oProcess.DuplicateList
If o.ProcessPath.ToLower = oProcess.GameInfo.ProcessPath.ToLower Then
@@ -1337,7 +1367,7 @@ Public Class frmMain
If Not bCancelledByUser Then
DoMultiGameCheck()
UpdateLog(oProcess.GameInfo.Name & " has ended.", False)
HandleTimeSpent()
If oSettings.TimeTracking Then HandleTimeSpent()
RunBackup()
End If
bCancelledByUser = False
+20 -7
View File
@@ -25,6 +25,7 @@ Partial Class frmSettings
Me.chkMonitorOnStartup = New System.Windows.Forms.CheckBox()
Me.chkBackupConfirm = New System.Windows.Forms.CheckBox()
Me.grpGeneral = New System.Windows.Forms.GroupBox()
Me.chkTimeTracking = New System.Windows.Forms.CheckBox()
Me.chkStartWindows = New System.Windows.Forms.CheckBox()
Me.chkSync = New System.Windows.Forms.CheckBox()
Me.chkShowDetectionTips = New System.Windows.Forms.CheckBox()
@@ -68,6 +69,7 @@ Partial Class frmSettings
'
'grpGeneral
'
Me.grpGeneral.Controls.Add(Me.chkTimeTracking)
Me.grpGeneral.Controls.Add(Me.chkStartWindows)
Me.grpGeneral.Controls.Add(Me.chkSync)
Me.grpGeneral.Controls.Add(Me.chkShowDetectionTips)
@@ -75,11 +77,21 @@ Partial Class frmSettings
Me.grpGeneral.Controls.Add(Me.chkMonitorOnStartup)
Me.grpGeneral.Location = New System.Drawing.Point(12, 12)
Me.grpGeneral.Name = "grpGeneral"
Me.grpGeneral.Size = New System.Drawing.Size(360, 145)
Me.grpGeneral.Size = New System.Drawing.Size(360, 165)
Me.grpGeneral.TabIndex = 0
Me.grpGeneral.TabStop = False
Me.grpGeneral.Text = "General"
'
'chkTimeTracking
'
Me.chkTimeTracking.AutoSize = True
Me.chkTimeTracking.Location = New System.Drawing.Point(6, 111)
Me.chkTimeTracking.Name = "chkTimeTracking"
Me.chkTimeTracking.Size = New System.Drawing.Size(122, 17)
Me.chkTimeTracking.TabIndex = 5
Me.chkTimeTracking.Text = "Enable time tracking"
Me.chkTimeTracking.UseVisualStyleBackColor = True
'
'chkStartWindows
'
Me.chkStartWindows.AutoSize = True
@@ -93,7 +105,7 @@ Partial Class frmSettings
'chkSync
'
Me.chkSync.AutoSize = True
Me.chkSync.Location = New System.Drawing.Point(6, 111)
Me.chkSync.Location = New System.Drawing.Point(6, 134)
Me.chkSync.Name = "chkSync"
Me.chkSync.Size = New System.Drawing.Size(208, 17)
Me.chkSync.TabIndex = 4
@@ -125,7 +137,7 @@ Partial Class frmSettings
Me.grpPaths.Controls.Add(Me.btnBackupFolder)
Me.grpPaths.Controls.Add(Me.lblBackupFolder)
Me.grpPaths.Controls.Add(Me.txtBackupFolder)
Me.grpPaths.Location = New System.Drawing.Point(12, 311)
Me.grpPaths.Location = New System.Drawing.Point(12, 331)
Me.grpPaths.Name = "grpPaths"
Me.grpPaths.Size = New System.Drawing.Size(360, 60)
Me.grpPaths.TabIndex = 2
@@ -160,7 +172,7 @@ Partial Class frmSettings
'btnSave
'
Me.btnSave.DialogResult = System.Windows.Forms.DialogResult.OK
Me.btnSave.Location = New System.Drawing.Point(216, 377)
Me.btnSave.Location = New System.Drawing.Point(216, 397)
Me.btnSave.Name = "btnSave"
Me.btnSave.Size = New System.Drawing.Size(75, 23)
Me.btnSave.TabIndex = 3
@@ -170,7 +182,7 @@ Partial Class frmSettings
'btnCancel
'
Me.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel
Me.btnCancel.Location = New System.Drawing.Point(297, 377)
Me.btnCancel.Location = New System.Drawing.Point(297, 397)
Me.btnCancel.Name = "btnCancel"
Me.btnCancel.Size = New System.Drawing.Size(75, 23)
Me.btnCancel.TabIndex = 4
@@ -184,7 +196,7 @@ Partial Class frmSettings
Me.grpBackup.Controls.Add(Me.chkOverwriteWarning)
Me.grpBackup.Controls.Add(Me.chkCreateFolder)
Me.grpBackup.Controls.Add(Me.chkBackupConfirm)
Me.grpBackup.Location = New System.Drawing.Point(12, 163)
Me.grpBackup.Location = New System.Drawing.Point(12, 183)
Me.grpBackup.Name = "grpBackup"
Me.grpBackup.Size = New System.Drawing.Size(360, 142)
Me.grpBackup.TabIndex = 1
@@ -235,7 +247,7 @@ Partial Class frmSettings
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(384, 412)
Me.ClientSize = New System.Drawing.Size(384, 431)
Me.Controls.Add(Me.grpBackup)
Me.Controls.Add(Me.btnCancel)
Me.Controls.Add(Me.btnSave)
@@ -277,4 +289,5 @@ Partial Class frmSettings
Friend WithEvents chkSync As System.Windows.Forms.CheckBox
Friend WithEvents chkCheckSum As System.Windows.Forms.CheckBox
Friend WithEvents chkStartWindows As System.Windows.Forms.CheckBox
Friend WithEvents chkTimeTracking As System.Windows.Forms.CheckBox
End Class
+2
View File
@@ -53,6 +53,7 @@
oSettings.CreateSubFolder = chkCreateFolder.Checked
oSettings.ShowOverwriteWarning = chkOverwriteWarning.Checked
oSettings.RestoreOnLaunch = chkRestoreOnLaunch.Checked
oSettings.TimeTracking = chkTimeTracking.Checked
'We need to clear all checksums its turned off
If chkCheckSum.Checked = False And oSettings.CheckSum = True Then
@@ -102,6 +103,7 @@
txtBackupFolder.Text = oSettings.BackupFolder
chkSync.Checked = oSettings.Sync
chkCheckSum.Checked = oSettings.CheckSum
chkTimeTracking.Checked = oSettings.TimeTracking
End Sub
Private Sub btnSave_Click(sender As System.Object, e As System.EventArgs) Handles btnSave.Click
+23 -1
View File
@@ -71,7 +71,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, CheckSum BOOLEAN NOT NULL, StartWithWindows BOOLEAN NOT NULL);"
"BackupFolder TEXT NOT NULL, Sync BOOLEAN NOT NULL, CheckSum BOOLEAN NOT NULL, StartWithWindows BOOLEAN NOT NULL, TimeTracking BOOLEAN 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, " & _
@@ -411,6 +411,28 @@ Public Class mgrSQLite
End If
End If
'0.94 Upgrade
If GetDatabaseVersion() < 94 Then
If eDatabase = Database.Local Then
'Backup DB before starting
BackupDB("v93")
'Add new setting
sSQL = "ALTER TABLE settings ADD COLUMN TimeTracking BOOLEAN NOT NULL DEFAULT 1;"
sSQL &= "PRAGMA user_version=94"
RunParamQuery(sSQL, New Hashtable)
End If
If eDatabase = Database.Remote Then
'Backup DB before starting
BackupDB("v93")
sSQL = "PRAGMA user_version=94"
RunParamQuery(sSQL, New Hashtable)
End If
End If
End Sub
Public Function GetDBSize() As Long
+13 -1
View File
@@ -11,6 +11,7 @@ Public Class mgrSettings
Private bRestoreOnLaunch As Boolean = False
Private bSync As Boolean = True
Private bCheckSum As Boolean = True
Private bTimeTracking As Boolean = True
Private sBackupFolder As String = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments).TrimEnd(New Char() {"\", "/"})
Property StartWithWindows As Boolean
@@ -103,6 +104,15 @@ Public Class mgrSettings
End Set
End Property
Property TimeTracking As Boolean
Get
Return bTimeTracking
End Get
Set(value As Boolean)
bTimeTracking = value
End Set
End Property
Property BackupFolder As String
Get
Return sBackupFolder
@@ -121,7 +131,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, @CheckSum, @StartWithWindows)"
sSQL &= "@CreateSubFolder, @ShowOverwriteWarning, @RestoreOnLaunch, @BackupFolder, @Sync, @CheckSum, @StartWithWindows, @TimeTracking)"
hshParams.Add("MonitorOnStartup", MonitorOnStartup)
hshParams.Add("StartToTray", StartToTray)
@@ -134,6 +144,7 @@ Public Class mgrSettings
hshParams.Add("Sync", Sync)
hshParams.Add("CheckSum", CheckSum)
hshParams.Add("StartWithWindows", StartWithWindows)
hshParams.Add("TimeTracking", TimeTracking)
oDatabase.RunParamQuery(sSQL, hshParams)
End Sub
@@ -160,6 +171,7 @@ Public Class mgrSettings
Sync = CBool(dr(9))
CheckSum = CBool(dr(10))
StartWithWindows = CBool(dr(11))
TimeTracking = CBool(dr(12))
Next
oDatabase.Disconnect()
-2
View File
@@ -30,7 +30,6 @@ Public Class mgrXML
oGame.Path = xFileReader.ReadElementString("savelocation")
oGame.FolderSave = xFileReader.ReadElementString("foldersave")
oGame.FileType = xFileReader.ReadElementString("filetype")
oGame.AppendTimeStamp = xFileReader.ReadElementString("appendtimestamp")
oGame.ExcludeList = xFileReader.ReadElementString("excludelist")
If hshList.Contains(oGame.ProcessName) Or hshDupeList.Contains(oGame.ProcessName) Then
@@ -81,7 +80,6 @@ Public Class mgrXML
xFileWriter.WriteElementString("savelocation", o.TruePath)
xFileWriter.WriteElementString("foldersave", o.FolderSave)
xFileWriter.WriteElementString("filetype", o.FileType)
xFileWriter.WriteElementString("appendtimestamp", o.AppendTimeStamp)
xFileWriter.WriteElementString("excludelist", o.ExcludeList)
xFileWriter.WriteEndElement()
Next