Import tag mods for #148
This commit is contained in:
@@ -6,6 +6,7 @@ Public Class frmAdvancedImport
|
|||||||
Private oImportData As ExportData
|
Private oImportData As ExportData
|
||||||
Private hshImportData As Hashtable
|
Private hshImportData As Hashtable
|
||||||
Private hshFinalData As New Hashtable
|
Private hshFinalData As New Hashtable
|
||||||
|
Private bModWinConfigsForLinux As Boolean
|
||||||
Private bSelectAll As Boolean = True
|
Private bSelectAll As Boolean = True
|
||||||
Private bIsLoading As Boolean = False
|
Private bIsLoading As Boolean = False
|
||||||
Private iCurrentSort As Integer = 0
|
Private iCurrentSort As Integer = 0
|
||||||
@@ -30,12 +31,23 @@ Public Class frmAdvancedImport
|
|||||||
End Get
|
End Get
|
||||||
End Property
|
End Property
|
||||||
|
|
||||||
|
Public Property ModWinConfigsForLinux As Boolean
|
||||||
|
Set(value As Boolean)
|
||||||
|
bModWinConfigsForLinux = value
|
||||||
|
End Set
|
||||||
|
Get
|
||||||
|
Return bModWinConfigsForLinux
|
||||||
|
End Get
|
||||||
|
End Property
|
||||||
|
|
||||||
Public ReadOnly Property FinalData As Hashtable
|
Public ReadOnly Property FinalData As Hashtable
|
||||||
Get
|
Get
|
||||||
Return hshFinalData
|
Return hshFinalData
|
||||||
End Get
|
End Get
|
||||||
End Property
|
End Property
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Private Sub SelectToggle()
|
Private Sub SelectToggle()
|
||||||
Cursor.Current = Cursors.WaitCursor
|
Cursor.Current = Cursors.WaitCursor
|
||||||
lstGames.BeginUpdate()
|
lstGames.BeginUpdate()
|
||||||
@@ -56,6 +68,62 @@ Public Class frmAdvancedImport
|
|||||||
End If
|
End If
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
Private Sub ModTags(ByRef oTags As List(Of Tag))
|
||||||
|
Dim bExists As Boolean
|
||||||
|
Dim oTag As Tag
|
||||||
|
Dim oNewTag As Tag
|
||||||
|
Dim oRemoveTag As New Tag
|
||||||
|
Dim sTag As String
|
||||||
|
Dim sAddTags() As String = {"Wine"}
|
||||||
|
Dim sRemoveTags() As String = {"Official"}
|
||||||
|
|
||||||
|
For Each sTag In sAddTags
|
||||||
|
bExists = False
|
||||||
|
For Each oTag In oTags
|
||||||
|
If oTag.Name = sTag Then
|
||||||
|
bExists = True
|
||||||
|
Exit For
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
If Not bExists Then
|
||||||
|
oNewTag = New Tag
|
||||||
|
oNewTag.Name = sTag
|
||||||
|
oTags.Add(oNewTag)
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
|
||||||
|
For Each sTag In sRemoveTags
|
||||||
|
bExists = False
|
||||||
|
For Each oTag In oTags
|
||||||
|
If oTag.Name = sTag Then
|
||||||
|
bExists = True
|
||||||
|
oRemoveTag = oTag
|
||||||
|
Exit For
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
If bExists Then
|
||||||
|
oTags.Remove(oRemoveTag)
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Private Function CheckIgnoreTags(ByVal oTags As List(Of Tag)) As Boolean
|
||||||
|
Dim oTag As Tag
|
||||||
|
Dim sTag As String
|
||||||
|
Dim sIgnoreTags() As String = {"DOSBox", "ScummVM"}
|
||||||
|
|
||||||
|
For Each oTag In oTags
|
||||||
|
For Each sTag In sIgnoreTags
|
||||||
|
If oTag.Name = sTag Then
|
||||||
|
Return False
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
Next
|
||||||
|
|
||||||
|
Return True
|
||||||
|
End Function
|
||||||
|
|
||||||
Private Sub LoadData(Optional ByVal sFilter As String = "", Optional ByVal bAutoDetect As Boolean = False)
|
Private Sub LoadData(Optional ByVal sFilter As String = "", Optional ByVal bAutoDetect As Boolean = False)
|
||||||
Dim oApp As clsGame
|
Dim oApp As clsGame
|
||||||
Dim oListViewItem As ListViewItem
|
Dim oListViewItem As ListViewItem
|
||||||
@@ -75,6 +143,12 @@ Public Class frmAdvancedImport
|
|||||||
For Each de As DictionaryEntry In ImportData
|
For Each de As DictionaryEntry In ImportData
|
||||||
bAddItem = False
|
bAddItem = False
|
||||||
oApp = DirectCast(de.Value, clsGame)
|
oApp = DirectCast(de.Value, clsGame)
|
||||||
|
|
||||||
|
'Run any required tag mods
|
||||||
|
If ModWinConfigsForLinux Then
|
||||||
|
ModTags(oApp.ImportTags)
|
||||||
|
End If
|
||||||
|
|
||||||
sTags = String.Empty
|
sTags = String.Empty
|
||||||
oApp.ImportTags.Sort(AddressOf mgrCommon.CompareImportTagsByName)
|
oApp.ImportTags.Sort(AddressOf mgrCommon.CompareImportTagsByName)
|
||||||
For Each oTag As Tag In oApp.ImportTags
|
For Each oTag As Tag In oApp.ImportTags
|
||||||
@@ -119,6 +193,11 @@ Public Class frmAdvancedImport
|
|||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
'Check for hardcoded ignore tags
|
||||||
|
If ModWinConfigsForLinux Then
|
||||||
|
bAddItem = CheckIgnoreTags(oApp.ImportTags)
|
||||||
|
End If
|
||||||
|
|
||||||
If bAddItem Then
|
If bAddItem Then
|
||||||
If oListViewItem.Checked Then bResetSelectAll = True
|
If oListViewItem.Checked Then bResetSelectAll = True
|
||||||
lstGames.Items.Add(oListViewItem)
|
lstGames.Items.Add(oListViewItem)
|
||||||
|
|||||||
@@ -1704,9 +1704,9 @@ Public Class frmGameManager
|
|||||||
|
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Sub ImportOfficialGameList(ByVal sImportUrl As String)
|
Private Sub ImportOfficialGameList(ByVal sImportUrl As String, ByVal bWinConfigsInLinux As Boolean)
|
||||||
If mgrCommon.ShowMessage(frmGameManager_ConfirmOfficialImport, MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then
|
If mgrCommon.ShowMessage(frmGameManager_ConfirmOfficialImport, MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then
|
||||||
If mgrMonitorList.DoImport(sImportUrl, True, Settings) Then
|
If mgrMonitorList.DoImport(sImportUrl, True, Settings,, bWinConfigsInLinux) Then
|
||||||
mgrMonitorList.SyncMonitorLists(Settings)
|
mgrMonitorList.SyncMonitorLists(Settings)
|
||||||
LoadData()
|
LoadData()
|
||||||
LoadBackupData()
|
LoadBackupData()
|
||||||
@@ -1971,6 +1971,7 @@ Public Class frmGameManager
|
|||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Sub cmsOfficialWindows_Click(sender As Object, e As EventArgs) Handles cmsOfficialWindows.Click, cmsOfficial.Click
|
Private Sub cmsOfficialWindows_Click(sender As Object, e As EventArgs) Handles cmsOfficialWindows.Click, cmsOfficial.Click
|
||||||
|
Dim bWinConfigsinLinux As Boolean = False
|
||||||
'Show one time warning about Windows configs in Linux
|
'Show one time warning about Windows configs in Linux
|
||||||
If mgrCommon.IsUnix Then
|
If mgrCommon.IsUnix Then
|
||||||
If Not (oSettings.SuppressMessages And mgrSettings.eSuppressMessages.WinConfigsInLinux) = mgrSettings.eSuppressMessages.WinConfigsInLinux Then
|
If Not (oSettings.SuppressMessages And mgrSettings.eSuppressMessages.WinConfigsInLinux) = mgrSettings.eSuppressMessages.WinConfigsInLinux Then
|
||||||
@@ -1978,13 +1979,14 @@ Public Class frmGameManager
|
|||||||
oSettings.SuppressMessages = oSettings.SetMessageField(oSettings.SuppressMessages, mgrSettings.eSuppressMessages.WinConfigsInLinux)
|
oSettings.SuppressMessages = oSettings.SetMessageField(oSettings.SuppressMessages, mgrSettings.eSuppressMessages.WinConfigsInLinux)
|
||||||
oSettings.SaveSettings()
|
oSettings.SaveSettings()
|
||||||
End If
|
End If
|
||||||
|
bWinConfigsinLinux = True
|
||||||
End If
|
End If
|
||||||
|
|
||||||
ImportOfficialGameList(App_URLImport)
|
ImportOfficialGameList(App_URLImport, bWinConfigsinLinux)
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Sub cmsOfficialLinux_Click(sender As Object, e As EventArgs) Handles cmsOfficialLinux.Click
|
Private Sub cmsOfficialLinux_Click(sender As Object, e As EventArgs) Handles cmsOfficialLinux.Click
|
||||||
ImportOfficialGameList(App_URLImportLinux)
|
ImportOfficialGameList(App_URLImportLinux, False)
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Sub cmsFile_Click(sender As Object, e As EventArgs) Handles cmsFile.Click
|
Private Sub cmsFile_Click(sender As Object, e As EventArgs) Handles cmsFile.Click
|
||||||
|
|||||||
@@ -788,13 +788,13 @@ Public Class mgrMonitorList
|
|||||||
Return True
|
Return True
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
Public Shared Function DoImport(ByVal sPath As String, ByVal bOfficial As Boolean, ByRef oSettings As mgrSettings, Optional ByVal bStartUpWizard As Boolean = False) As Boolean
|
Public Shared Function DoImport(ByVal sPath As String, ByVal bOfficial As Boolean, ByRef oSettings As mgrSettings, Optional ByVal bStartUpWizard As Boolean = False, Optional ByVal bWinConfigsInLinux As Boolean = False) As Boolean
|
||||||
If mgrCommon.IsAddress(sPath) Then
|
If mgrCommon.IsAddress(sPath) Then
|
||||||
If mgrCommon.CheckAddress(sPath) Then
|
If mgrCommon.CheckAddress(sPath) Then
|
||||||
If bOfficial And Not bStartUpWizard And Not ((oSettings.SuppressMessages And mgrSettings.eSuppressMessages.GameIDSync) = mgrSettings.eSuppressMessages.GameIDSync) Then
|
If bOfficial And Not bStartUpWizard And Not ((oSettings.SuppressMessages And mgrSettings.eSuppressMessages.GameIDSync) = mgrSettings.eSuppressMessages.GameIDSync) Then
|
||||||
SyncGameIDs(sPath, oSettings, True)
|
SyncGameIDs(sPath, oSettings, True)
|
||||||
End If
|
End If
|
||||||
ImportMonitorList(sPath, True)
|
ImportMonitorList(sPath, True, bWinConfigsInLinux)
|
||||||
Return True
|
Return True
|
||||||
Else
|
Else
|
||||||
mgrCommon.ShowMessage(mgrMonitorList_WebNoReponse, sPath, MsgBoxStyle.Exclamation)
|
mgrCommon.ShowMessage(mgrMonitorList_WebNoReponse, sPath, MsgBoxStyle.Exclamation)
|
||||||
@@ -802,7 +802,7 @@ Public Class mgrMonitorList
|
|||||||
End If
|
End If
|
||||||
Else
|
Else
|
||||||
If File.Exists(sPath) Then
|
If File.Exists(sPath) Then
|
||||||
ImportMonitorList(sPath)
|
ImportMonitorList(sPath,, bWinConfigsInLinux)
|
||||||
Return True
|
Return True
|
||||||
Else
|
Else
|
||||||
mgrCommon.ShowMessage(mgrMonitorList_FileNotFound, sPath, MsgBoxStyle.Exclamation)
|
mgrCommon.ShowMessage(mgrMonitorList_FileNotFound, sPath, MsgBoxStyle.Exclamation)
|
||||||
@@ -812,7 +812,7 @@ Public Class mgrMonitorList
|
|||||||
Return True
|
Return True
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
Private Shared Sub ImportMonitorList(ByVal sLocation As String, Optional ByVal bWebRead As Boolean = False)
|
Private Shared Sub ImportMonitorList(ByVal sLocation As String, Optional ByVal bWebRead As Boolean = False, Optional ByVal bWinConfigsInLinux As Boolean = False)
|
||||||
Dim hshCompareFrom As New Hashtable
|
Dim hshCompareFrom As New Hashtable
|
||||||
Dim hshCompareTo As Hashtable
|
Dim hshCompareTo As Hashtable
|
||||||
Dim hshSyncItems As Hashtable
|
Dim hshSyncItems As Hashtable
|
||||||
@@ -859,6 +859,7 @@ Public Class mgrMonitorList
|
|||||||
Dim frm As New frmAdvancedImport
|
Dim frm As New frmAdvancedImport
|
||||||
frm.ImportInfo = oExportInfo
|
frm.ImportInfo = oExportInfo
|
||||||
frm.ImportData = hshSyncItems
|
frm.ImportData = hshSyncItems
|
||||||
|
frm.ModWinConfigsForLinux = bWinConfigsInLinux
|
||||||
If frm.ShowDialog() = DialogResult.OK Then
|
If frm.ShowDialog() = DialogResult.OK Then
|
||||||
Cursor.Current = Cursors.WaitCursor
|
Cursor.Current = Cursors.WaitCursor
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user