From cb49434a469a04a8fda9240f84e0813c0552915b Mon Sep 17 00:00:00 2001 From: MikeMaximus Date: Fri, 28 Sep 2018 10:34:48 -0600 Subject: [PATCH] Allow importing official Windows configurations in Linux for #148 --- GBM/Forms/frmGameManager.Designer.vb | 17 ++++++++++++ GBM/Forms/frmGameManager.vb | 40 +++++++++++++++++++--------- GBM/Managers/mgrSettings.vb | 1 + GBM/My Project/Resources.Designer.vb | 27 +++++++++++++++++++ GBM/My Project/Resources.resx | 9 +++++++ 5 files changed, 82 insertions(+), 12 deletions(-) diff --git a/GBM/Forms/frmGameManager.Designer.vb b/GBM/Forms/frmGameManager.Designer.vb index 8bdc418..2b5f370 100644 --- a/GBM/Forms/frmGameManager.Designer.vb +++ b/GBM/Forms/frmGameManager.Designer.vb @@ -97,6 +97,8 @@ Partial Class frmGameManager Me.btnExport = New System.Windows.Forms.Button() Me.cmsImport = New System.Windows.Forms.ContextMenuStrip(Me.components) Me.cmsOfficial = New System.Windows.Forms.ToolStripMenuItem() + Me.cmsOfficialWindows = New System.Windows.Forms.ToolStripMenuItem() + Me.cmsOfficialLinux = New System.Windows.Forms.ToolStripMenuItem() Me.cmsFile = New System.Windows.Forms.ToolStripMenuItem() Me.txtQuickFilter = New System.Windows.Forms.TextBox() Me.lblQuickFilter = New System.Windows.Forms.Label() @@ -850,10 +852,23 @@ Partial Class frmGameManager ' 'cmsOfficial ' + Me.cmsOfficial.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.cmsOfficialWindows, Me.cmsOfficialLinux}) Me.cmsOfficial.Name = "cmsOfficial" Me.cmsOfficial.Size = New System.Drawing.Size(117, 22) Me.cmsOfficial.Text = "&Official List..." ' + 'cmsOfficialWindows + ' + Me.cmsOfficialWindows.Name = "cmsOfficialWindows" + Me.cmsOfficialWindows.Size = New System.Drawing.Size(180, 22) + Me.cmsOfficialWindows.Text = "&Windows..." + ' + 'cmsOfficialLinux + ' + Me.cmsOfficialLinux.Name = "cmsOfficialLinux" + Me.cmsOfficialLinux.Size = New System.Drawing.Size(180, 22) + Me.cmsOfficialLinux.Text = "&Linux..." + ' 'cmsFile ' Me.cmsFile.Name = "cmsFile" @@ -1042,4 +1057,6 @@ Partial Class frmGameManager Friend WithEvents btnProcesses As Button Friend WithEvents ttFullPath As ToolTip Friend WithEvents btnImportBackup As Button + Friend WithEvents cmsOfficialWindows As ToolStripMenuItem + Friend WithEvents cmsOfficialLinux As ToolStripMenuItem End Class diff --git a/GBM/Forms/frmGameManager.vb b/GBM/Forms/frmGameManager.vb index 59d59bd..913ca68 100644 --- a/GBM/Forms/frmGameManager.vb +++ b/GBM/Forms/frmGameManager.vb @@ -1704,17 +1704,9 @@ Public Class frmGameManager End Sub - Private Sub ImportOfficialGameList() - Dim sImportURL As String - - If mgrCommon.IsUnix Then - sImportURL = App_URLImportLinux - Else - sImportURL = App_URLImport - End If - + Private Sub ImportOfficialGameList(ByVal sImportUrl As String) If mgrCommon.ShowMessage(frmGameManager_ConfirmOfficialImport, MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then - If mgrMonitorList.DoImport(sImportURL, True, Settings) Then + If mgrMonitorList.DoImport(sImportUrl, True, Settings) Then mgrMonitorList.SyncMonitorLists(Settings) LoadData() LoadBackupData() @@ -1774,6 +1766,8 @@ Public Class frmGameManager btnDelete.Text = frmGameManager_btnDelete btnAdd.Text = frmGameManager_btnAdd cmsOfficial.Text = frmGameManager_cmsOfficial + cmsOfficialLinux.Text = frmGameManager_cmsOfficialLinux + cmsOfficialWindows.Text = frmGameManager_cmsOfficialWindows cmsFile.Text = frmGameManager_cmsFile lblQuickFilter.Text = frmGameManager_lblQuickFilter lblLimit.Text = frmGameManager_lblLimit @@ -1785,6 +1779,15 @@ Public Class frmGameManager btnImportBackup.Text = frmGameManager_btnImportBackup btnProcesses.Text = frmGameManager_btnProcesses + 'Init Official Import Menu + If mgrCommon.IsUnix Then + cmsOfficial.Text = cmsOfficial.Text.TrimEnd(".") + RemoveHandler cmsOfficial.Click, AddressOf cmsOfficialWindows_Click + Else + cmsOfficialLinux.Visible = False + cmsOfficialWindows.Visible = False + End If + 'Init Filter Timer tmFilterTimer = New Timer() tmFilterTimer.Interval = 1000 @@ -1967,8 +1970,21 @@ Public Class frmGameManager 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) End Sub - Private Sub cmsOfficial_Click(sender As Object, e As EventArgs) Handles cmsOfficial.Click - ImportOfficialGameList() + Private Sub cmsOfficialWindows_Click(sender As Object, e As EventArgs) Handles cmsOfficialWindows.Click, cmsOfficial.Click + 'Show one time warning about Windows configs in Linux + If mgrCommon.IsUnix Then + If Not (oSettings.SuppressMessages And mgrSettings.eSuppressMessages.WinConfigsInLinux) = mgrSettings.eSuppressMessages.WinConfigsInLinux Then + mgrCommon.ShowMessage(frmGameManager_WarningWinConfigsInLinux, MsgBoxStyle.Information) + oSettings.SuppressMessages = oSettings.SetMessageField(oSettings.SuppressMessages, mgrSettings.eSuppressMessages.WinConfigsInLinux) + oSettings.SaveSettings() + End If + End If + + ImportOfficialGameList(App_URLImport) + End Sub + + Private Sub cmsOfficialLinux_Click(sender As Object, e As EventArgs) Handles cmsOfficialLinux.Click + ImportOfficialGameList(App_URLImportLinux) End Sub Private Sub cmsFile_Click(sender As Object, e As EventArgs) Handles cmsFile.Click diff --git a/GBM/Managers/mgrSettings.vb b/GBM/Managers/mgrSettings.vb index 2366a4d..a11ec1a 100644 --- a/GBM/Managers/mgrSettings.vb +++ b/GBM/Managers/mgrSettings.vb @@ -31,6 +31,7 @@ Public Class mgrSettings None = 0 GameIDSync = 1 BackupImport = 2 + WinConfigsInLinux = 4 End Enum Property StartWithWindows As Boolean diff --git a/GBM/My Project/Resources.Designer.vb b/GBM/My Project/Resources.Designer.vb index f08f3bb..5a8ea62 100644 --- a/GBM/My Project/Resources.Designer.vb +++ b/GBM/My Project/Resources.Designer.vb @@ -1815,6 +1815,24 @@ Namespace My.Resources End Get End Property + ''' + ''' Looks up a localized string similar to &Linux.... + ''' + Friend ReadOnly Property frmGameManager_cmsOfficialLinux() As String + Get + Return ResourceManager.GetString("frmGameManager_cmsOfficialLinux", resourceCulture) + End Get + End Property + + ''' + ''' Looks up a localized string similar to &Windows.... + ''' + Friend ReadOnly Property frmGameManager_cmsOfficialWindows() As String + Get + Return ResourceManager.GetString("frmGameManager_cmsOfficialWindows", resourceCulture) + End Get + End Property + ''' ''' Looks up a localized string similar to Are you sure you want to run a backup for [PARAM]? This will close the form.. ''' @@ -2463,6 +2481,15 @@ Namespace My.Resources End Get End Property + ''' + ''' Looks up a localized string similar to Official Windows configurations can be used in Linux for games running in Wine or Proton.[BR][BR]You do not need to modify these configurations, GBM will automatically do any required path conversions the first time the game is detected.[BR][BR]This message will only be shown once.. + ''' + Friend ReadOnly Property frmGameManager_WarningWinConfigsInLinux() As String + Get + Return ResourceManager.GetString("frmGameManager_WarningWinConfigsInLinux", resourceCulture) + End Get + End Property + ''' ''' Looks up a localized string similar to XML. ''' diff --git a/GBM/My Project/Resources.resx b/GBM/My Project/Resources.resx index 476214d..2b1fd1d 100644 --- a/GBM/My Project/Resources.resx +++ b/GBM/My Project/Resources.resx @@ -2257,4 +2257,13 @@ The "Save multiple backups" option must be enabled on this configuration to import backup files. + + &Linux... + + + &Windows... + + + Official Windows configurations can be used in Linux for games running in Wine or Proton.[BR][BR]You do not need to modify these configurations, GBM will automatically do any required path conversions the first time the game is detected.[BR][BR]This message will only be shown once. + \ No newline at end of file