Changes for issue #109

This commit is contained in:
Michael J. Seiferling
2017-12-05 18:06:22 -06:00
parent e106d7c09c
commit 2c0fdb776e
8 changed files with 66 additions and 16 deletions
+16 -3
View File
@@ -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
+17
View File
@@ -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
+1 -2
View File
@@ -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()
+6
View File
@@ -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
+3 -1
View File
@@ -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
+11 -10
View File
@@ -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
+9
View File
@@ -807,6 +807,15 @@ Namespace My.Resources
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Last Update: [PARAM] (v[PARAM]).
'''</summary>
Friend ReadOnly Property frmAdvancedImport_lblInfo() As String
Get
Return ResourceManager.GetString("frmAdvancedImport_lblInfo", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Selected ([PARAM]).
'''</summary>
+3
View File
@@ -1900,4 +1900,7 @@
<data name="frmFilter_lblNot" xml:space="preserve">
<value>Not</value>
</data>
<data name="frmAdvancedImport_lblInfo" xml:space="preserve">
<value>Last Update: [PARAM] (v[PARAM])</value>
</data>
</root>