From 87326981dd4886ccd0dc5a8ea1f056a61aa87e42 Mon Sep 17 00:00:00 2001 From: "Michael J. Seiferling" Date: Tue, 8 Dec 2015 10:10:44 -0600 Subject: [PATCH] Updates for issues 20 and 24 --- GBM/Classes/clsBackup.vb | 2 +- GBM/Forms/frmGameManager.Designer.vb | 14 +----- GBM/Forms/frmGameManager.vb | 67 ++++----------------------- GBM/Forms/frmMain.Designer.vb | 27 +++++++---- GBM/Forms/frmMain.vb | 17 +++++-- GBM/Game Backup Monitor.vbproj | 4 +- GBM/Managers/mgrRestore.vb | 26 +++++++++++ GBM/My Project/Resources.Designer.vb | 20 -------- GBM/My Project/Resources.resx | 6 --- GBM/Resources/Lock.png | Bin 630 -> 0 bytes GBM/Resources/Unlock.png | Bin 637 -> 0 bytes 11 files changed, 69 insertions(+), 114 deletions(-) delete mode 100644 GBM/Resources/Lock.png delete mode 100644 GBM/Resources/Unlock.png diff --git a/GBM/Classes/clsBackup.vb b/GBM/Classes/clsBackup.vb index e61e806..b45fa0e 100644 --- a/GBM/Classes/clsBackup.vb +++ b/GBM/Classes/clsBackup.vb @@ -32,7 +32,7 @@ ReadOnly Property CroppedName As String Get If Name.Length > 40 Then - Return sName.Substring(0, 41) & "..." + Return sName.Substring(0, 41).Trim & "..." Else Return sName End If diff --git a/GBM/Forms/frmGameManager.Designer.vb b/GBM/Forms/frmGameManager.Designer.vb index 62b136a..879f10a 100644 --- a/GBM/Forms/frmGameManager.Designer.vb +++ b/GBM/Forms/frmGameManager.Designer.vb @@ -60,7 +60,6 @@ Partial Class frmGameManager Me.lblHours = New System.Windows.Forms.Label() Me.btnTags = New System.Windows.Forms.Button() Me.grpStats = New System.Windows.Forms.GroupBox() - Me.btnRestorePathLock = New System.Windows.Forms.Button() Me.lblRestorePath = New System.Windows.Forms.Label() Me.txtRestorePath = New System.Windows.Forms.TextBox() Me.btnOpenRestorePath = New System.Windows.Forms.Button() @@ -460,7 +459,6 @@ Partial Class frmGameManager 'grpStats ' Me.grpStats.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) - Me.grpStats.Controls.Add(Me.btnRestorePathLock) Me.grpStats.Controls.Add(Me.lblRestorePath) Me.grpStats.Controls.Add(Me.txtRestorePath) Me.grpStats.Controls.Add(Me.btnOpenRestorePath) @@ -480,15 +478,6 @@ Partial Class frmGameManager Me.grpStats.TabStop = False Me.grpStats.Text = "Backup Information" ' - 'btnRestorePathLock - ' - Me.btnRestorePathLock.Image = Global.GBM.My.Resources.Resources.Lock - Me.btnRestorePathLock.Location = New System.Drawing.Point(495, 97) - Me.btnRestorePathLock.Name = "btnRestorePathLock" - Me.btnRestorePathLock.Size = New System.Drawing.Size(33, 23) - Me.btnRestorePathLock.TabIndex = 9 - Me.btnRestorePathLock.UseVisualStyleBackColor = True - ' 'lblRestorePath ' Me.lblRestorePath.AutoSize = True @@ -503,7 +492,7 @@ Partial Class frmGameManager Me.txtRestorePath.Location = New System.Drawing.Point(96, 99) Me.txtRestorePath.Name = "txtRestorePath" Me.txtRestorePath.ReadOnly = True - Me.txtRestorePath.Size = New System.Drawing.Size(396, 20) + Me.txtRestorePath.Size = New System.Drawing.Size(432, 20) Me.txtRestorePath.TabIndex = 8 ' 'btnOpenRestorePath @@ -817,5 +806,4 @@ Partial Class frmGameManager Friend WithEvents btnExclude As System.Windows.Forms.Button Friend WithEvents lblRestorePath As Label Friend WithEvents txtRestorePath As TextBox - Friend WithEvents btnRestorePathLock As Button End Class diff --git a/GBM/Forms/frmGameManager.vb b/GBM/Forms/frmGameManager.vb index 47cc269..9a2681b 100644 --- a/GBM/Forms/frmGameManager.vb +++ b/GBM/Forms/frmGameManager.vb @@ -538,8 +538,7 @@ Public Class frmGameManager Else txtFileSize.Text = "Backup file was not found!" End If - txtRestorePath.Text = CurrentBackupItem.RestorePath - btnRestorePathLock.Enabled = True + txtRestorePath.Text = CurrentBackupItem.RestorePath Else txtCurrentBackup.Text = "Never" txtFileSize.Text = String.Empty @@ -547,8 +546,7 @@ Public Class frmGameManager btnOpenBackupFile.Enabled = False btnOpenRestorePath.Enabled = False btnRestore.Enabled = False - btnDeleteBackup.Enabled = False - btnRestorePathLock.Enabled = False + btnDeleteBackup.Enabled = False End If If oLocalBackupData.Contains(oApp.Name) Then @@ -762,10 +760,7 @@ Public Class frmGameManager btnTags.Enabled = False lblTags.Visible = False btnInclude.Text = "In&clude Items..." - btnExclude.Text = "E&xclude Items..." - txtRestorePath.ReadOnly = True - btnRestorePathLock.Image = My.Resources.Lock - btnRestorePathLock.Enabled = False + btnExclude.Text = "E&xclude Items..." Case eModes.Edit grpFilter.Enabled = False lstGames.Enabled = False @@ -800,9 +795,7 @@ Public Class frmGameManager btnDelete.Enabled = True btnBackup.Enabled = True btnTags.Enabled = True - lblTags.Visible = True - txtRestorePath.ReadOnly = True - btnRestorePathLock.Image = My.Resources.Lock + lblTags.Visible = True Case eModes.ViewTemp grpFilter.Enabled = True lstGames.Enabled = True @@ -819,9 +812,7 @@ Public Class frmGameManager btnTags.Enabled = False lblTags.Visible = False btnInclude.Text = "In&clude Items..." - btnExclude.Text = "E&xclude Items..." - txtRestorePath.ReadOnly = True - btnRestorePathLock.Image = My.Resources.Lock + btnExclude.Text = "E&xclude Items..." Case eModes.Disabled grpFilter.Enabled = True lstGames.Enabled = True @@ -846,9 +837,7 @@ Public Class frmGameManager lblTags.Visible = False btnInclude.Text = "In&clude Items..." btnExclude.Text = "E&xclude Items..." - txtRestorePath.ReadOnly = True - btnRestorePathLock.Image = My.Resources.Lock - btnRestorePathLock.Enabled = False + txtRestorePath.ReadOnly = True Case eModes.MultiSelect lstGames.Enabled = True WipeControls(grpConfig.Controls) @@ -872,11 +861,11 @@ Public Class frmGameManager btnMarkAsRestored.Enabled = True btnTags.Enabled = True lblTags.Visible = False - txtRestorePath.ReadOnly = True - btnRestorePathLock.Image = My.Resources.Lock - btnRestorePathLock.Enabled = False + txtRestorePath.ReadOnly = True End Select + lstGames.Focus() + IsLoading = False End Sub @@ -1181,40 +1170,6 @@ Public Class frmGameManager End If End Sub - Private Sub HandleRestorePathOverride() - Dim bUnlock As Boolean = False - - If txtRestorePath.ReadOnly Then - If CurrentBackupItem.RestorePath = txtSavePath.Text Then - If MsgBox("No problems were detected with the current backup's Restore Path, it's highly recommended you do NOT change it." & - vbCrLf & vbCrLf & "Do you still want to unlock the field for editing?", - MsgBoxStyle.YesNo, "Game Backup Monitor") = MsgBoxResult.Yes Then - bUnlock = True - End If - Else - bUnlock = True - End If - - If bUnlock Then - txtRestorePath.ReadOnly = False - btnRestorePathLock.Image = My.Resources.Unlock - MsgBox("You may now edit the Restore Path." & vbCrLf & vbCrLf & "Click the Lock button to save any changes.", MsgBoxStyle.Information, "Game Backup Monitor") - End If - Else - txtRestorePath.ReadOnly = True - btnRestorePathLock.Image = My.Resources.Lock - If CurrentBackupItem.RestorePath <> txtRestorePath.Text Then - If Path.IsPathRooted(txtRestorePath.Text) Then - CurrentBackupItem.AbsolutePath = True - CurrentBackupItem.RestorePath = txtRestorePath.Text - Else - CurrentBackupItem.RestorePath = txtRestorePath.Text - End If - mgrManifest.DoManifestUpdate(CurrentBackupItem, mgrSQLite.Database.Remote) - End If - End If - End Sub - Private Sub frmGameManager_Load(sender As Object, e As EventArgs) Handles MyBase.Load If DisableExternalFunctions Then @@ -1352,8 +1307,4 @@ Public Class frmGameManager btnInclude.Enabled = True End If End Sub - - Private Sub btnTogglePathLock_Click(sender As Object, e As EventArgs) Handles btnRestorePathLock.Click - HandleRestorePathOverride() - 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 12483fb..1df1a98 100644 --- a/GBM/Forms/frmMain.Designer.vb +++ b/GBM/Forms/frmMain.Designer.vb @@ -73,6 +73,7 @@ Partial Class frmMain Me.gMonHelpManual = New System.Windows.Forms.ToolStripMenuItem() Me.gMonHelpCheckforUpdates = New System.Windows.Forms.ToolStripMenuItem() Me.gMonHelpAbout = New System.Windows.Forms.ToolStripMenuItem() + Me.gMonNotification = New System.Windows.Forms.ToolStripMenuItem() Me.pbIcon = New System.Windows.Forms.PictureBox() Me.btnLogToggle = New System.Windows.Forms.Button() Me.lblGameTitle = New System.Windows.Forms.Label() @@ -84,7 +85,7 @@ Partial Class frmMain Me.lblStatus1 = New System.Windows.Forms.Label() Me.lblStatus2 = New System.Windows.Forms.Label() Me.lblStatus3 = New System.Windows.Forms.Label() - Me.gMonNotification = New System.Windows.Forms.ToolStripMenuItem() + Me.gMonTrayNotification = New System.Windows.Forms.ToolStripMenuItem() Me.gMonTrayMenu.SuspendLayout() Me.gMonStatusStrip.SuspendLayout() Me.gMonMainMenu.SuspendLayout() @@ -102,9 +103,9 @@ Partial Class frmMain ' 'gMonTrayMenu ' - Me.gMonTrayMenu.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.gMonTrayShow, Me.gMonTraySep2, Me.gMonTrayMon, Me.gMonTraySettings, Me.gMonTraySetup, Me.gMonTrayTools, Me.gMonTraySep1, Me.gMonTrayExit}) + 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, 148) + Me.gMonTrayMenu.Size = New System.Drawing.Size(162, 192) ' 'gMonTrayShow ' @@ -418,6 +419,14 @@ Partial Class frmMain Me.gMonHelpAbout.Size = New System.Drawing.Size(171, 22) Me.gMonHelpAbout.Text = "&About" ' + 'gMonNotification + ' + Me.gMonNotification.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right + Me.gMonNotification.Name = "gMonNotification" + Me.gMonNotification.Size = New System.Drawing.Size(82, 20) + Me.gMonNotification.Text = "Notification" + Me.gMonNotification.Visible = False + ' 'pbIcon ' Me.pbIcon.Location = New System.Drawing.Point(12, 36) @@ -518,13 +527,12 @@ Partial Class frmMain Me.lblStatus3.Size = New System.Drawing.Size(365, 13) Me.lblStatus3.TabIndex = 17 ' - 'gMonNotification + 'gMonTrayNotification ' - Me.gMonNotification.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right - Me.gMonNotification.Name = "gMonNotification" - Me.gMonNotification.Size = New System.Drawing.Size(82, 20) - Me.gMonNotification.Text = "Notification" - Me.gMonNotification.Visible = False + Me.gMonTrayNotification.Name = "gMonTrayNotification" + Me.gMonTrayNotification.Size = New System.Drawing.Size(161, 22) + Me.gMonTrayNotification.Text = "Notification" + Me.gMonTrayNotification.Visible = False ' 'frmMain ' @@ -626,4 +634,5 @@ Partial Class frmMain Friend WithEvents lblStatus2 As Label Friend WithEvents lblStatus3 As Label Friend WithEvents gMonNotification As System.Windows.Forms.ToolStripMenuItem + Friend WithEvents gMonTrayNotification As System.Windows.Forms.ToolStripMenuItem End Class diff --git a/GBM/Forms/frmMain.vb b/GBM/Forms/frmMain.vb index e215d79..153e27e 100644 --- a/GBM/Forms/frmMain.vb +++ b/GBM/Forms/frmMain.vb @@ -175,7 +175,7 @@ Public Class frmMain If mgrRestore.CheckPath(oRestoreInfo, oGame, bTriggerReload) Then oReadyList.Add(oRestoreInfo) Else - UpdateLog(oRestoreInfo.Name & " restore was cancelled due to unknown restore path.", False, ToolTipIcon.Error, True) + UpdateLog(oRestoreInfo.Name & " restore was cancelled due to a restore path issue.", False, ToolTipIcon.Error, True) End If Next @@ -309,13 +309,21 @@ Public Class frmMain Private Sub CheckRestore() Dim slRestoreData As SortedList = mgrRestore.CompareManifests() + Dim sNotification As String If slRestoreData.Count > 0 Then + If slRestoreData.Count > 1 Then + sNotification = slRestoreData.Count & " Games Pending Restore" + Else + sNotification = slRestoreData.Count & " Game Pending Restore" + End If gMonNotification.Image = My.Resources.Inbox - gMonNotification.Text = slRestoreData.Count & " pending restore(s)" + gMonTrayNotification.Image = My.Resources.Inbox + gMonNotification.Text = sNotification + gMonTrayNotification.Text = sNotification gMonNotification.Visible = True + gMonTrayNotification.Visible = True End If - End Sub 'Functions to handle monitor list features @@ -1294,8 +1302,9 @@ Public Class frmMain OpenCheckforUpdates() End Sub - Private Sub gMonNotification_Click(sender As Object, e As EventArgs) Handles gMonNotification.Click + Private Sub gMonNotification_Click(sender As Object, e As EventArgs) Handles gMonNotification.Click, gMonTrayNotification.Click gMonNotification.Visible = False + gMonTrayNotification.Visible = False OpenGameManager(True) End Sub diff --git a/GBM/Game Backup Monitor.vbproj b/GBM/Game Backup Monitor.vbproj index c76df06..2337c69 100644 --- a/GBM/Game Backup Monitor.vbproj +++ b/GBM/Game Backup Monitor.vbproj @@ -273,9 +273,9 @@ VbMyResourcesResXFileCodeGenerator - Resources.Designer.vb My.Resources Designer + Resources.Designer.vb @@ -329,9 +329,7 @@ - - PreserveNewest diff --git a/GBM/Managers/mgrRestore.vb b/GBM/Managers/mgrRestore.vb index f9219f8..371cdfe 100644 --- a/GBM/Managers/mgrRestore.vb +++ b/GBM/Managers/mgrRestore.vb @@ -27,11 +27,37 @@ Public Class mgrRestore Public Event UpdateRestoreInfo(oRestoreInfo As clsBackup) Public Event SetLastAction(sMessage As String) + Private Shared Function CheckForPathOverride(ByRef oCheckBackup As clsBackup, ByVal oCheckGame As clsGame) As Boolean + Dim oResult As MsgBoxResult + + If oCheckBackup.RestorePath <> oCheckGame.Path Then + oResult = MsgBox("The restore path for " & oCheckBackup.CroppedName & " does not match it's current save path." & vbCrLf & vbCrLf & _ + "Do you want to restore to the current save path instead? (Recommended)", MsgBoxStyle.YesNoCancel, "Game Backup Monitor") + If oResult = MsgBoxResult.Yes Then + If Path.IsPathRooted(oCheckGame.Path) Then + oCheckBackup.AbsolutePath = True + oCheckBackup.RestorePath = oCheckGame.Path + Else + oCheckBackup.RestorePath = oCheckGame.Path + End If + ElseIf oResult = MsgBoxResult.Cancel Then + Return False + End If + End If + + Return True + End Function + 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 + 'Before we do anything check if we need to override the current path + If Not CheckForPathOverride(oRestoreInfo, oGame) Then + Return False + End If + If Not oRestoreInfo.AbsolutePath Then If oGame.ProcessPath <> String.Empty Then oRestoreInfo.RelativeRestorePath = oGame.ProcessPath & "\" & oRestoreInfo.RestorePath diff --git a/GBM/My Project/Resources.Designer.vb b/GBM/My Project/Resources.Designer.vb index b74b4cb..85e6f7c 100644 --- a/GBM/My Project/Resources.Designer.vb +++ b/GBM/My Project/Resources.Designer.vb @@ -120,16 +120,6 @@ Namespace My.Resources End Get End Property - ''' - ''' Looks up a localized resource of type System.Drawing.Bitmap. - ''' - Friend ReadOnly Property Lock() As System.Drawing.Bitmap - Get - Dim obj As Object = ResourceManager.GetObject("Lock", resourceCulture) - Return CType(obj,System.Drawing.Bitmap) - End Get - End Property - ''' ''' Looks up a localized resource of type System.Drawing.Bitmap. ''' @@ -170,16 +160,6 @@ Namespace My.Resources End Get End Property - ''' - ''' Looks up a localized resource of type System.Drawing.Bitmap. - ''' - Friend ReadOnly Property Unlock() As System.Drawing.Bitmap - Get - Dim obj As Object = ResourceManager.GetObject("Unlock", 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 b3e63b7..0798347 100644 --- a/GBM/My Project/Resources.resx +++ b/GBM/My Project/Resources.resx @@ -136,9 +136,6 @@ ..\Resources\Inbox.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\Lock.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\Ready.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -151,9 +148,6 @@ ..\Resources\Unknown.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\Unlock.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\User.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a diff --git a/GBM/Resources/Lock.png b/GBM/Resources/Lock.png deleted file mode 100644 index d106f545abf12e42930a9945fc0bb4d93c5fee41..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 630 zcmV-+0*U>JP)?vm3wyV>d%HV3W3hMS;7%)E_0OBh_ul_z2H5TRH1~N+ zPtVMrnx2_G(QdC1)VvrQpTOe6B4r0I4R&>QPHLP(DTy!);|+UrXyxaRsgz-;q3hS$ z1L{??`!bogj^oU8jo&2#gb>dSW6x20!y34p&Aw|s&vyc9K`>g*<$e!dz0%*5J~s9G z&1xi~Q2_r3VAR>$m--2nHPe6FO^Lz`SR5T$(=mWs*k>RcUT4B}a zx{iMWo_$@&^d0EE@n`NMI`;QnoLsrrrKDs4K#WOidFfoWSitzN^*e<%bL{?^Bb(cX z`1srM@$T-P@9B=cN=ZpdNf0prKtmH_DyVv7S*89*rw`9>>!9QW$|Ya1il7GB{PF<+ z(0ld*RQ=Xu6e+(Psum0Djt>J>FrN67K@CgqClY<=Bv{%=v=FE{KH36O%7CUtNhyuP z7KsHrU{Ib10ElCOu;R4>EXM0t!h) zK~y-)t&%%z6G0G$|J{3-*w~I_ps+)UL`6E>#!X=PVVgU-uZmHw-k3Wu{kLeOt=5eeEZML0x|Kv`r)56 z08l3dp9^TJg17IsW@ie8MF67FY(6vNw)nV+;fio}+Bgwhg1c1xs@zkC);(>rprvo84pVV8;#!IRw_M|?V!L1inC0Uxwwko%GNh-aXp1-saIPA{@3Jsv@ zfn*HScWd{~6~!1}{nPhT`J+cZr!vzr;G6_PfRON7N*QHIc%FwwduR6M=@VbZT4>o^ z_EcXgwiQ+pfcs%X)IDOffS0N8Z_u&^i)KD?e21F&3ZA^{pXKp5TSwqzsht00000NkvXXu0mjf2a^;F