From 2c0fdb776e20af4a2efa73461968c66abed04f09 Mon Sep 17 00:00:00 2001 From: "Michael J. Seiferling" Date: Tue, 5 Dec 2017 18:06:22 -0600 Subject: [PATCH] Changes for issue #109 --- GBM/Forms/frmAdvancedImport.Designer.vb | 19 ++++++++++++++++--- GBM/Forms/frmAdvancedImport.vb | 17 +++++++++++++++++ GBM/Forms/frmMain.vb | 3 +-- GBM/Managers/mgrCommon.vb | 6 ++++++ GBM/Managers/mgrMonitorList.vb | 4 +++- GBM/Managers/mgrXML.vb | 21 +++++++++++---------- GBM/My Project/Resources.Designer.vb | 9 +++++++++ GBM/My Project/Resources.resx | 3 +++ 8 files changed, 66 insertions(+), 16 deletions(-) diff --git a/GBM/Forms/frmAdvancedImport.Designer.vb b/GBM/Forms/frmAdvancedImport.Designer.vb index 21aae4c..5d3ecc5 100644 --- a/GBM/Forms/frmAdvancedImport.Designer.vb +++ b/GBM/Forms/frmAdvancedImport.Designer.vb @@ -30,6 +30,7 @@ Partial Class frmAdvancedImport Me.lstGames = New System.Windows.Forms.ListView() Me.txtFilter = New System.Windows.Forms.TextBox() Me.lblFilter = New System.Windows.Forms.Label() + Me.lblInfo = New System.Windows.Forms.Label() Me.SuspendLayout() ' 'btnImport @@ -44,7 +45,7 @@ Partial Class frmAdvancedImport 'chkSelectAll ' Me.chkSelectAll.AutoSize = True - Me.chkSelectAll.Location = New System.Drawing.Point(12, 12) + Me.chkSelectAll.Location = New System.Drawing.Point(12, 11) Me.chkSelectAll.Name = "chkSelectAll" Me.chkSelectAll.Size = New System.Drawing.Size(70, 17) Me.chkSelectAll.TabIndex = 0 @@ -98,18 +99,29 @@ Partial Class frmAdvancedImport ' 'lblFilter ' - Me.lblFilter.Location = New System.Drawing.Point(307, 12) + Me.lblFilter.Location = New System.Drawing.Point(371, 12) Me.lblFilter.Name = "lblFilter" - Me.lblFilter.Size = New System.Drawing.Size(103, 14) + Me.lblFilter.Size = New System.Drawing.Size(39, 14) Me.lblFilter.TabIndex = 0 Me.lblFilter.Text = "Filter:" Me.lblFilter.TextAlign = System.Drawing.ContentAlignment.TopRight ' + 'lblInfo + ' + Me.lblInfo.AutoEllipsis = True + Me.lblInfo.Location = New System.Drawing.Point(88, 12) + Me.lblInfo.Name = "lblInfo" + Me.lblInfo.Size = New System.Drawing.Size(277, 14) + Me.lblInfo.TabIndex = 0 + Me.lblInfo.Text = "Import Information" + Me.lblInfo.TextAlign = System.Drawing.ContentAlignment.TopCenter + ' 'frmAdvancedImport ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font Me.ClientSize = New System.Drawing.Size(584, 411) + Me.Controls.Add(Me.lblInfo) Me.Controls.Add(Me.lblFilter) Me.Controls.Add(Me.txtFilter) Me.Controls.Add(Me.lstGames) @@ -137,4 +149,5 @@ Partial Class frmAdvancedImport Friend WithEvents lstGames As System.Windows.Forms.ListView Friend WithEvents txtFilter As System.Windows.Forms.TextBox Friend WithEvents lblFilter As System.Windows.Forms.Label + Friend WithEvents lblInfo As Label End Class diff --git a/GBM/Forms/frmAdvancedImport.vb b/GBM/Forms/frmAdvancedImport.vb index 70ef96b..fafbd3d 100644 --- a/GBM/Forms/frmAdvancedImport.vb +++ b/GBM/Forms/frmAdvancedImport.vb @@ -3,6 +3,7 @@ Imports System.IO Public Class frmAdvancedImport + Private oImportInfo As ExportInformation Private hshImportData As Hashtable Private hshFinalData As New Hashtable Private bSelectAll As Boolean = True @@ -10,6 +11,15 @@ Public Class frmAdvancedImport Private iCurrentSort As Integer = 0 Private WithEvents tmFilterTimer As Timer + Public Property ImportInfo As ExportInformation + Set(value As ExportInformation) + oImportInfo = value + End Set + Get + Return oImportInfo + End Get + End Property + Public Property ImportData As Hashtable Set(value As Hashtable) hshImportData = value @@ -141,6 +151,13 @@ Public Class frmAdvancedImport btnImport.Text = frmAdvancedImport_btnImport chkSelectAll.Text = frmAdvancedImport_chkSelectAll + 'Import Information + If ImportInfo.Exported <> 0 Then + lblInfo.Text = mgrCommon.FormatString(frmAdvancedImport_lblInfo, New String() {mgrCommon.UnixToDate(ImportInfo.Exported).Date, mgrCommon.DisplayAppVersion}) + Else + lblInfo.Text = String.Empty + End If + chkSelectAll.Checked = True 'Init Filter Timer diff --git a/GBM/Forms/frmMain.vb b/GBM/Forms/frmMain.vb index f1991d2..3b98374 100644 --- a/GBM/Forms/frmMain.vb +++ b/GBM/Forms/frmMain.vb @@ -813,14 +813,13 @@ Public Class frmMain Private Sub OpenAbout() Dim iProcessType As System.Reflection.ProcessorArchitecture = System.Reflection.AssemblyName.GetAssemblyName(Application.ExecutablePath()).ProcessorArchitecture - Dim sVersion As String = My.Application.Info.Version.Major & "." & My.Application.Info.Version.Minor & "." & My.Application.Info.Version.Build Dim sProcessType = [Enum].GetName(GetType(System.Reflection.ProcessorArchitecture), iProcessType) Dim sRevision As String = My.Application.Info.Version.Revision Dim oDatabase As New mgrSQLite(mgrSQLite.Database.Local) Dim sSqliteVersion As String = oDatabase.ReportVersion Dim sConstCopyright As String = Chr(169) & mgrCommon.FormatString(App_Copyright, Now.Year.ToString) - mgrCommon.ShowMessage(frmMain_About, New String() {sVersion, sProcessType, sRevision, sSqliteVersion, sConstCopyright}, MsgBoxStyle.Information) + mgrCommon.ShowMessage(frmMain_About, New String() {mgrCommon.DisplayAppVersion, sProcessType, sRevision, sSqliteVersion, sConstCopyright}, MsgBoxStyle.Information) End Sub Private Sub OpenTags() diff --git a/GBM/Managers/mgrCommon.vb b/GBM/Managers/mgrCommon.vb index 2339d33..fa59326 100644 --- a/GBM/Managers/mgrCommon.vb +++ b/GBM/Managers/mgrCommon.vb @@ -37,6 +37,12 @@ Public Class mgrCommon End Get End Property + Public Shared ReadOnly Property DisplayAppVersion As String + Get + Return My.Application.Info.Version.Major & "." & My.Application.Info.Version.Minor & "." & My.Application.Info.Version.Build + End Get + End Property + 'Source - https://stackoverflow.com/questions/18873152/deep-copy-of-ordereddictionary Public Shared Function GenericClone(ByVal oOriginal As Object) As Object 'Construct a temporary memory stream diff --git a/GBM/Managers/mgrMonitorList.vb b/GBM/Managers/mgrMonitorList.vb index 58f344c..24d3474 100644 --- a/GBM/Managers/mgrMonitorList.vb +++ b/GBM/Managers/mgrMonitorList.vb @@ -735,11 +735,12 @@ Public Class mgrMonitorList Dim hshSyncItems As Hashtable Dim oFromItem As clsGame Dim oToItem As clsGame + Dim oExportInfo As New ExportInformation Cursor.Current = Cursors.WaitCursor 'Add / Update Sync - hshCompareFrom = mgrXML.ReadMonitorList(sLocation, bWebRead) + hshCompareFrom = mgrXML.ReadMonitorList(sLocation, oExportInfo, bWebRead) hshCompareTo = ReadList(eListTypes.FullList, mgrSQLite.Database.Local) hshSyncItems = hshCompareFrom.Clone @@ -757,6 +758,7 @@ Public Class mgrMonitorList If hshSyncItems.Count > 0 Then Dim frm As New frmAdvancedImport + frm.ImportInfo = oExportInfo frm.ImportData = hshSyncItems If frm.ShowDialog() = DialogResult.OK Then Cursor.Current = Cursors.WaitCursor diff --git a/GBM/Managers/mgrXML.vb b/GBM/Managers/mgrXML.vb index 3b3f265..b8829bb 100644 --- a/GBM/Managers/mgrXML.vb +++ b/GBM/Managers/mgrXML.vb @@ -6,18 +6,22 @@ Imports System.Net Public Class mgrXML - Public Shared Function ReadMonitorList(ByVal sLocation As String, Optional ByVal bWebRead As Boolean = False) As Hashtable + Public Shared Function ReadMonitorList(ByVal sLocation As String, ByRef oExportInfo As ExportInformation, Optional ByVal bWebRead As Boolean = False) As Hashtable Dim oList As List(Of Game) Dim hshList As New Hashtable Dim hshDupeList As New Hashtable + Dim oExportData As ExportData Dim oGame As clsGame + 'If the file doesn't exist return an empty list If Not File.Exists(sLocation) And Not bWebRead Then Return hshList End If - oList = ImportandDeserialize(sLocation, bWebRead) + oExportData = ImportandDeserialize(sLocation, bWebRead) + oList = oExportData.Configurations + oExportInfo = oExportData.Information For Each g As Game In oList oGame = New clsGame @@ -60,33 +64,30 @@ Public Class mgrXML Return oReader End Function - Public Shared Function ImportandDeserialize(ByVal sLocation As String, Optional ByVal bWebRead As Boolean = False) As List(Of Game) + Public Shared Function ImportandDeserialize(ByVal sLocation As String, Optional ByVal bWebRead As Boolean = False) As ExportData Dim oReader As StreamReader Dim oSerializer As XmlSerializer Dim oExportData As New ExportData - Dim oConfigurations As New List(Of Game) Try oReader = ReadImportData(sLocation, bWebRead) - oSerializer = New XmlSerializer(oExportData.GetType(), New XmlRootAttribute("gbm")) + oSerializer = New XmlSerializer(GetType(ExportData), New XmlRootAttribute("gbm")) oExportData = oSerializer.Deserialize(oReader) oReader.Close() 'Compatability Mode If oExportData.Information.AppVer = 0 Then oReader = ReadImportData(sLocation, bWebRead) - oSerializer = New XmlSerializer(oConfigurations.GetType(), New XmlRootAttribute("gbm")) - oConfigurations = oSerializer.Deserialize(oReader) + oSerializer = New XmlSerializer(GetType(List(Of Game)), New XmlRootAttribute("gbm")) + oExportData.Configurations = oSerializer.Deserialize(oReader) oReader.Close() - Else - oConfigurations = oExportData.Configurations End If Catch ex As Exception mgrCommon.ShowMessage(mgrXML_ErrorImportFailure, ex.Message, MsgBoxStyle.Exclamation) End Try - Return oConfigurations + Return oExportData End Function Public Shared Function SerializeAndExport(ByVal oList As List(Of Game), ByVal sLocation As String) As Boolean diff --git a/GBM/My Project/Resources.Designer.vb b/GBM/My Project/Resources.Designer.vb index e5a32b4..ecae674 100644 --- a/GBM/My Project/Resources.Designer.vb +++ b/GBM/My Project/Resources.Designer.vb @@ -807,6 +807,15 @@ Namespace My.Resources End Get End Property + ''' + ''' Looks up a localized string similar to Last Update: [PARAM] (v[PARAM]). + ''' + Friend ReadOnly Property frmAdvancedImport_lblInfo() As String + Get + Return ResourceManager.GetString("frmAdvancedImport_lblInfo", resourceCulture) + End Get + End Property + ''' ''' Looks up a localized string similar to Selected ([PARAM]). ''' diff --git a/GBM/My Project/Resources.resx b/GBM/My Project/Resources.resx index 0c37006..84c8c4b 100644 --- a/GBM/My Project/Resources.resx +++ b/GBM/My Project/Resources.resx @@ -1900,4 +1900,7 @@ Not + + Last Update: [PARAM] (v[PARAM]) + \ No newline at end of file