Added filtering by tags

This commit is contained in:
Michael J. Seiferling
2015-11-14 20:39:48 -06:00
parent 040d6c4bf3
commit 0a3bb9a58f
10 changed files with 500 additions and 32 deletions
+126
View File
@@ -0,0 +1,126 @@
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class frmFilter
Inherits System.Windows.Forms.Form
'Form overrides dispose to clean up the component list.
<System.Diagnostics.DebuggerNonUserCode()> _
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
Try
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
Finally
MyBase.Dispose(disposing)
End Try
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
Me.btnOK = New System.Windows.Forms.Button()
Me.lblGameTags = New System.Windows.Forms.Label()
Me.lblTags = New System.Windows.Forms.Label()
Me.btnRemove = New System.Windows.Forms.Button()
Me.btnAdd = New System.Windows.Forms.Button()
Me.lstFilter = New System.Windows.Forms.ListBox()
Me.lstTags = New System.Windows.Forms.ListBox()
Me.SuspendLayout()
'
'btnOK
'
Me.btnOK.Location = New System.Drawing.Point(297, 229)
Me.btnOK.Name = "btnOK"
Me.btnOK.Size = New System.Drawing.Size(75, 23)
Me.btnOK.TabIndex = 13
Me.btnOK.Text = "&OK"
Me.btnOK.UseVisualStyleBackColor = True
'
'lblGameTags
'
Me.lblGameTags.AutoSize = True
Me.lblGameTags.Location = New System.Drawing.Point(263, 8)
Me.lblGameTags.Name = "lblGameTags"
Me.lblGameTags.Size = New System.Drawing.Size(66, 13)
Me.lblGameTags.TabIndex = 6
Me.lblGameTags.Text = "Current Filter"
'
'lblTags
'
Me.lblTags.AutoSize = True
Me.lblTags.Location = New System.Drawing.Point(49, 8)
Me.lblTags.Name = "lblTags"
Me.lblTags.Size = New System.Drawing.Size(77, 13)
Me.lblTags.TabIndex = 7
Me.lblTags.Text = "Available Tags"
'
'btnRemove
'
Me.btnRemove.Location = New System.Drawing.Point(168, 114)
Me.btnRemove.Name = "btnRemove"
Me.btnRemove.Size = New System.Drawing.Size(48, 23)
Me.btnRemove.TabIndex = 10
Me.btnRemove.Text = "< <"
Me.btnRemove.UseVisualStyleBackColor = True
'
'btnAdd
'
Me.btnAdd.Location = New System.Drawing.Point(168, 85)
Me.btnAdd.Name = "btnAdd"
Me.btnAdd.Size = New System.Drawing.Size(48, 23)
Me.btnAdd.TabIndex = 9
Me.btnAdd.Text = "> >"
Me.btnAdd.UseVisualStyleBackColor = True
'
'lstFilter
'
Me.lstFilter.FormattingEnabled = True
Me.lstFilter.Location = New System.Drawing.Point(222, 24)
Me.lstFilter.Name = "lstFilter"
Me.lstFilter.SelectionMode = System.Windows.Forms.SelectionMode.MultiExtended
Me.lstFilter.Size = New System.Drawing.Size(150, 199)
Me.lstFilter.TabIndex = 11
'
'lstTags
'
Me.lstTags.FormattingEnabled = True
Me.lstTags.Location = New System.Drawing.Point(12, 24)
Me.lstTags.Name = "lstTags"
Me.lstTags.SelectionMode = System.Windows.Forms.SelectionMode.MultiExtended
Me.lstTags.Size = New System.Drawing.Size(150, 199)
Me.lstTags.TabIndex = 8
'
'frmFilter
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(384, 261)
Me.Controls.Add(Me.btnOK)
Me.Controls.Add(Me.lblGameTags)
Me.Controls.Add(Me.lblTags)
Me.Controls.Add(Me.btnRemove)
Me.Controls.Add(Me.btnAdd)
Me.Controls.Add(Me.lstFilter)
Me.Controls.Add(Me.lstTags)
Me.MaximizeBox = False
Me.MinimizeBox = False
Me.Name = "frmFilter"
Me.ShowIcon = False
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
Me.Text = "Filter by Tags"
Me.ResumeLayout(False)
Me.PerformLayout()
End Sub
Friend WithEvents btnOK As System.Windows.Forms.Button
Friend WithEvents lblGameTags As System.Windows.Forms.Label
Friend WithEvents lblTags As System.Windows.Forms.Label
Friend WithEvents btnRemove As System.Windows.Forms.Button
Friend WithEvents btnAdd As System.Windows.Forms.Button
Friend WithEvents lstFilter As System.Windows.Forms.ListBox
Friend WithEvents lstTags As System.Windows.Forms.ListBox
End Class
+120
View File
@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
+119
View File
@@ -0,0 +1,119 @@
Public Class frmFilter
Dim oFilters As New List(Of clsTag)
Dim hshTags As New Hashtable
Dim bShutdown As Boolean = False
Public Property Filters As List(Of clsTag)
Get
Return oFilters
End Get
Set(value As List(Of clsTag))
oFilters = value
End Set
End Property
Private Sub AddTag()
Dim oData As KeyValuePair(Of String, String)
Dim oTags As List(Of KeyValuePair(Of String, String))
If lstTags.SelectedItems.Count = 1 Then
oData = lstTags.SelectedItems(0)
lstFilter.Items.Add(oData)
lstTags.Items.Remove(oData)
ElseIf lstTags.SelectedItems.Count > 1 Then
oTags = New List(Of KeyValuePair(Of String, String))
For Each oData In lstTags.SelectedItems
oTags.Add(oData)
Next
For Each kp As KeyValuePair(Of String, String) In oTags
lstFilter.Items.Add(kp)
lstTags.Items.Remove(kp)
Next
End If
End Sub
Private Sub RemoveTag()
Dim oData As KeyValuePair(Of String, String)
Dim oTags As List(Of KeyValuePair(Of String, String))
If lstFilter.SelectedItems.Count = 1 Then
oData = lstFilter.SelectedItems(0)
lstFilter.Items.Remove(oData)
lstTags.Items.Add(oData)
ElseIf lstFilter.SelectedItems.Count > 1 Then
oTags = New List(Of KeyValuePair(Of String, String))
For Each oData In lstFilter.SelectedItems
oTags.Add(oData)
Next
For Each kp As KeyValuePair(Of String, String) In oTags
lstFilter.Items.Remove(kp)
lstTags.Items.Add(kp)
Next
End If
End Sub
Private Sub LoadData()
Dim oTag As clsTag
Dim oData As KeyValuePair(Of String, String)
'Handle Data
hshTags = mgrTags.ReadTags()
'Handle Lists
lstTags.Items.Clear()
lstFilter.Items.Clear()
lstTags.ValueMember = "Key"
lstTags.DisplayMember = "Value"
lstFilter.ValueMember = "Key"
lstFilter.DisplayMember = "Value"
For Each de As DictionaryEntry In hshTags
oTag = DirectCast(de.Value, clsTag)
oData = New KeyValuePair(Of String, String)(oTag.ID, oTag.Name)
lstTags.Items.Add(oData)
Next
End Sub
Private Sub GetFilters()
Dim oData As KeyValuePair(Of String, String)
Dim oTag As clsTag
For Each oData In lstFilter.Items
oTag = DirectCast(hshTags(oData.Value), clsTag)
Filters.Add(oTag)
Next
End Sub
Private Sub frmGameTags_Load(sender As Object, e As EventArgs) Handles MyBase.Load
LoadData()
End Sub
Private Sub btnOK_Click(sender As Object, e As EventArgs) Handles btnOK.Click
GetFilters()
bShutdown = True
Me.close
End Sub
Private Sub btnAdd_Click(sender As Object, e As EventArgs) Handles btnAdd.Click
AddTag()
End Sub
Private Sub btnRemove_Click(sender As Object, e As EventArgs) Handles btnRemove.Click
RemoveTag()
End Sub
Private Sub frmFilter_FormClosing(sender As Object, e As FormClosingEventArgs) Handles MyBase.FormClosing
If Not bShutdown Then
e.Cancel = True
End If
End Sub
End Class
+27 -13
View File
@@ -45,7 +45,6 @@ Partial Class frmGameManager
Me.chkMonitorOnly = New System.Windows.Forms.CheckBox() Me.chkMonitorOnly = New System.Windows.Forms.CheckBox()
Me.grpExtra = New System.Windows.Forms.GroupBox() Me.grpExtra = New System.Windows.Forms.GroupBox()
Me.lblTags = New System.Windows.Forms.Label() Me.lblTags = New System.Windows.Forms.Label()
Me.btnTags = New System.Windows.Forms.Button()
Me.btnIconBrowse = New System.Windows.Forms.Button() Me.btnIconBrowse = New System.Windows.Forms.Button()
Me.txtIcon = New System.Windows.Forms.TextBox() Me.txtIcon = New System.Windows.Forms.TextBox()
Me.lblVersion = New System.Windows.Forms.Label() Me.lblVersion = New System.Windows.Forms.Label()
@@ -59,6 +58,7 @@ Partial Class frmGameManager
Me.txtAppPath = New System.Windows.Forms.TextBox() Me.txtAppPath = New System.Windows.Forms.TextBox()
Me.nudHours = New System.Windows.Forms.NumericUpDown() Me.nudHours = New System.Windows.Forms.NumericUpDown()
Me.lblHours = New System.Windows.Forms.Label() Me.lblHours = New System.Windows.Forms.Label()
Me.btnTags = New System.Windows.Forms.Button()
Me.grpStats = New System.Windows.Forms.GroupBox() Me.grpStats = New System.Windows.Forms.GroupBox()
Me.btnOpenRestorePath = New System.Windows.Forms.Button() Me.btnOpenRestorePath = New System.Windows.Forms.Button()
Me.btnOpenBackupFile = New System.Windows.Forms.Button() Me.btnOpenBackupFile = New System.Windows.Forms.Button()
@@ -77,6 +77,7 @@ Partial Class frmGameManager
Me.btnCancel = New System.Windows.Forms.Button() Me.btnCancel = New System.Windows.Forms.Button()
Me.chkEnabled = New System.Windows.Forms.CheckBox() Me.chkEnabled = New System.Windows.Forms.CheckBox()
Me.grpFilter = New System.Windows.Forms.GroupBox() Me.grpFilter = New System.Windows.Forms.GroupBox()
Me.optTag = New System.Windows.Forms.RadioButton()
Me.optBackupData = New System.Windows.Forms.RadioButton() Me.optBackupData = New System.Windows.Forms.RadioButton()
Me.optPendingRestores = New System.Windows.Forms.RadioButton() Me.optPendingRestores = New System.Windows.Forms.RadioButton()
Me.optAllGames = New System.Windows.Forms.RadioButton() Me.optAllGames = New System.Windows.Forms.RadioButton()
@@ -329,15 +330,6 @@ Partial Class frmGameManager
Me.lblTags.Text = "#Tags" Me.lblTags.Text = "#Tags"
Me.lblTags.TextAlign = System.Drawing.ContentAlignment.MiddleRight Me.lblTags.TextAlign = System.Drawing.ContentAlignment.MiddleRight
' '
'btnTags
'
Me.btnTags.Location = New System.Drawing.Point(535, 360)
Me.btnTags.Name = "btnTags"
Me.btnTags.Size = New System.Drawing.Size(75, 23)
Me.btnTags.TabIndex = 22
Me.btnTags.Text = "Tags..."
Me.btnTags.UseVisualStyleBackColor = True
'
'btnIconBrowse 'btnIconBrowse
' '
Me.btnIconBrowse.Location = New System.Drawing.Point(444, 96) Me.btnIconBrowse.Location = New System.Drawing.Point(444, 96)
@@ -449,6 +441,15 @@ Partial Class frmGameManager
Me.lblHours.TabIndex = 0 Me.lblHours.TabIndex = 0
Me.lblHours.Text = "Hours:" Me.lblHours.Text = "Hours:"
' '
'btnTags
'
Me.btnTags.Location = New System.Drawing.Point(535, 360)
Me.btnTags.Name = "btnTags"
Me.btnTags.Size = New System.Drawing.Size(75, 23)
Me.btnTags.TabIndex = 22
Me.btnTags.Text = "Tags..."
Me.btnTags.UseVisualStyleBackColor = True
'
'grpStats 'grpStats
' '
Me.grpStats.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) Me.grpStats.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
@@ -596,10 +597,10 @@ Partial Class frmGameManager
'lstGames 'lstGames
' '
Me.lstGames.FormattingEnabled = True Me.lstGames.FormattingEnabled = True
Me.lstGames.Location = New System.Drawing.Point(12, 112) Me.lstGames.Location = New System.Drawing.Point(12, 138)
Me.lstGames.Name = "lstGames" Me.lstGames.Name = "lstGames"
Me.lstGames.SelectionMode = System.Windows.Forms.SelectionMode.MultiExtended Me.lstGames.SelectionMode = System.Windows.Forms.SelectionMode.MultiExtended
Me.lstGames.Size = New System.Drawing.Size(220, 407) Me.lstGames.Size = New System.Drawing.Size(220, 381)
Me.lstGames.Sorted = True Me.lstGames.Sorted = True
Me.lstGames.TabIndex = 1 Me.lstGames.TabIndex = 1
' '
@@ -625,16 +626,28 @@ Partial Class frmGameManager
' '
'grpFilter 'grpFilter
' '
Me.grpFilter.Controls.Add(Me.optTag)
Me.grpFilter.Controls.Add(Me.optBackupData) Me.grpFilter.Controls.Add(Me.optBackupData)
Me.grpFilter.Controls.Add(Me.optPendingRestores) Me.grpFilter.Controls.Add(Me.optPendingRestores)
Me.grpFilter.Controls.Add(Me.optAllGames) Me.grpFilter.Controls.Add(Me.optAllGames)
Me.grpFilter.Location = New System.Drawing.Point(12, 12) Me.grpFilter.Location = New System.Drawing.Point(12, 12)
Me.grpFilter.Name = "grpFilter" Me.grpFilter.Name = "grpFilter"
Me.grpFilter.Size = New System.Drawing.Size(220, 91) Me.grpFilter.Size = New System.Drawing.Size(220, 113)
Me.grpFilter.TabIndex = 0 Me.grpFilter.TabIndex = 0
Me.grpFilter.TabStop = False Me.grpFilter.TabStop = False
Me.grpFilter.Text = "Games Filter" Me.grpFilter.Text = "Games Filter"
' '
'optTag
'
Me.optTag.AutoSize = True
Me.optTag.Location = New System.Drawing.Point(6, 87)
Me.optTag.Name = "optTag"
Me.optTag.Size = New System.Drawing.Size(49, 17)
Me.optTag.TabIndex = 3
Me.optTag.TabStop = True
Me.optTag.Text = "Tags"
Me.optTag.UseVisualStyleBackColor = True
'
'optBackupData 'optBackupData
' '
Me.optBackupData.AutoSize = True Me.optBackupData.AutoSize = True
@@ -768,4 +781,5 @@ Partial Class frmGameManager
Friend WithEvents btnOpenRestorePath As System.Windows.Forms.Button Friend WithEvents btnOpenRestorePath As System.Windows.Forms.Button
Friend WithEvents btnTags As System.Windows.Forms.Button Friend WithEvents btnTags As System.Windows.Forms.Button
Friend WithEvents lblTags As System.Windows.Forms.Label Friend WithEvents lblTags As System.Windows.Forms.Label
Friend WithEvents optTag As System.Windows.Forms.RadioButton
End Class End Class
+10 -2
View File
@@ -205,8 +205,16 @@ Public Class frmGameManager
Dim oRestoreData As New SortedList Dim oRestoreData As New SortedList
Dim oGame As clsGame Dim oGame As clsGame
Dim oBackup As clsBackup Dim oBackup As clsBackup
Dim frm As frmFilter
Dim oFilters As New List(Of clsTag)
AppData = mgrMonitorList.ReadList(mgrMonitorList.eListTypes.ListByKey) If optTag.Checked Then
frm = New frmFilter
frm.ShowDialog()
oFilters = frm.Filters
End If
AppData = mgrMonitorList.ReadFilteredList(oFilters)
If optPendingRestores.Checked Then If optPendingRestores.Checked Then
oRestoreData = mgrRestore.CompareManifests oRestoreData = mgrRestore.CompareManifests
@@ -1182,7 +1190,7 @@ Public Class frmGameManager
TriggerSelectedRestore() TriggerSelectedRestore()
End Sub End Sub
Private Sub optGamesFilter_CheckedChanged(sender As Object, e As EventArgs) Handles optPendingRestores.CheckedChanged, optAllGames.CheckedChanged Private Sub optGamesFilter_Click(sender As Object, e As EventArgs) Handles optPendingRestores.Click, optAllGames.Click, optBackupData.Click, optTag.Click
lstGames.ClearSelected() lstGames.ClearSelected()
eCurrentMode = eModes.Disabled eCurrentMode = eModes.Disabled
ModeChange() ModeChange()
+5 -2
View File
@@ -542,7 +542,10 @@ Public Class frmMain
Private Sub OpenTags() Private Sub OpenTags()
Dim frm As New frmTags Dim frm As New frmTags
PauseScan()
frm.ShowDialog() frm.ShowDialog()
If oSettings.Sync Then mgrMonitorList.SyncMonitorLists()
ResumeScan()
End Sub End Sub
Private Sub OpenGameManager(Optional ByVal bPendingRestores As Boolean = False) Private Sub OpenGameManager(Optional ByVal bPendingRestores As Boolean = False)
@@ -555,7 +558,7 @@ Public Class frmMain
If oSettings.Sync Then mgrMonitorList.SyncMonitorLists() If oSettings.Sync Then mgrMonitorList.SyncMonitorLists()
ResumeScan() ResumeScan()
'Handle manual backup trigger 'Handle backup trigger
If frm.TriggerBackup Then If frm.TriggerBackup Then
RunManualBackup(frm.BackupList) RunManualBackup(frm.BackupList)
End If End If
@@ -1128,7 +1131,7 @@ Public Class frmMain
If slItems.Count > 0 Then If slItems.Count > 0 Then
For Each oItem As clsBackup In slItems.Values For Each oItem As clsBackup In slItems.Values
UpdateLog("[Sync Notifier] " & oItem.Name & " entry removed from local manfiest.", False) UpdateLog(oItem.Name & " entry removed from local manfiest.", False)
Next Next
MsgBox(slItems.Count & " entries removed from the local manifest.") MsgBox(slItems.Count & " entries removed from the local manifest.")
Else Else
+9
View File
@@ -126,6 +126,12 @@
<Compile Include="Forms\frmAdvancedImport.vb"> <Compile Include="Forms\frmAdvancedImport.vb">
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>
<Compile Include="Forms\frmFilter.Designer.vb">
<DependentUpon>frmFilter.vb</DependentUpon>
</Compile>
<Compile Include="Forms\frmFilter.vb">
<SubType>Form</SubType>
</Compile>
<Compile Include="Forms\frmGameManager.Designer.vb"> <Compile Include="Forms\frmGameManager.Designer.vb">
<DependentUpon>frmGameManager.vb</DependentUpon> <DependentUpon>frmGameManager.vb</DependentUpon>
</Compile> </Compile>
@@ -221,6 +227,9 @@
<EmbeddedResource Include="Forms\frmAdvancedImport.resx"> <EmbeddedResource Include="Forms\frmAdvancedImport.resx">
<DependentUpon>frmAdvancedImport.vb</DependentUpon> <DependentUpon>frmAdvancedImport.vb</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Include="Forms\frmFilter.resx">
<DependentUpon>frmFilter.vb</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Forms\frmGameManager.resx"> <EmbeddedResource Include="Forms\frmGameManager.resx">
<DependentUpon>frmGameManager.vb</DependentUpon> <DependentUpon>frmGameManager.vb</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
+80 -13
View File
@@ -5,7 +5,6 @@ Public Class mgrMonitorList
Public Enum eListTypes As Integer Public Enum eListTypes As Integer
FullList = 1 FullList = 1
ScanList = 2 ScanList = 2
ListByKey = 3
End Enum End Enum
Public Shared Event UpdateLog(sLogUpdate As String, bTrayUpdate As Boolean, objIcon As System.Windows.Forms.ToolTipIcon, bTimeStamp As Boolean) Public Shared Event UpdateLog(sLogUpdate As String, bTrayUpdate As Boolean, objIcon As System.Windows.Forms.ToolTipIcon, bTimeStamp As Boolean)
@@ -40,16 +39,17 @@ Public Class mgrMonitorList
End Sub End Sub
Public Shared Sub ExportMonitorList(ByVal sLocation As String) Public Shared Sub ExportMonitorList(ByVal sLocation As String)
'Dim hshList As Hashtable = ReadList(eListTypes.FullList, mgrSQLite.Database.Local) Dim frm As New frmFilter
'Dim bSuccess As Boolean Dim oList As List(Of Game)
'bSuccess = mgrXML.ExportMonitorList(hshList, sLocation) Dim bSuccess As Boolean = False
frm.ShowDialog()
oList = ReadListForExport(frm.Filters)
Dim oList As List(Of Game) = ReadListForExport()
Dim bSuccess As Boolean
bSuccess = mgrXML.SerializeAndExport(oList, sLocation) bSuccess = mgrXML.SerializeAndExport(oList, sLocation)
If bSuccess Then If bSuccess Then
MsgBox("Export Complete. " & oList.Count & " entries have been exported.", MsgBoxStyle.Information, "Game Backup Monitor") MsgBox("Export Complete. " & oList.Count & " item(s) have been exported.", MsgBoxStyle.Information, "Game Backup Monitor")
End If End If
End Sub End Sub
@@ -255,6 +255,59 @@ Public Class mgrMonitorList
Return True Return True
End Function End Function
Public Shared Function ReadFilteredList(ByVal oFilters As List(Of clsTag), Optional ByVal iSelectDB As mgrSQLite.Database = mgrSQLite.Database.Local) As Hashtable
Dim oDatabase As New mgrSQLite(iSelectDB)
Dim oData As DataSet
Dim sSQL As String
Dim hshList As New Hashtable
Dim oGame As clsGame
Dim hshParams As New Hashtable
Dim iCounter As Integer = 0
If oFilters.Count > 0 Then
sSQL = "SELECT DISTINCT MonitorID, Name, Process, Path, AbsolutePath, FolderSave, FileType, TimeStamp, ExcludeList, ProcessPath, Icon, Hours, Version, Company, Enabled, MonitorOnly FROM monitorlist "
sSQL &= "NATURAL JOIN gametags WHERE gametags.TagID IN ("
For Each oTag As clsTag In oFilters
sSQL &= "@TagID" & iCounter & ","
hshParams.Add("TagID" & iCounter, oTag.ID)
iCounter += 1
Next
sSQL = sSQL.TrimEnd(",")
sSQL &= ") ORDER BY Name Asc"
Else
sSQL = "SELECT MonitorID, Name, Process, Path, AbsolutePath, FolderSave, FileType, TimeStamp, ExcludeList, ProcessPath, Icon, Hours, Version, Company, Enabled, MonitorOnly FROM monitorlist ORDER BY Name Asc"
End If
oData = oDatabase.ReadParamData(sSQL, hshParams)
For Each dr As DataRow In oData.Tables(0).Rows
oGame = New clsGame
oGame.ID = CStr(dr(0))
oGame.Name = CStr(dr(1))
oGame.ProcessName = CStr(dr(2))
If Not IsDBNull(dr(3)) Then oGame.Path = CStr(dr(3))
oGame.AbsolutePath = CBool(dr(4))
oGame.FolderSave = CBool(dr(5))
If Not IsDBNull(dr(6)) Then oGame.FileType = CStr(dr(6))
oGame.AppendTimeStamp = CBool(dr(7))
If Not IsDBNull(dr(8)) Then oGame.ExcludeList = CStr(dr(8))
If Not IsDBNull(dr(9)) Then oGame.ProcessPath = CStr(dr(9))
If Not IsDBNull(dr(10)) Then oGame.Icon = CStr(dr(10))
oGame.Hours = CDbl(dr(11))
If Not IsDBNull(dr(12)) Then oGame.Version = CStr(dr(12))
If Not IsDBNull(dr(13)) Then oGame.Company = CStr(dr(13))
oGame.Enabled = CBool(dr(14))
oGame.MonitorOnly = CBool(dr(15))
hshList.Add(oGame.ID, oGame)
Next
Return hshList
End Function
Public Shared Function ReadList(ByVal eListType As eListTypes, Optional ByVal iSelectDB As mgrSQLite.Database = mgrSQLite.Database.Local) As Hashtable Public Shared Function ReadList(ByVal eListType As eListTypes, Optional ByVal iSelectDB As mgrSQLite.Database = mgrSQLite.Database.Local) As Hashtable
Dim oDatabase As New mgrSQLite(iSelectDB) Dim oDatabase As New mgrSQLite(iSelectDB)
Dim oData As DataSet Dim oData As DataSet
@@ -310,24 +363,38 @@ Public Class mgrMonitorList
End If End If
If oGame.Enabled Then hshList.Add(oGame.ProcessName, oGame) If oGame.Enabled Then hshList.Add(oGame.ProcessName, oGame)
Case eListTypes.ListByKey
hshList.Add(oGame.ID, oGame)
End Select End Select
Next Next
Return hshList Return hshList
End Function End Function
Public Shared Function ReadListForExport(Optional ByVal iSelectDB As mgrSQLite.Database = mgrSQLite.Database.Local) As List(Of Game) Public Shared Function ReadListForExport(ByVal oFilters As List(Of clsTag), Optional ByVal iSelectDB As mgrSQLite.Database = mgrSQLite.Database.Local) As List(Of Game)
Dim oDatabase As New mgrSQLite(iSelectDB) Dim oDatabase As New mgrSQLite(iSelectDB)
Dim oData As DataSet Dim oData As DataSet
Dim sSQL As String Dim sSQL As String
Dim sID As String Dim sID As String
Dim oList As New List(Of Game) Dim oList As New List(Of Game)
Dim oGame As Game Dim oGame As Game
Dim hshParams As New Hashtable
Dim iCounter As Integer = 0
sSQL = "SELECT * from monitorlist ORDER BY Name Asc" If oFilters.Count > 0 Then
oData = oDatabase.ReadParamData(sSQL, New Hashtable) sSQL = "SELECT DISTINCT MonitorID, Name, Process, Path, AbsolutePath, FolderSave, FileType, ExcludeList FROM monitorlist NATURAL JOIN gametags WHERE gametags.TagID IN ("
For Each oTag As clsTag In oFilters
sSQL &= "@TagID" & iCounter & ","
hshParams.Add("TagID" & iCounter, oTag.ID)
iCounter += 1
Next
sSQL = sSQL.TrimEnd(",")
sSQL &= ") ORDER BY Name Asc"
Else
sSQL = "SELECT MonitorID, Name, Process, Path, AbsolutePath, FolderSave, FileType, ExcludeList from monitorlist ORDER BY Name Asc"
End If
oData = oDatabase.ReadParamData(sSQL, hshParams)
For Each dr As DataRow In oData.Tables(0).Rows For Each dr As DataRow In oData.Tables(0).Rows
oGame = New Game oGame = New Game
@@ -338,7 +405,7 @@ Public Class mgrMonitorList
oGame.AbsolutePath = CBool(dr(4)) oGame.AbsolutePath = CBool(dr(4))
oGame.FolderSave = CBool(dr(5)) oGame.FolderSave = CBool(dr(5))
If Not IsDBNull(dr(6)) Then oGame.FileType = CStr(dr(6)) If Not IsDBNull(dr(6)) Then oGame.FileType = CStr(dr(6))
If Not IsDBNull(dr(8)) Then oGame.ExcludeList = CStr(dr(8)) If Not IsDBNull(dr(7)) Then oGame.ExcludeList = CStr(dr(7))
oGame.Tags = mgrGameTags.GetTagsByGameForExport(sID) oGame.Tags = mgrGameTags.GetTagsByGameForExport(sID)
oList.Add(oGame) oList.Add(oGame)
Next Next
+1 -1
View File
@@ -164,7 +164,7 @@
Dim hshParams As Hashtable Dim hshParams As Hashtable
Dim oParamList As New List(Of Hashtable) Dim oParamList As New List(Of Hashtable)
sSQL = "INSERT OR REPLACE INTO tags VALUES (COALESCE((SELECT TagID FROM tags WHERE Name = @Name), @ID), @Name);" sSQL = "INSERT OR REPLACE INTO tags VALUES (@ID, @Name);"
For Each oTag As clsTag In hshTags.Values For Each oTag As clsTag In hshTags.Values
hshParams = New Hashtable hshParams = New Hashtable
+2
View File
@@ -83,6 +83,8 @@ Public Class mgrXML
oSerializer = New XmlSerializer(oList.GetType(), New XmlRootAttribute("gbm")) oSerializer = New XmlSerializer(oList.GetType(), New XmlRootAttribute("gbm"))
oWriter = New StreamWriter(sLocation) oWriter = New StreamWriter(sLocation)
oSerializer.Serialize(oWriter.BaseStream, oList) oSerializer.Serialize(oWriter.BaseStream, oList)
oWriter.Flush()
oWriter.Close()
Return True Return True
Catch ex As Exception Catch ex As Exception
MsgBox("An error occured exporting the XML data." & vbCrLf & vbCrLf & ex.Message, MsgBoxStyle.Exclamation, "Game Backup Monitor") MsgBox("An error occured exporting the XML data." & vbCrLf & vbCrLf & ex.Message, MsgBoxStyle.Exclamation, "Game Backup Monitor")