Added "Open Backup Folder" to Game Manager

This commit is contained in:
MikeMaximus
2019-04-07 14:16:47 -06:00
parent 076295069e
commit 7062f4b4ea
6 changed files with 141 additions and 60 deletions
+36 -10
View File
@@ -81,7 +81,7 @@ Partial Class frmGameManager
Me.lblLocalBackupData = New System.Windows.Forms.Label()
Me.lblRestorePath = New System.Windows.Forms.Label()
Me.btnOpenRestorePath = New System.Windows.Forms.Button()
Me.btnOpenBackupFile = New System.Windows.Forms.Button()
Me.btnOpenBackup = New System.Windows.Forms.Button()
Me.btnDeleteBackup = New System.Windows.Forms.Button()
Me.lblBackupFile = New System.Windows.Forms.Label()
Me.lblRemote = New System.Windows.Forms.Label()
@@ -111,6 +111,9 @@ Partial Class frmGameManager
Me.cmsDeleteAll = New System.Windows.Forms.ToolStripMenuItem()
Me.btnProcesses = New System.Windows.Forms.Button()
Me.ttFullPath = New System.Windows.Forms.ToolTip(Me.components)
Me.cmsOpenBackup = New System.Windows.Forms.ContextMenuStrip(Me.components)
Me.cmsOpenBackupFile = New System.Windows.Forms.ToolStripMenuItem()
Me.cmsOpenBackupFolder = New System.Windows.Forms.ToolStripMenuItem()
Me.grpConfig.SuspendLayout()
CType(Me.nudLimit, System.ComponentModel.ISupportInitialize).BeginInit()
Me.grpExtra.SuspendLayout()
@@ -120,6 +123,7 @@ Partial Class frmGameManager
Me.grpFilter.SuspendLayout()
Me.cmsImport.SuspendLayout()
Me.cmsDeleteBackup.SuspendLayout()
Me.cmsOpenBackup.SuspendLayout()
Me.SuspendLayout()
'
'btnAdd
@@ -629,7 +633,7 @@ Partial Class frmGameManager
Me.grpStats.Controls.Add(Me.lblLocalBackupData)
Me.grpStats.Controls.Add(Me.lblRestorePath)
Me.grpStats.Controls.Add(Me.btnOpenRestorePath)
Me.grpStats.Controls.Add(Me.btnOpenBackupFile)
Me.grpStats.Controls.Add(Me.btnOpenBackup)
Me.grpStats.Controls.Add(Me.btnDeleteBackup)
Me.grpStats.Controls.Add(Me.lblBackupFile)
Me.grpStats.Controls.Add(Me.lblRemote)
@@ -711,14 +715,14 @@ Partial Class frmGameManager
Me.btnOpenRestorePath.Text = "O&pen Restore Path"
Me.btnOpenRestorePath.UseVisualStyleBackColor = True
'
'btnOpenBackupFile
'btnOpenBackup
'
Me.btnOpenBackupFile.Location = New System.Drawing.Point(249, 125)
Me.btnOpenBackupFile.Name = "btnOpenBackupFile"
Me.btnOpenBackupFile.Size = New System.Drawing.Size(114, 23)
Me.btnOpenBackupFile.TabIndex = 10
Me.btnOpenBackupFile.Text = "&Open Backup File"
Me.btnOpenBackupFile.UseVisualStyleBackColor = True
Me.btnOpenBackup.Location = New System.Drawing.Point(249, 125)
Me.btnOpenBackup.Name = "btnOpenBackup"
Me.btnOpenBackup.Size = New System.Drawing.Size(114, 23)
Me.btnOpenBackup.TabIndex = 10
Me.btnOpenBackup.Text = "&Open Backup"
Me.btnOpenBackup.UseVisualStyleBackColor = True
'
'btnDeleteBackup
'
@@ -972,6 +976,24 @@ Partial Class frmGameManager
Me.ttFullPath.InitialDelay = 300
Me.ttFullPath.ReshowDelay = 60
'
'cmsOpenBackup
'
Me.cmsOpenBackup.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.cmsOpenBackupFile, Me.cmsOpenBackupFolder})
Me.cmsOpenBackup.Name = "cmsOpenBackup"
Me.cmsOpenBackup.Size = New System.Drawing.Size(108, 48)
'
'cmsOpenBackupFile
'
Me.cmsOpenBackupFile.Name = "cmsOpenBackupFile"
Me.cmsOpenBackupFile.Size = New System.Drawing.Size(107, 22)
Me.cmsOpenBackupFile.Text = "&File"
'
'cmsOpenBackupFolder
'
Me.cmsOpenBackupFolder.Name = "cmsOpenBackupFolder"
Me.cmsOpenBackupFolder.Size = New System.Drawing.Size(107, 22)
Me.cmsOpenBackupFolder.Text = "F&older"
'
'frmGameManager
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
@@ -1017,6 +1039,7 @@ Partial Class frmGameManager
Me.grpFilter.PerformLayout()
Me.cmsImport.ResumeLayout(False)
Me.cmsDeleteBackup.ResumeLayout(False)
Me.cmsOpenBackup.ResumeLayout(False)
Me.ResumeLayout(False)
Me.PerformLayout()
@@ -1065,7 +1088,7 @@ Partial Class frmGameManager
Friend WithEvents btnMarkAsRestored As System.Windows.Forms.Button
Friend WithEvents btnRestore As System.Windows.Forms.Button
Friend WithEvents btnDeleteBackup As System.Windows.Forms.Button
Friend WithEvents btnOpenBackupFile As System.Windows.Forms.Button
Friend WithEvents btnOpenBackup As System.Windows.Forms.Button
Friend WithEvents grpFilter As System.Windows.Forms.GroupBox
Friend WithEvents optPendingRestores As System.Windows.Forms.RadioButton
Friend WithEvents optAllGames As System.Windows.Forms.RadioButton
@@ -1109,4 +1132,7 @@ Partial Class frmGameManager
Friend WithEvents lblOS As Label
Friend WithEvents cboOS As ComboBox
Friend WithEvents btnWineConfig As Button
Friend WithEvents cmsOpenBackup As ContextMenuStrip
Friend WithEvents cmsOpenBackupFile As ToolStripMenuItem
Friend WithEvents cmsOpenBackupFolder As ToolStripMenuItem
End Class
+3
View File
@@ -126,4 +126,7 @@
<metadata name="ttFullPath.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>275, 17</value>
</metadata>
<metadata name="cmsOpenBackup.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>378, 17</value>
</metadata>
</root>
+30 -42
View File
@@ -535,24 +535,15 @@ Public Class frmGameManager
End Sub
Private Sub OpenBackupFile()
Dim sFileName As String
Dim oProcessStartInfo As ProcessStartInfo
Dim sFileName As String = BackupFolder & CurrentBackupItem.FileName
sFileName = BackupFolder & CurrentBackupItem.FileName
mgrCommon.OpenInOS(sFileName, frmGameManager_ErrorNoBackupFileExists)
End Sub
If File.Exists(sFileName) Then
Try
oProcessStartInfo = New ProcessStartInfo
oProcessStartInfo.FileName = sFileName
oProcessStartInfo.UseShellExecute = True
oProcessStartInfo.Verb = "open"
Process.Start(oProcessStartInfo)
Catch ex As Exception
mgrCommon.ShowMessage(App_ErrorLaunchExternal, ex.Message, MsgBoxStyle.Exclamation)
End Try
Else
mgrCommon.ShowMessage(frmGameManager_ErrorNoBackupExists, MsgBoxStyle.Exclamation)
End If
Private Sub OpenBackupFolder()
Dim sFileName As String = BackupFolder & Path.GetDirectoryName(CurrentBackupItem.FileName)
mgrCommon.OpenInOS(sFileName, frmGameManager_ErrorNoBackupFolderExists)
End Sub
Private Sub UpdateBuilderButtonLabel(ByVal sBuilderString As String, ByVal sLabel As String, ByVal btn As Button, ByVal bDirty As Boolean)
@@ -642,7 +633,6 @@ Public Class frmGameManager
Private Sub OpenRestorePath()
Dim sPath As String = String.Empty
Dim oProcessStartInfo As ProcessStartInfo
If CurrentBackupItem.AbsolutePath Then
sPath = CurrentBackupItem.RestorePath
@@ -652,19 +642,7 @@ Public Class frmGameManager
End If
End If
If Directory.Exists(sPath) Then
Try
oProcessStartInfo = New ProcessStartInfo
oProcessStartInfo.FileName = sPath
oProcessStartInfo.UseShellExecute = True
oProcessStartInfo.Verb = "open"
Process.Start(oProcessStartInfo)
Catch ex As Exception
mgrCommon.ShowMessage(App_ErrorLaunchExternal, ex.Message, MsgBoxStyle.Exclamation)
End Try
Else
mgrCommon.ShowMessage(frmGameManager_ErrorNoRestorePathExists, MsgBoxStyle.Exclamation)
End If
mgrCommon.OpenInOS(sPath, frmGameManager_ErrorNoRestorePathExists)
End Sub
Private Sub OpenProcesses()
@@ -822,7 +800,7 @@ Public Class frmGameManager
sFileName = BackupFolder & CurrentBackupItem.FileName
btnOpenBackupFile.Enabled = True
btnOpenBackup.Enabled = True
btnOpenRestorePath.Enabled = True
btnRestore.Enabled = True
btnDeleteBackup.Enabled = True
@@ -830,7 +808,7 @@ Public Class frmGameManager
If File.Exists(sFileName) Then
lblBackupFileData.Text = Path.GetFileName(CurrentBackupItem.FileName) & " (" & mgrCommon.FormatDiskSpace(mgrCommon.GetFileSize(sFileName)) & ")"
Else
lblBackupFileData.Text = frmGameManager_ErrorNoBackupExists
lblBackupFileData.Text = frmGameManager_ErrorNoBackupFileExists
End If
SetBackupRestorePath(oApp)
@@ -838,7 +816,7 @@ Public Class frmGameManager
oComboItems.Add(New KeyValuePair(Of String, String)(String.Empty, frmGameManager_None))
lblBackupFileData.Text = String.Empty
lblRestorePathData.Text = String.Empty
btnOpenBackupFile.Enabled = False
btnOpenBackup.Enabled = False
btnOpenRestorePath.Enabled = False
btnRestore.Enabled = False
btnDeleteBackup.Enabled = False
@@ -876,7 +854,7 @@ Public Class frmGameManager
If mgrPath.IsSupportedRegistryPath(oApp.TruePath) Then
btnImportBackup.Enabled = False
btnOpenBackupFile.Enabled = False
btnOpenBackup.Enabled = False
btnOpenRestorePath.Enabled = False
End If
@@ -893,7 +871,7 @@ Public Class frmGameManager
If File.Exists(sFileName) Then
lblBackupFileData.Text = Path.GetFileName(CurrentBackupItem.FileName) & " (" & mgrCommon.FormatDiskSpace(mgrCommon.GetFileSize(sFileName)) & ")"
Else
lblBackupFileData.Text = frmGameManager_ErrorNoBackupExists
lblBackupFileData.Text = frmGameManager_ErrorNoBackupFileExists
End If
SetBackupRestorePath(CurrentGame)
@@ -1081,7 +1059,7 @@ Public Class frmGameManager
btnRestore.Enabled = False
btnImportBackup.Enabled = False
btnDeleteBackup.Enabled = False
btnOpenBackupFile.Enabled = False
btnOpenBackup.Enabled = False
btnOpenRestorePath.Enabled = False
chkEnabled.Checked = True
chkMonitorOnly.Checked = False
@@ -1115,7 +1093,7 @@ Public Class frmGameManager
btnRestore.Enabled = False
btnImportBackup.Enabled = False
btnDeleteBackup.Enabled = False
btnOpenBackupFile.Enabled = False
btnOpenBackup.Enabled = False
btnOpenRestorePath.Enabled = False
btnTags.Enabled = True
btnProcesses.Enabled = True
@@ -1818,7 +1796,7 @@ Public Class frmGameManager
btnSave.Text = frmGameManager_btnSave
lblRestorePath.Text = frmGameManager_lblRestorePath
btnOpenRestorePath.Text = frmGameManager_btnOpenRestorePath
btnOpenBackupFile.Text = frmGameManager_btnOpenBackupFile
btnOpenBackup.Text = frmGameManager_btnOpenBackup
btnDeleteBackup.Text = frmGameManager_btnDeleteBackup
lblBackupFile.Text = frmGameManager_lblBackupFile
lblRemote.Text = frmGameManager_lblRemote
@@ -1860,6 +1838,8 @@ Public Class frmGameManager
btnProcesses.Text = frmGameManager_btnProcesses
lblOS.Text = frmGameManager_lblOS
btnWineConfig.Text = frmGameManager_btnWineConfig
cmsOpenBackupFile.Text = frmGameManager_cmsOpenBackupFile
cmsOpenBackupFolder.Text = frmGameManager_cmsOpenBackupFolder
'Init Combos
Dim oComboItems As New List(Of KeyValuePair(Of Integer, String))
@@ -1902,7 +1882,7 @@ Public Class frmGameManager
btnRestore.Visible = False
btnMarkAsRestored.Visible = False
btnDeleteBackup.Visible = False
btnOpenBackupFile.Visible = False
btnOpenBackup.Visible = False
btnOpenRestorePath.Visible = False
End If
@@ -1984,10 +1964,18 @@ Public Class frmGameManager
IconBrowse()
End Sub
Private Sub btnOpenBackupFile_Click(sender As Object, e As EventArgs) Handles btnOpenBackupFile.Click
Private Sub btnOpenBackup_Click(sender As Object, e As EventArgs) Handles btnOpenBackup.Click
mgrCommon.OpenButtonSubMenu(cmsOpenBackup, btnOpenBackup)
End Sub
Private Sub cmsOpenBackupFile_Click(sender As Object, e As EventArgs) Handles cmsOpenBackupFile.Click
OpenBackupFile()
End Sub
Private Sub cmsOpenBackupFolder_Click(sender As Object, e As EventArgs) Handles cmsOpenBackupFolder.Click
OpenBackupFolder()
End Sub
Private Sub btnOpenRestorePath_Click(sender As Object, e As EventArgs) Handles btnOpenRestorePath.Click
OpenRestorePath()
End Sub
@@ -2006,7 +1994,7 @@ Public Class frmGameManager
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)
mgrCommon.OpenButtonSubMenu(cmsDeleteBackup, btnDeleteBackup)
Else
DeleteBackup()
End If
@@ -2076,7 +2064,7 @@ Public Class frmGameManager
End Sub
Private Sub btnImport_Click(sender As Object, e As EventArgs) Handles btnImport.Click
cmsImport.Show(btnImport, New Drawing.Point(btnImport.Size.Width - Math.Floor(btnImport.Size.Width * 0.1), btnImport.Size.Height - Math.Floor(btnImport.Size.Height * 0.5)), ToolStripDropDownDirection.AboveRight)
mgrCommon.OpenButtonSubMenu(cmsImport, btnImport)
End Sub
Private Sub cmsOfficialWindows_Click(sender As Object, e As EventArgs) Handles cmsOfficialWindows.Click, cmsOfficial.Click
+28
View File
@@ -529,6 +529,29 @@ Public Class mgrCommon
End If
End Sub
'Opens a file or folder in default application determined by the OS
Public Shared Function OpenInOS(ByVal sFileName As String, ByVal sNotFoundError As String) As Boolean
Dim oProcessStartInfo As ProcessStartInfo
If File.Exists(sFileName) Or Directory.Exists(sFileName) Then
Try
oProcessStartInfo = New ProcessStartInfo
oProcessStartInfo.FileName = sFileName
oProcessStartInfo.UseShellExecute = True
oProcessStartInfo.Verb = "open"
Process.Start(oProcessStartInfo)
Catch ex As Exception
mgrCommon.ShowMessage(App_ErrorLaunchExternal, ex.Message, MsgBoxStyle.Exclamation)
Return False
End Try
Else
mgrCommon.ShowMessage(sNotFoundError, MsgBoxStyle.Exclamation)
Return False
End If
Return True
End Function
'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
@@ -569,6 +592,11 @@ Public Class mgrCommon
End Try
End Sub
'Open a nice button sub-menu
Public Shared Sub OpenButtonSubMenu(ByRef cms As ContextMenuStrip, ByRef btn As Button)
cms.Show(btn, New Drawing.Point(btn.Size.Width - Math.Floor(btn.Size.Width * 0.1), btn.Size.Height - Math.Floor(btn.Size.Height * 0.5)), ToolStripDropDownDirection.AboveRight)
End Sub
'Configure a fake form to trigger focus for priority messages
Private Shared Sub ConfigureFakeForm(ByRef frm As Form)
frm.FormBorderStyle = FormBorderStyle.None
+32 -5
View File
@@ -1654,11 +1654,11 @@ Namespace My.Resources
End Property
'''<summary>
''' Looks up a localized string similar to &amp;Open Backup File.
''' Looks up a localized string similar to &amp;Open Backup.
'''</summary>
Friend ReadOnly Property frmGameManager_btnOpenBackupFile() As String
Friend ReadOnly Property frmGameManager_btnOpenBackup() As String
Get
Return ResourceManager.GetString("frmGameManager_btnOpenBackupFile", resourceCulture)
Return ResourceManager.GetString("frmGameManager_btnOpenBackup", resourceCulture)
End Get
End Property
@@ -1905,6 +1905,24 @@ Namespace My.Resources
End Get
End Property
'''<summary>
''' Looks up a localized string similar to &amp;File.
'''</summary>
Friend ReadOnly Property frmGameManager_cmsOpenBackupFile() As String
Get
Return ResourceManager.GetString("frmGameManager_cmsOpenBackupFile", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to F&amp;older.
'''</summary>
Friend ReadOnly Property frmGameManager_cmsOpenBackupFolder() As String
Get
Return ResourceManager.GetString("frmGameManager_cmsOpenBackupFolder", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Are you sure you want to run a backup for [PARAM]? This will close the form..
'''</summary>
@@ -2106,9 +2124,18 @@ Namespace My.Resources
'''<summary>
''' Looks up a localized string similar to The backup file does not exist..
'''</summary>
Friend ReadOnly Property frmGameManager_ErrorNoBackupExists() As String
Friend ReadOnly Property frmGameManager_ErrorNoBackupFileExists() As String
Get
Return ResourceManager.GetString("frmGameManager_ErrorNoBackupExists", resourceCulture)
Return ResourceManager.GetString("frmGameManager_ErrorNoBackupFileExists", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to The backup folder does not exist..
'''</summary>
Friend ReadOnly Property frmGameManager_ErrorNoBackupFolderExists() As String
Get
Return ResourceManager.GetString("frmGameManager_ErrorNoBackupFolderExists", resourceCulture)
End Get
End Property
+12 -3
View File
@@ -460,8 +460,8 @@
<data name="frmGameManager_btnMarkAsRestored" xml:space="preserve">
<value>&amp;Mark as Restored</value>
</data>
<data name="frmGameManager_btnOpenBackupFile" xml:space="preserve">
<value>&amp;Open Backup File</value>
<data name="frmGameManager_btnOpenBackup" xml:space="preserve">
<value>&amp;Open Backup</value>
</data>
<data name="frmGameManager_btnOpenRestorePath" xml:space="preserve">
<value>O&amp;pen Restore Path</value>
@@ -553,7 +553,7 @@
<data name="frmGameManager_ErrorNoBackupData" xml:space="preserve">
<value>The selected game(s) have no backup data or can't be restored with their current configuration.</value>
</data>
<data name="frmGameManager_ErrorNoBackupExists" xml:space="preserve">
<data name="frmGameManager_ErrorNoBackupFileExists" xml:space="preserve">
<value>The backup file does not exist.</value>
</data>
<data name="frmGameManager_ErrorNoItems" xml:space="preserve">
@@ -2380,4 +2380,13 @@
<data name="GBM_Icon" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\resources\gbm.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="frmGameManager_cmsOpenBackupFile" xml:space="preserve">
<value>&amp;File</value>
</data>
<data name="frmGameManager_cmsOpenBackupFolder" xml:space="preserve">
<value>F&amp;older</value>
</data>
<data name="frmGameManager_ErrorNoBackupFolderExists" xml:space="preserve">
<value>The backup folder does not exist.</value>
</data>
</root>