Updated import/id sync error handling and messaging

This commit is contained in:
MikeMaximus
2018-03-08 09:04:48 -06:00
parent 9807094af6
commit 6461c80ae0
4 changed files with 25 additions and 20 deletions
+8 -4
View File
@@ -818,7 +818,7 @@ Public Class mgrMonitorList
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)
Dim hshCompareFrom As Hashtable Dim hshCompareFrom As New Hashtable
Dim hshCompareTo As Hashtable Dim hshCompareTo As Hashtable
Dim hshSyncItems As Hashtable Dim hshSyncItems As Hashtable
Dim oFromItem As clsGame Dim oFromItem As clsGame
@@ -827,7 +827,9 @@ Public Class mgrMonitorList
Cursor.Current = Cursors.WaitCursor Cursor.Current = Cursors.WaitCursor
hshCompareFrom = mgrXML.ReadMonitorList(sLocation, oExportInfo, bWebRead) If Not mgrXML.ReadMonitorList(sLocation, oExportInfo, hshCompareFrom, bWebRead) Then
Exit Sub
End If
If oExportInfo.AppVer < 110 Then If oExportInfo.AppVer < 110 Then
If mgrCommon.ShowMessage(mgrMonitorList_ImportVersionWarning, MsgBoxStyle.YesNo) = MsgBoxResult.No Then If mgrCommon.ShowMessage(mgrMonitorList_ImportVersionWarning, MsgBoxStyle.YesNo) = MsgBoxResult.No Then
@@ -884,7 +886,7 @@ Public Class mgrMonitorList
Dim sSQL As String Dim sSQL As String
Dim hshParams As Hashtable Dim hshParams As Hashtable
Dim oParamList As New List(Of Hashtable) Dim oParamList As New List(Of Hashtable)
Dim hshCompareFrom As Hashtable Dim hshCompareFrom As New Hashtable
Dim hshCompareTo As Hashtable Dim hshCompareTo As Hashtable
Dim hshSyncIDs As New Hashtable Dim hshSyncIDs As New Hashtable
Dim oFromItem As clsGame Dim oFromItem As clsGame
@@ -893,7 +895,9 @@ Public Class mgrMonitorList
Cursor.Current = Cursors.WaitCursor Cursor.Current = Cursors.WaitCursor
hshCompareFrom = mgrXML.ReadMonitorList(sLocation, oExportInfo, bWebRead) If Not mgrXML.ReadMonitorList(sLocation, oExportInfo, hshCompareFrom, bWebRead) Then
Exit Sub
End If
If oExportInfo.AppVer < 110 Then If oExportInfo.AppVer < 110 Then
mgrCommon.ShowMessage(mgrMonitorList_ErrorGameIDVerFailure, MsgBoxStyle.Exclamation) mgrCommon.ShowMessage(mgrMonitorList_ErrorGameIDVerFailure, MsgBoxStyle.Exclamation)
+11 -10
View File
@@ -6,20 +6,22 @@ Imports System.Net
Public Class mgrXML Public Class mgrXML
Public Shared Function ReadMonitorList(ByVal sLocation As String, ByRef oExportInfo As ExportData, Optional ByVal bWebRead As Boolean = False) As Hashtable Public Shared Function ReadMonitorList(ByVal sLocation As String, ByRef oExportInfo As ExportData, ByRef hshList As Hashtable, Optional ByVal bWebRead As Boolean = False) As Boolean
Dim oList As List(Of Game) Dim oList As List(Of Game)
Dim hshList As New Hashtable
Dim hshDupeList As New Hashtable Dim hshDupeList As New Hashtable
Dim oExportData As ExportData Dim oExportData As New ExportData
Dim oGame As clsGame Dim oGame As clsGame
'If the file doesn't exist return an empty list 'If the file doesn't exist return an empty list
If Not File.Exists(sLocation) And Not bWebRead Then If Not File.Exists(sLocation) And Not bWebRead Then
Return hshList Return False
End If
If Not ImportandDeserialize(sLocation, oExportData, bWebRead) Then
Return False
End If End If
oExportData = ImportandDeserialize(sLocation, bWebRead)
oList = oExportData.Configurations oList = oExportData.Configurations
oExportInfo = oExportData oExportInfo = oExportData
@@ -49,7 +51,7 @@ Public Class mgrXML
End Try End Try
Next Next
Return hshList Return True
End Function End Function
Private Shared Function ReadImportData(ByVal sLocation As String, ByVal bWebRead As Boolean) Private Shared Function ReadImportData(ByVal sLocation As String, ByVal bWebRead As Boolean)
@@ -66,10 +68,9 @@ Public Class mgrXML
Return oReader Return oReader
End Function End Function
Public Shared Function ImportandDeserialize(ByVal sLocation As String, Optional ByVal bWebRead As Boolean = False) As ExportData Public Shared Function ImportandDeserialize(ByVal sLocation As String, ByRef oExportData As ExportData, Optional ByVal bWebRead As Boolean = False) As Boolean
Dim oReader As StreamReader Dim oReader As StreamReader
Dim oSerializer As XmlSerializer Dim oSerializer As XmlSerializer
Dim oExportData As New ExportData
Try Try
oReader = ReadImportData(sLocation, bWebRead) oReader = ReadImportData(sLocation, bWebRead)
@@ -84,12 +85,12 @@ Public Class mgrXML
oExportData.Configurations = oSerializer.Deserialize(oReader) oExportData.Configurations = oSerializer.Deserialize(oReader)
oReader.Close() oReader.Close()
End If End If
Return True
Catch ex As Exception Catch ex As Exception
mgrCommon.ShowMessage(mgrXML_ErrorImportFailure, ex.Message, MsgBoxStyle.Exclamation) mgrCommon.ShowMessage(mgrXML_ErrorImportFailure, ex.Message, MsgBoxStyle.Exclamation)
Return False
End Try End Try
Return oExportData
End Function End Function
Public Shared Function SerializeAndExport(ByVal oList As List(Of Game), ByVal sLocation As String) As Boolean Public Shared Function SerializeAndExport(ByVal oList As List(Of Game), ByVal sLocation As String) As Boolean
+3 -3
View File
@@ -5512,7 +5512,7 @@ Namespace My.Resources
End Property End Property
'''<summary> '''<summary>
''' Looks up a localized string similar to Do you want to sync your identifiers with this export file?[BR][BR]You should only do this if you&apos;re managing your own game configurations.. ''' Looks up a localized string similar to Do you want to sync your game identifiers with this export file?[BR][BR]You should only do this if you&apos;re managing your own game configurations. Please see the online manual for more information..
'''</summary> '''</summary>
Friend ReadOnly Property mgrMonitorList_ConfirmFileGameIDSync() As String Friend ReadOnly Property mgrMonitorList_ConfirmFileGameIDSync() As String
Get Get
@@ -5521,7 +5521,7 @@ Namespace My.Resources
End Property End Property
'''<summary> '''<summary>
''' Looks up a localized string similar to GBM now uses a unique identifier for each game. For the import feature to work as intended, your existing game configurations should use the same identifiers.[BR][BR]Do you want to sync your identifiers with the official list?[BR][BR]This warning will only be displayed once, but the option is available anytime from the &quot;Tools&quot; menu.. ''' Looks up a localized string similar to GBM now uses a unique identifier for each game. For the import feature to recognize game configurations from a prior version, they need to use the same identifiers.[BR][BR]Do you want to sync your game identifiers with the official list?[BR][BR]This question will only be displayed once, but the option is available anytime from the &quot;Tools&quot; menu. Please see the online manual for more information..
'''</summary> '''</summary>
Friend ReadOnly Property mgrMonitorList_ConfirmInitialOfficialGameIDSync() As String Friend ReadOnly Property mgrMonitorList_ConfirmInitialOfficialGameIDSync() As String
Get Get
@@ -5530,7 +5530,7 @@ Namespace My.Resources
End Property End Property
'''<summary> '''<summary>
''' Looks up a localized string similar to Do you want to sync your identifiers with the official game list?. ''' Looks up a localized string similar to Do you want to sync your game identifiers with the official game list?[BR][BR]This allows the import feature to recognize game configurations from a prior version. Please see the online manual for more information..
'''</summary> '''</summary>
Friend ReadOnly Property mgrMonitorList_ConfirmOfficialGameIDSync() As String Friend ReadOnly Property mgrMonitorList_ConfirmOfficialGameIDSync() As String
Get Get
+3 -3
View File
@@ -2024,7 +2024,7 @@
<value>Game ID</value> <value>Game ID</value>
</data> </data>
<data name="mgrMonitorList_ConfirmInitialOfficialGameIDSync" xml:space="preserve"> <data name="mgrMonitorList_ConfirmInitialOfficialGameIDSync" xml:space="preserve">
<value>GBM now uses a unique identifier for each game. For the import feature to work as intended, your existing game configurations should use the same identifiers.[BR][BR]Do you want to sync your identifiers with the official list?[BR][BR]This warning will only be displayed once, but the option is available anytime from the "Tools" menu.</value> <value>GBM now uses a unique identifier for each game. For the import feature to recognize game configurations from a prior version, they need to use the same identifiers.[BR][BR]Do you want to sync your game identifiers with the official list?[BR][BR]This question will only be displayed once, but the option is available anytime from the "Tools" menu. Please see the online manual for more information.</value>
</data> </data>
<data name="mgrMonitorList_ErrorGameIDVerFailure" xml:space="preserve"> <data name="mgrMonitorList_ErrorGameIDVerFailure" xml:space="preserve">
<value>This file cannot be used to sync game indentifiers. It was created with an older version of GBM.</value> <value>This file cannot be used to sync game indentifiers. It was created with an older version of GBM.</value>
@@ -2033,7 +2033,7 @@
<value>This export file was created with a version of GBM prior to 1.1.0 and does not contain unique game identifiers.[BR][BR]Do you still want to import configurations from this file? (Not Recommended)</value> <value>This export file was created with a version of GBM prior to 1.1.0 and does not contain unique game identifiers.[BR][BR]Do you still want to import configurations from this file? (Not Recommended)</value>
</data> </data>
<data name="mgrMonitorList_ConfirmFileGameIDSync" xml:space="preserve"> <data name="mgrMonitorList_ConfirmFileGameIDSync" xml:space="preserve">
<value>Do you want to sync your identifiers with this export file?[BR][BR]You should only do this if you're managing your own game configurations.</value> <value>Do you want to sync your game identifiers with this export file?[BR][BR]You should only do this if you're managing your own game configurations. Please see the online manual for more information.</value>
</data> </data>
<data name="frmMain_gMonToolsSyncGameID" xml:space="preserve"> <data name="frmMain_gMonToolsSyncGameID" xml:space="preserve">
<value>S&amp;ync Game IDs</value> <value>S&amp;ync Game IDs</value>
@@ -2045,7 +2045,7 @@
<value>&amp;Official List...</value> <value>&amp;Official List...</value>
</data> </data>
<data name="mgrMonitorList_ConfirmOfficialGameIDSync" xml:space="preserve"> <data name="mgrMonitorList_ConfirmOfficialGameIDSync" xml:space="preserve">
<value>Do you want to sync your identifiers with the official game list?</value> <value>Do you want to sync your game identifiers with the official game list?[BR][BR]This allows the import feature to recognize game configurations from a prior version. Please see the online manual for more information.</value>
</data> </data>
<data name="frmSettings_btnResetMessages" xml:space="preserve"> <data name="frmSettings_btnResetMessages" xml:space="preserve">
<value>&amp;Reset Warnings</value> <value>&amp;Reset Warnings</value>