Add tagging support for games

This commit is contained in:
Michael J. Seiferling
2015-11-13 17:59:27 -06:00
parent 5e5da3c068
commit 5357fb214d
18 changed files with 1452 additions and 27 deletions
+23
View File
@@ -0,0 +1,23 @@
Public Class clsGameTag
Private sTagID As String = String.Empty
Private sMonitorID As String = String.Empty
Property TagID As String
Get
Return sTagID
End Get
Set(value As String)
sTagID = value
End Set
End Property
Property MonitorID As String
Get
Return sMonitorID
End Get
Set(value As String)
sMonitorID = value
End Set
End Property
End Class
+23
View File
@@ -0,0 +1,23 @@
Public Class clsTag
Private sTagID As String = Guid.NewGuid.ToString
Private sTagName As String = String.Empty
Property ID As String
Get
Return sTagID
End Get
Set(value As String)
sTagID = value
End Set
End Property
Property Name As String
Get
Return sTagName
End Get
Set(value As String)
sTagName = value
End Set
End Property
End Class
+36 -10
View File
@@ -44,6 +44,8 @@ Partial Class frmGameManager
Me.txtName = New System.Windows.Forms.TextBox() Me.txtName = New System.Windows.Forms.TextBox()
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.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()
@@ -90,7 +92,7 @@ Partial Class frmGameManager
' '
Me.btnAdd.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles) Me.btnAdd.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles)
Me.btnAdd.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.btnAdd.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.btnAdd.Location = New System.Drawing.Point(12, 528) Me.btnAdd.Location = New System.Drawing.Point(12, 527)
Me.btnAdd.Name = "btnAdd" Me.btnAdd.Name = "btnAdd"
Me.btnAdd.Size = New System.Drawing.Size(30, 23) Me.btnAdd.Size = New System.Drawing.Size(30, 23)
Me.btnAdd.TabIndex = 2 Me.btnAdd.TabIndex = 2
@@ -101,7 +103,7 @@ Partial Class frmGameManager
' '
Me.btnDelete.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles) Me.btnDelete.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles)
Me.btnDelete.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.btnDelete.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.btnDelete.Location = New System.Drawing.Point(48, 528) Me.btnDelete.Location = New System.Drawing.Point(48, 527)
Me.btnDelete.Name = "btnDelete" Me.btnDelete.Name = "btnDelete"
Me.btnDelete.Size = New System.Drawing.Size(30, 23) Me.btnDelete.Size = New System.Drawing.Size(30, 23)
Me.btnDelete.TabIndex = 3 Me.btnDelete.TabIndex = 3
@@ -111,7 +113,7 @@ Partial Class frmGameManager
'btnBackup 'btnBackup
' '
Me.btnBackup.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) Me.btnBackup.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.btnBackup.Location = New System.Drawing.Point(616, 527) Me.btnBackup.Location = New System.Drawing.Point(616, 526)
Me.btnBackup.Name = "btnBackup" Me.btnBackup.Name = "btnBackup"
Me.btnBackup.Size = New System.Drawing.Size(75, 23) Me.btnBackup.Size = New System.Drawing.Size(75, 23)
Me.btnBackup.TabIndex = 13 Me.btnBackup.TabIndex = 13
@@ -121,7 +123,7 @@ Partial Class frmGameManager
'btnClose 'btnClose
' '
Me.btnClose.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) Me.btnClose.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.btnClose.Location = New System.Drawing.Point(697, 527) Me.btnClose.Location = New System.Drawing.Point(697, 526)
Me.btnClose.Name = "btnClose" Me.btnClose.Name = "btnClose"
Me.btnClose.Size = New System.Drawing.Size(75, 23) Me.btnClose.Size = New System.Drawing.Size(75, 23)
Me.btnClose.TabIndex = 14 Me.btnClose.TabIndex = 14
@@ -295,6 +297,7 @@ Partial Class frmGameManager
'grpExtra 'grpExtra
' '
Me.grpExtra.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) Me.grpExtra.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.grpExtra.Controls.Add(Me.lblTags)
Me.grpExtra.Controls.Add(Me.btnIconBrowse) Me.grpExtra.Controls.Add(Me.btnIconBrowse)
Me.grpExtra.Controls.Add(Me.txtIcon) Me.grpExtra.Controls.Add(Me.txtIcon)
Me.grpExtra.Controls.Add(Me.lblVersion) Me.grpExtra.Controls.Add(Me.lblVersion)
@@ -313,7 +316,27 @@ Partial Class frmGameManager
Me.grpExtra.Size = New System.Drawing.Size(534, 155) Me.grpExtra.Size = New System.Drawing.Size(534, 155)
Me.grpExtra.TabIndex = 5 Me.grpExtra.TabIndex = 5
Me.grpExtra.TabStop = False Me.grpExtra.TabStop = False
Me.grpExtra.Text = "Extra Information" Me.grpExtra.Text = "Game Information"
'
'lblTags
'
Me.lblTags.AutoEllipsis = True
Me.lblTags.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.lblTags.Location = New System.Drawing.Point(163, 124)
Me.lblTags.Name = "lblTags"
Me.lblTags.Size = New System.Drawing.Size(311, 20)
Me.lblTags.TabIndex = 0
Me.lblTags.Text = "#Tags"
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
' '
@@ -543,7 +566,7 @@ Partial Class frmGameManager
'btnMarkAsRestored 'btnMarkAsRestored
' '
Me.btnMarkAsRestored.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) Me.btnMarkAsRestored.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.btnMarkAsRestored.Location = New System.Drawing.Point(429, 527) Me.btnMarkAsRestored.Location = New System.Drawing.Point(429, 526)
Me.btnMarkAsRestored.Name = "btnMarkAsRestored" Me.btnMarkAsRestored.Name = "btnMarkAsRestored"
Me.btnMarkAsRestored.Size = New System.Drawing.Size(100, 23) Me.btnMarkAsRestored.Size = New System.Drawing.Size(100, 23)
Me.btnMarkAsRestored.TabIndex = 11 Me.btnMarkAsRestored.TabIndex = 11
@@ -553,7 +576,7 @@ Partial Class frmGameManager
'btnRestore 'btnRestore
' '
Me.btnRestore.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) Me.btnRestore.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.btnRestore.Location = New System.Drawing.Point(535, 527) Me.btnRestore.Location = New System.Drawing.Point(535, 526)
Me.btnRestore.Name = "btnRestore" Me.btnRestore.Name = "btnRestore"
Me.btnRestore.Size = New System.Drawing.Size(75, 23) Me.btnRestore.Size = New System.Drawing.Size(75, 23)
Me.btnRestore.TabIndex = 12 Me.btnRestore.TabIndex = 12
@@ -563,7 +586,7 @@ Partial Class frmGameManager
'btnSave 'btnSave
' '
Me.btnSave.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) Me.btnSave.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.btnSave.Location = New System.Drawing.Point(616, 361) Me.btnSave.Location = New System.Drawing.Point(616, 360)
Me.btnSave.Name = "btnSave" Me.btnSave.Name = "btnSave"
Me.btnSave.Size = New System.Drawing.Size(75, 23) Me.btnSave.Size = New System.Drawing.Size(75, 23)
Me.btnSave.TabIndex = 8 Me.btnSave.TabIndex = 8
@@ -583,7 +606,7 @@ Partial Class frmGameManager
'btnCancel 'btnCancel
' '
Me.btnCancel.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) Me.btnCancel.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.btnCancel.Location = New System.Drawing.Point(697, 361) Me.btnCancel.Location = New System.Drawing.Point(697, 360)
Me.btnCancel.Name = "btnCancel" Me.btnCancel.Name = "btnCancel"
Me.btnCancel.Size = New System.Drawing.Size(75, 23) Me.btnCancel.Size = New System.Drawing.Size(75, 23)
Me.btnCancel.TabIndex = 9 Me.btnCancel.TabIndex = 9
@@ -649,8 +672,9 @@ Partial Class frmGameManager
' '
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(784, 562) Me.ClientSize = New System.Drawing.Size(784, 561)
Me.Controls.Add(Me.grpFilter) Me.Controls.Add(Me.grpFilter)
Me.Controls.Add(Me.btnTags)
Me.Controls.Add(Me.chkEnabled) Me.Controls.Add(Me.chkEnabled)
Me.Controls.Add(Me.btnCancel) Me.Controls.Add(Me.btnCancel)
Me.Controls.Add(Me.chkMonitorOnly) Me.Controls.Add(Me.chkMonitorOnly)
@@ -742,4 +766,6 @@ Partial Class frmGameManager
Friend WithEvents optAllGames As System.Windows.Forms.RadioButton Friend WithEvents optAllGames As System.Windows.Forms.RadioButton
Friend WithEvents optBackupData As System.Windows.Forms.RadioButton Friend WithEvents optBackupData As System.Windows.Forms.RadioButton
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 lblTags As System.Windows.Forms.Label
End Class End Class
+50
View File
@@ -420,6 +420,22 @@ Public Class frmGameManager
End Sub End Sub
Private Sub OpenTags()
Dim frm As New frmGameTags
Dim oApp As clsGame
Dim sMonitorIDs As New List(Of String)
For Each oData In lstGames.SelectedItems
oApp = DirectCast(AppData(oData.Key), clsGame)
sMonitorIDs.Add(oApp.ID)
Next
frm.IDList = sMonitorIDs
frm.GameName = CurrentGame.Name
frm.ShowDialog()
FillTags(CurrentGame.ID)
End Sub
Private Sub GetBackupInfo(ByVal oApp As clsGame) Private Sub GetBackupInfo(ByVal oApp As clsGame)
Dim oBackupInfo As clsBackup Dim oBackupInfo As clsBackup
Dim sFileName As String Dim sFileName As String
@@ -550,6 +566,8 @@ Public Class frmGameManager
txtVersion.Text = oApp.Version txtVersion.Text = oApp.Version
txtIcon.Text = oApp.Icon txtIcon.Text = oApp.Icon
FillTags(oData.Key)
'Icon 'Icon
If IO.File.Exists(oApp.Icon) Then If IO.File.Exists(oApp.Icon) Then
pbIcon.Image = Image.FromFile(oApp.Icon) pbIcon.Image = Image.FromFile(oApp.Icon)
@@ -573,6 +591,22 @@ Public Class frmGameManager
IsLoading = False IsLoading = False
End Sub End Sub
Private Sub FillTags(ByVal sID As String)
Dim hshTags As Hashtable
Dim oTag As clsTag
Dim sTags As String = String.Empty
Dim cTrim() As Char = {",", " "}
hshTags = mgrGameTags.GetTagsByGame(sID)
For Each de As DictionaryEntry In hshTags
oTag = DirectCast(de.Value, clsTag)
sTags &= "#" & oTag.Name & ", "
Next
lblTags.Text = sTags.TrimEnd(cTrim)
End Sub
Private Sub DirtyCheck_ValueChanged(sender As Object, e As EventArgs) Private Sub DirtyCheck_ValueChanged(sender As Object, e As EventArgs)
If Not IsLoading And Not eCurrentMode = eModes.MultiSelect Then If Not IsLoading And Not eCurrentMode = eModes.MultiSelect Then
IsDirty = True IsDirty = True
@@ -639,6 +673,8 @@ Public Class frmGameManager
lblSync.Visible = False lblSync.Visible = False
chkEnabled.Checked = True chkEnabled.Checked = True
chkMonitorOnly.Checked = False chkMonitorOnly.Checked = False
btnTags.Enabled = False
lblTags.Visible = False
Case eModes.Edit Case eModes.Edit
grpFilter.Enabled = False grpFilter.Enabled = False
lstGames.Enabled = False lstGames.Enabled = False
@@ -657,6 +693,8 @@ Public Class frmGameManager
btnDeleteBackup.Enabled = False btnDeleteBackup.Enabled = False
btnOpenBackupFile.Enabled = False btnOpenBackupFile.Enabled = False
btnOpenRestorePath.Enabled = False btnOpenRestorePath.Enabled = False
btnTags.Enabled = True
lblTags.Visible = True
Case eModes.View Case eModes.View
grpFilter.Enabled = True grpFilter.Enabled = True
lstGames.Enabled = True lstGames.Enabled = True
@@ -670,6 +708,8 @@ Public Class frmGameManager
btnAdd.Enabled = True btnAdd.Enabled = True
btnDelete.Enabled = True btnDelete.Enabled = True
btnBackup.Enabled = True btnBackup.Enabled = True
btnTags.Enabled = True
lblTags.Visible = True
Case eModes.ViewTemp Case eModes.ViewTemp
grpFilter.Enabled = True grpFilter.Enabled = True
lstGames.Enabled = True lstGames.Enabled = True
@@ -683,6 +723,8 @@ Public Class frmGameManager
btnAdd.Enabled = True btnAdd.Enabled = True
btnDelete.Enabled = False btnDelete.Enabled = False
btnBackup.Enabled = False btnBackup.Enabled = False
btnTags.Enabled = False
lblTags.Visible = False
Case eModes.Disabled Case eModes.Disabled
grpFilter.Enabled = True grpFilter.Enabled = True
lstGames.Enabled = True lstGames.Enabled = True
@@ -690,6 +732,7 @@ Public Class frmGameManager
WipeControls(grpExtra.Controls) WipeControls(grpExtra.Controls)
WipeControls(grpStats.Controls) WipeControls(grpStats.Controls)
pbIcon.Image = My.Resources.Unknown pbIcon.Image = My.Resources.Unknown
lblTags.Text = String.Empty
lblSync.Visible = False lblSync.Visible = False
btnSave.Enabled = False btnSave.Enabled = False
btnCancel.Enabled = False btnCancel.Enabled = False
@@ -703,6 +746,7 @@ Public Class frmGameManager
btnBackup.Enabled = False btnBackup.Enabled = False
btnRestore.Enabled = False btnRestore.Enabled = False
btnMarkAsRestored.Enabled = False btnMarkAsRestored.Enabled = False
btnTags.Enabled = False
Case eModes.MultiSelect Case eModes.MultiSelect
lstGames.Enabled = True lstGames.Enabled = True
WipeControls(grpConfig.Controls) WipeControls(grpConfig.Controls)
@@ -724,6 +768,7 @@ Public Class frmGameManager
btnBackup.Enabled = True btnBackup.Enabled = True
btnRestore.Enabled = True btnRestore.Enabled = True
btnMarkAsRestored.Enabled = True btnMarkAsRestored.Enabled = True
btnTags.Enabled = True
End Select End Select
IsLoading = False IsLoading = False
@@ -1121,6 +1166,10 @@ Public Class frmGameManager
OpenRestorePath() OpenRestorePath()
End Sub End Sub
Private Sub btnTags_Click(sender As Object, e As EventArgs) Handles btnTags.Click
OpenTags()
End Sub
Private Sub btnDeleteBackup_Click(sender As Object, e As EventArgs) Handles btnDeleteBackup.Click Private Sub btnDeleteBackup_Click(sender As Object, e As EventArgs) Handles btnDeleteBackup.Click
DeleteBackup() DeleteBackup()
End Sub End Sub
@@ -1140,4 +1189,5 @@ Public Class frmGameManager
LoadData() LoadData()
End Sub End Sub
End Class End Class
+138
View File
@@ -0,0 +1,138 @@
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class frmGameTags
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.lstTags = New System.Windows.Forms.ListBox()
Me.lstGameTags = New System.Windows.Forms.ListBox()
Me.btnAdd = New System.Windows.Forms.Button()
Me.btnRemove = New System.Windows.Forms.Button()
Me.lblTags = New System.Windows.Forms.Label()
Me.lblGameTags = New System.Windows.Forms.Label()
Me.btnClose = New System.Windows.Forms.Button()
Me.btnOpenTags = New System.Windows.Forms.Button()
Me.SuspendLayout()
'
'lstTags
'
Me.lstTags.FormattingEnabled = True
Me.lstTags.Location = New System.Drawing.Point(12, 25)
Me.lstTags.Name = "lstTags"
Me.lstTags.SelectionMode = System.Windows.Forms.SelectionMode.MultiExtended
Me.lstTags.Size = New System.Drawing.Size(150, 199)
Me.lstTags.TabIndex = 0
'
'lstGameTags
'
Me.lstGameTags.FormattingEnabled = True
Me.lstGameTags.Location = New System.Drawing.Point(222, 25)
Me.lstGameTags.Name = "lstGameTags"
Me.lstGameTags.SelectionMode = System.Windows.Forms.SelectionMode.MultiExtended
Me.lstGameTags.Size = New System.Drawing.Size(150, 199)
Me.lstGameTags.TabIndex = 3
'
'btnAdd
'
Me.btnAdd.Location = New System.Drawing.Point(168, 86)
Me.btnAdd.Name = "btnAdd"
Me.btnAdd.Size = New System.Drawing.Size(48, 23)
Me.btnAdd.TabIndex = 1
Me.btnAdd.Text = "> >"
Me.btnAdd.UseVisualStyleBackColor = True
'
'btnRemove
'
Me.btnRemove.Location = New System.Drawing.Point(168, 115)
Me.btnRemove.Name = "btnRemove"
Me.btnRemove.Size = New System.Drawing.Size(48, 23)
Me.btnRemove.TabIndex = 2
Me.btnRemove.Text = "< <"
Me.btnRemove.UseVisualStyleBackColor = True
'
'lblTags
'
Me.lblTags.AutoSize = True
Me.lblTags.Location = New System.Drawing.Point(49, 9)
Me.lblTags.Name = "lblTags"
Me.lblTags.Size = New System.Drawing.Size(77, 13)
Me.lblTags.TabIndex = 0
Me.lblTags.Text = "Available Tags"
'
'lblGameTags
'
Me.lblGameTags.AutoSize = True
Me.lblGameTags.Location = New System.Drawing.Point(263, 9)
Me.lblGameTags.Name = "lblGameTags"
Me.lblGameTags.Size = New System.Drawing.Size(68, 13)
Me.lblGameTags.TabIndex = 0
Me.lblGameTags.Text = "Current Tags"
'
'btnClose
'
Me.btnClose.Location = New System.Drawing.Point(297, 230)
Me.btnClose.Name = "btnClose"
Me.btnClose.Size = New System.Drawing.Size(75, 23)
Me.btnClose.TabIndex = 5
Me.btnClose.Text = "&Close"
Me.btnClose.UseVisualStyleBackColor = True
'
'btnOpenTags
'
Me.btnOpenTags.Location = New System.Drawing.Point(12, 230)
Me.btnOpenTags.Name = "btnOpenTags"
Me.btnOpenTags.Size = New System.Drawing.Size(90, 23)
Me.btnOpenTags.TabIndex = 4
Me.btnOpenTags.Text = "Setup &Tags..."
Me.btnOpenTags.UseVisualStyleBackColor = True
'
'frmGameTags
'
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.btnOpenTags)
Me.Controls.Add(Me.btnClose)
Me.Controls.Add(Me.lblGameTags)
Me.Controls.Add(Me.lblTags)
Me.Controls.Add(Me.btnRemove)
Me.Controls.Add(Me.btnAdd)
Me.Controls.Add(Me.lstGameTags)
Me.Controls.Add(Me.lstTags)
Me.MaximizeBox = False
Me.MinimizeBox = False
Me.Name = "frmGameTags"
Me.ShowIcon = False
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
Me.Text = "Edit Tags"
Me.ResumeLayout(False)
Me.PerformLayout()
End Sub
Friend WithEvents lstTags As System.Windows.Forms.ListBox
Friend WithEvents lstGameTags As System.Windows.Forms.ListBox
Friend WithEvents btnAdd As System.Windows.Forms.Button
Friend WithEvents btnRemove As System.Windows.Forms.Button
Friend WithEvents lblTags As System.Windows.Forms.Label
Friend WithEvents lblGameTags As System.Windows.Forms.Label
Friend WithEvents btnClose As System.Windows.Forms.Button
Friend WithEvents btnOpenTags As System.Windows.Forms.Button
End Class
+190
View File
@@ -0,0 +1,190 @@
Public Class frmGameTags
Dim sMonitorIDs As List(Of String)
Dim sGameName As String = String.Empty
Public Property IDList As List(Of String)
Get
Return sMonitorIDs
End Get
Set(value As List(Of String))
sMonitorIDs = value
End Set
End Property
Public Property GameName As String
Get
Return sGameName
End Get
Set(value As String)
sGameName = value
End Set
End Property
Private Sub AddTag()
Dim oData As KeyValuePair(Of String, String)
Dim oTags As List(Of KeyValuePair(Of String, String))
Dim oGameTag As clsGameTag
Dim oGameTags As List(Of clsGameTag)
If lstTags.SelectedItems.Count = 1 Then
oData = lstTags.SelectedItems(0)
oGameTags = New List(Of clsGameTag)
For Each sID As String In IDList
oGameTag = New clsGameTag
oGameTag.MonitorID = sID
oGameTag.TagID = oData.Key
oGameTags.Add(oGameTag)
Next
mgrGameTags.DoGameTagAddBatch(oGameTags)
lstGameTags.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
oGameTags = New List(Of clsGameTag)
For Each sID As String In IDList
oGameTag = New clsGameTag
oGameTag.MonitorID = sID
oGameTag.TagID = kp.Key
oGameTags.Add(oGameTag)
Next
mgrGameTags.DoGameTagAddBatch(oGameTags)
lstGameTags.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))
Dim oGameTag As clsGameTag
Dim oGameTags As List(Of clsGameTag)
If lstGameTags.SelectedItems.Count = 1 Then
oData = lstGameTags.SelectedItems(0)
oGameTags = New List(Of clsGameTag)
For Each sID As String In IDList
oGameTag = New clsGameTag
oGameTag.MonitorID = sID
oGameTag.TagID = oData.Key
oGameTags.Add(oGameTag)
Next
mgrGameTags.DoGameTagDelete(oGameTags)
lstGameTags.Items.Remove(oData)
lstTags.Items.Add(oData)
ElseIf lstGameTags.SelectedItems.Count > 1 Then
oTags = New List(Of KeyValuePair(Of String, String))
For Each oData In lstGameTags.SelectedItems
oTags.Add(oData)
Next
For Each kp As KeyValuePair(Of String, String) In oTags
oGameTags = New List(Of clsGameTag)
For Each sID As String In IDList
oGameTag = New clsGameTag
oGameTag.MonitorID = sID
oGameTag.TagID = kp.Key
oGameTags.Add(oGameTag)
Next
mgrGameTags.DoGameTagDelete(oGameTags)
lstGameTags.Items.Remove(kp)
lstTags.Items.Add(kp)
Next
End If
End Sub
Private Sub LoadData()
Dim hshTags As Hashtable
Dim hshGameTags As Hashtable
Dim oTag As clsTag
Dim oData As KeyValuePair(Of String, String)
'Handle Data
hshTags = mgrTags.ReadTags()
hshGameTags = mgrGameTags.GetTagsByGameMulti(IDList)
For Each de As DictionaryEntry In hshGameTags
oTag = DirectCast(de.Value, clsTag)
If hshTags.ContainsKey(oTag.Name) Then
hshTags.Remove(oTag.Name)
End If
Next
'Handle Lists
lstTags.Items.Clear()
lstGameTags.Items.Clear()
lstTags.ValueMember = "Key"
lstTags.DisplayMember = "Value"
lstGameTags.ValueMember = "Key"
lstGameTags.DisplayMember = "Value"
For Each de As DictionaryEntry In hshGameTags
oTag = DirectCast(de.Value, clsTag)
oData = New KeyValuePair(Of String, String)(oTag.ID, oTag.Name)
lstGameTags.Items.Add(oData)
Next
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 OpenTags()
Dim frm As New frmTags
frm.ShowDialog()
LoadData()
End Sub
Private Sub SetForm()
If IDList.Count > 1 Then
Me.Text = "Edit Tags for Multiple Games"
Else
Me.Text = "Edit Tags for " & GameName
End If
End Sub
Private Sub frmGameTags_Load(sender As Object, e As EventArgs) Handles MyBase.Load
LoadData()
SetForm()
End Sub
Private Sub btnClose_Click(sender As Object, e As EventArgs) Handles btnClose.Click
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 btnOpenTags_Click(sender As Object, e As EventArgs) Handles btnOpenTags.Click
OpenTags()
End Sub
End Class
+18 -2
View File
@@ -80,6 +80,8 @@ Partial Class frmMain
Me.lblTimeSpent = New System.Windows.Forms.Label() Me.lblTimeSpent = New System.Windows.Forms.Label()
Me.txtGameInfo = New System.Windows.Forms.TextBox() Me.txtGameInfo = New System.Windows.Forms.TextBox()
Me.btnCancelOperation = New System.Windows.Forms.Button() Me.btnCancelOperation = New System.Windows.Forms.Button()
Me.gMonSetupTags = New System.Windows.Forms.ToolStripMenuItem()
Me.gMonTraySetupTags = New System.Windows.Forms.ToolStripMenuItem()
Me.gMonTrayMenu.SuspendLayout() Me.gMonTrayMenu.SuspendLayout()
Me.gMonStatusStrip.SuspendLayout() Me.gMonStatusStrip.SuspendLayout()
Me.gMonMainMenu.SuspendLayout() Me.gMonMainMenu.SuspendLayout()
@@ -126,7 +128,7 @@ Partial Class frmMain
' '
'gMonTraySetup 'gMonTraySetup
' '
Me.gMonTraySetup.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.gMonTraySetupAddWizard, Me.gMonTraySetupGameManager, Me.gMonTraySetupCustomVariables}) Me.gMonTraySetup.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.gMonTraySetupAddWizard, Me.gMonTraySetupGameManager, Me.gMonTraySetupCustomVariables, Me.gMonTraySetupTags})
Me.gMonTraySetup.Name = "gMonTraySetup" Me.gMonTraySetup.Name = "gMonTraySetup"
Me.gMonTraySetup.Size = New System.Drawing.Size(161, 22) Me.gMonTraySetup.Size = New System.Drawing.Size(161, 22)
Me.gMonTraySetup.Text = "&Setup" Me.gMonTraySetup.Text = "&Setup"
@@ -309,7 +311,7 @@ Partial Class frmMain
' '
'gMonSetup 'gMonSetup
' '
Me.gMonSetup.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.gMonSetupGameManager, Me.gMonSetupAddWizard, Me.gMonSetupCustomVariables}) Me.gMonSetup.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.gMonSetupGameManager, Me.gMonSetupAddWizard, Me.gMonSetupCustomVariables, Me.gMonSetupTags})
Me.gMonSetup.Name = "gMonSetup" Me.gMonSetup.Name = "gMonSetup"
Me.gMonSetup.Size = New System.Drawing.Size(49, 20) Me.gMonSetup.Size = New System.Drawing.Size(49, 20)
Me.gMonSetup.Text = "&Setup" Me.gMonSetup.Text = "&Setup"
@@ -489,6 +491,18 @@ Partial Class frmMain
Me.btnCancelOperation.Text = "&Cancel" Me.btnCancelOperation.Text = "&Cancel"
Me.btnCancelOperation.UseVisualStyleBackColor = True Me.btnCancelOperation.UseVisualStyleBackColor = True
' '
'gMonSetupTags
'
Me.gMonSetupTags.Name = "gMonSetupTags"
Me.gMonSetupTags.Size = New System.Drawing.Size(201, 22)
Me.gMonSetupTags.Text = "&Tags..."
'
'gMonTraySetupTags
'
Me.gMonTraySetupTags.Name = "gMonTraySetupTags"
Me.gMonTraySetupTags.Size = New System.Drawing.Size(201, 22)
Me.gMonTraySetupTags.Text = "&Tags"
'
'frmMain 'frmMain
' '
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
@@ -582,4 +596,6 @@ Partial Class frmMain
Friend WithEvents gMonHelpCheckforUpdates As System.Windows.Forms.ToolStripMenuItem Friend WithEvents gMonHelpCheckforUpdates As System.Windows.Forms.ToolStripMenuItem
Friend WithEvents btnCancelOperation As System.Windows.Forms.Button Friend WithEvents btnCancelOperation As System.Windows.Forms.Button
Friend WithEvents gMonStripAdminButton As ToolStripSplitButton Friend WithEvents gMonStripAdminButton As ToolStripSplitButton
Friend WithEvents gMonTraySetupTags As System.Windows.Forms.ToolStripMenuItem
Friend WithEvents gMonSetupTags As System.Windows.Forms.ToolStripMenuItem
End Class End Class
+9
View File
@@ -540,6 +540,11 @@ Public Class frmMain
"See gpl-3.0.html in the program folder for details.", MsgBoxStyle.Information, "Game Backup Monitor") "See gpl-3.0.html in the program folder for details.", MsgBoxStyle.Information, "Game Backup Monitor")
End Sub End Sub
Private Sub OpenTags()
Dim frm As New frmTags
frm.ShowDialog()
End Sub
Private Sub OpenGameManager(Optional ByVal bPendingRestores As Boolean = False) Private Sub OpenGameManager(Optional ByVal bPendingRestores As Boolean = False)
Dim frm As New frmGameManager Dim frm As New frmGameManager
PauseScan() PauseScan()
@@ -1217,6 +1222,10 @@ Public Class frmMain
OpenCustomVariables() OpenCustomVariables()
End Sub End Sub
Private Sub gMonSetupTags_Click(sender As Object, e As EventArgs) Handles gMonSetupTags.Click, gMonTraySetupTags.Click
OpenTags()
End Sub
Private Sub gMonHelpAbout_Click(sender As Object, e As EventArgs) Handles gMonHelpAbout.Click Private Sub gMonHelpAbout_Click(sender As Object, e As EventArgs) Handles gMonHelpAbout.Click
OpenAbout() OpenAbout()
End Sub End Sub
+171
View File
@@ -0,0 +1,171 @@
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class frmTags
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.grpTag = New System.Windows.Forms.GroupBox()
Me.txtName = New System.Windows.Forms.TextBox()
Me.lblName = New System.Windows.Forms.Label()
Me.btnClose = New System.Windows.Forms.Button()
Me.btnDelete = New System.Windows.Forms.Button()
Me.btnAdd = New System.Windows.Forms.Button()
Me.lstTags = New System.Windows.Forms.ListBox()
Me.txtID = New System.Windows.Forms.TextBox()
Me.btnCancel = New System.Windows.Forms.Button()
Me.btnSave = New System.Windows.Forms.Button()
Me.grpTag.SuspendLayout()
Me.SuspendLayout()
'
'grpTag
'
Me.grpTag.Controls.Add(Me.txtName)
Me.grpTag.Controls.Add(Me.lblName)
Me.grpTag.Location = New System.Drawing.Point(238, 12)
Me.grpTag.Name = "grpTag"
Me.grpTag.Size = New System.Drawing.Size(334, 50)
Me.grpTag.TabIndex = 11
Me.grpTag.TabStop = False
Me.grpTag.Text = "Configuration"
'
'txtName
'
Me.txtName.Location = New System.Drawing.Point(50, 19)
Me.txtName.Name = "txtName"
Me.txtName.Size = New System.Drawing.Size(278, 20)
Me.txtName.TabIndex = 1
'
'lblName
'
Me.lblName.AutoSize = True
Me.lblName.Location = New System.Drawing.Point(6, 22)
Me.lblName.Name = "lblName"
Me.lblName.Size = New System.Drawing.Size(38, 13)
Me.lblName.TabIndex = 0
Me.lblName.Text = "Name:"
'
'btnClose
'
Me.btnClose.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.btnClose.Location = New System.Drawing.Point(497, 226)
Me.btnClose.Name = "btnClose"
Me.btnClose.Size = New System.Drawing.Size(75, 23)
Me.btnClose.TabIndex = 14
Me.btnClose.Text = "C&lose"
Me.btnClose.UseVisualStyleBackColor = True
'
'btnDelete
'
Me.btnDelete.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles)
Me.btnDelete.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.btnDelete.Location = New System.Drawing.Point(48, 226)
Me.btnDelete.Name = "btnDelete"
Me.btnDelete.Size = New System.Drawing.Size(30, 23)
Me.btnDelete.TabIndex = 10
Me.btnDelete.Text = "-"
Me.btnDelete.UseVisualStyleBackColor = True
'
'btnAdd
'
Me.btnAdd.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles)
Me.btnAdd.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.btnAdd.Location = New System.Drawing.Point(12, 226)
Me.btnAdd.Name = "btnAdd"
Me.btnAdd.Size = New System.Drawing.Size(30, 23)
Me.btnAdd.TabIndex = 9
Me.btnAdd.Text = "+"
Me.btnAdd.UseVisualStyleBackColor = True
'
'lstTags
'
Me.lstTags.FormattingEnabled = True
Me.lstTags.Location = New System.Drawing.Point(12, 12)
Me.lstTags.Name = "lstTags"
Me.lstTags.Size = New System.Drawing.Size(220, 212)
Me.lstTags.Sorted = True
Me.lstTags.TabIndex = 7
'
'txtID
'
Me.txtID.Enabled = False
Me.txtID.Location = New System.Drawing.Point(377, 67)
Me.txtID.Name = "txtID"
Me.txtID.Size = New System.Drawing.Size(33, 20)
Me.txtID.TabIndex = 8
Me.txtID.TabStop = False
Me.txtID.Visible = False
'
'btnCancel
'
Me.btnCancel.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.btnCancel.Location = New System.Drawing.Point(497, 67)
Me.btnCancel.Name = "btnCancel"
Me.btnCancel.Size = New System.Drawing.Size(75, 23)
Me.btnCancel.TabIndex = 13
Me.btnCancel.Text = "&Cancel"
Me.btnCancel.UseVisualStyleBackColor = True
'
'btnSave
'
Me.btnSave.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.btnSave.Location = New System.Drawing.Point(416, 67)
Me.btnSave.Name = "btnSave"
Me.btnSave.Size = New System.Drawing.Size(75, 23)
Me.btnSave.TabIndex = 12
Me.btnSave.Text = "&Save"
Me.btnSave.UseVisualStyleBackColor = True
'
'frmTags
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(584, 261)
Me.Controls.Add(Me.grpTag)
Me.Controls.Add(Me.btnClose)
Me.Controls.Add(Me.btnDelete)
Me.Controls.Add(Me.btnAdd)
Me.Controls.Add(Me.lstTags)
Me.Controls.Add(Me.txtID)
Me.Controls.Add(Me.btnCancel)
Me.Controls.Add(Me.btnSave)
Me.MaximizeBox = False
Me.MinimizeBox = False
Me.Name = "frmTags"
Me.ShowIcon = False
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
Me.Text = "Tags"
Me.grpTag.ResumeLayout(False)
Me.grpTag.PerformLayout()
Me.ResumeLayout(False)
Me.PerformLayout()
End Sub
Friend WithEvents grpTag As System.Windows.Forms.GroupBox
Friend WithEvents txtName As System.Windows.Forms.TextBox
Friend WithEvents lblName As System.Windows.Forms.Label
Friend WithEvents btnClose As System.Windows.Forms.Button
Friend WithEvents btnDelete As System.Windows.Forms.Button
Friend WithEvents btnAdd As System.Windows.Forms.Button
Friend WithEvents lstTags As System.Windows.Forms.ListBox
Friend WithEvents txtID As System.Windows.Forms.TextBox
Friend WithEvents btnCancel As System.Windows.Forms.Button
Friend WithEvents btnSave As System.Windows.Forms.Button
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>
+307
View File
@@ -0,0 +1,307 @@
Public Class frmTags
Dim hshTagData As Hashtable
Private bIsDirty As Boolean = False
Private bIsLoading As Boolean = False
Private oCurrentTag As clsTag
Private Property IsDirty As Boolean
Get
Return bIsDirty
End Get
Set(value As Boolean)
bIsDirty = value
End Set
End Property
Private Property IsLoading As Boolean
Get
Return bIsLoading
End Get
Set(value As Boolean)
bIsLoading = value
End Set
End Property
Private Enum eModes As Integer
View = 1
Edit = 2
Add = 3
Disabled = 4
End Enum
Private eCurrentMode As eModes = eModes.Disabled
Private Property TagData As Hashtable
Get
Return hshTagData
End Get
Set(value As Hashtable)
hshTagData = value
End Set
End Property
Private Sub LoadData()
TagData = mgrTags.ReadTags
lstTags.Items.Clear()
FormatAndFillList()
End Sub
Private Function HandleDirty() As MsgBoxResult
Dim oResult As MsgBoxResult
oResult = MsgBox("There are unsaved changes on this form. Do you want to save?", MsgBoxStyle.YesNoCancel, "Game Backup Monitor")
Select Case oResult
Case MsgBoxResult.Yes
IsDirty = False
Case MsgBoxResult.No
IsDirty = False
Case MsgBoxResult.Cancel
'No Change
End Select
Return oResult
End Function
Private Sub FormatAndFillList()
IsLoading = True
For Each oTag As clsTag In TagData.Values
lstTags.Items.Add(oTag.Name)
Next
IsLoading = False
End Sub
Private Sub FillData()
IsLoading = True
oCurrentTag = DirectCast(TagData(lstTags.SelectedItems(0).ToString), clsTag)
txtID.Text = oCurrentTag.ID
txtName.Text = oCurrentTag.Name
IsLoading = False
End Sub
Private Sub DirtyCheck_ValueChanged(sender As Object, e As EventArgs)
If Not IsLoading Then
IsDirty = True
If Not eCurrentMode = eModes.Add Then EditTag()
End If
End Sub
Private Sub AssignDirtyHandlers(ByVal oCtls As GroupBox.ControlCollection)
For Each ctl As Control In oCtls
If TypeOf ctl Is TextBox Then
AddHandler DirectCast(ctl, TextBox).TextChanged, AddressOf DirtyCheck_ValueChanged
End If
Next
End Sub
Private Sub WipeControls(ByVal oCtls As GroupBox.ControlCollection)
For Each ctl As Control In oCtls
If TypeOf ctl Is TextBox Then
DirectCast(ctl, TextBox).Text = String.Empty
End If
Next
txtID.Text = String.Empty
End Sub
Private Sub ModeChange()
IsLoading = True
Select Case eCurrentMode
Case eModes.Add
grpTag.Enabled = True
WipeControls(grpTag.Controls)
btnSave.Enabled = True
btnCancel.Enabled = True
btnAdd.Enabled = False
btnDelete.Enabled = False
lstTags.Enabled = False
Case eModes.Edit
lstTags.Enabled = False
grpTag.Enabled = True
btnSave.Enabled = True
btnCancel.Enabled = True
btnAdd.Enabled = False
btnDelete.Enabled = False
Case eModes.View
lstTags.Enabled = True
grpTag.Enabled = True
btnSave.Enabled = False
btnCancel.Enabled = False
btnAdd.Enabled = True
btnDelete.Enabled = True
Case eModes.Disabled
lstTags.Enabled = True
WipeControls(grpTag.Controls)
grpTag.Enabled = False
btnSave.Enabled = False
btnCancel.Enabled = False
btnAdd.Enabled = True
btnDelete.Enabled = True
End Select
IsLoading = False
End Sub
Private Sub EditTag()
eCurrentMode = eModes.Edit
ModeChange()
End Sub
Private Sub AddTag()
eCurrentMode = eModes.Add
ModeChange()
txtName.Focus()
End Sub
Private Sub CancelEdit()
If bIsDirty Then
Select Case HandleDirty()
Case MsgBoxResult.Yes
SaveTag()
Case MsgBoxResult.No
If lstTags.SelectedItems.Count > 0 Then
eCurrentMode = eModes.View
ModeChange()
FillData()
lstTags.Focus()
Else
eCurrentMode = eModes.Disabled
ModeChange()
End If
Case MsgBoxResult.Cancel
'Do Nothing
End Select
Else
If lstTags.SelectedItems.Count > 0 Then
eCurrentMode = eModes.View
ModeChange()
FillData()
lstTags.Focus()
Else
eCurrentMode = eModes.Disabled
ModeChange()
End If
End If
End Sub
Private Sub SaveTag()
Dim oTag As New clsTag
Dim bSuccess As Boolean = False
If txtID.Text <> String.Empty Then
oTag.ID = txtID.Text
End If
oTag.Name = txtName.Text
Select Case eCurrentMode
Case eModes.Add
If CoreValidatation(oTag) Then
bSuccess = True
mgrTags.DoTagAdd(oTag)
eCurrentMode = eModes.View
End If
Case eModes.Edit
If CoreValidatation(oTag) Then
bSuccess = True
mgrTags.DoTagUpdate(oTag)
eCurrentMode = eModes.View
End If
End Select
If bSuccess Then
IsDirty = False
LoadData()
ModeChange()
If eCurrentMode = eModes.View Then lstTags.SelectedIndex = lstTags.Items.IndexOf(oTag.Name)
End If
End Sub
Private Sub DeleteTag()
Dim oTag As clsTag
If lstTags.SelectedItems.Count > 0 Then
oTag = DirectCast(TagData(lstTags.SelectedItems(0).ToString), clsTag)
If MsgBox("Are you sure you want to delete " & oTag.Name & "? This cannot be undone." & vbCrLf & vbCrLf & "All games using this tag will have it removed.", MsgBoxStyle.YesNo, "Game Backup Monitor") = MsgBoxResult.Yes Then
mgrTags.DoTagDelete(oTag.ID)
LoadData()
eCurrentMode = eModes.Disabled
ModeChange()
End If
End If
End Sub
Private Sub SwitchTag()
If lstTags.SelectedItems.Count > 0 Then
eCurrentMode = eModes.View
FillData()
ModeChange()
End If
End Sub
Private Function CoreValidatation(ByVal oTag As clsTag) As Boolean
If txtName.Text = String.Empty Then
MsgBox("You must enter a valid tag name.", MsgBoxStyle.Exclamation, "Game Backup Monitor")
txtName.Focus()
Return False
End If
If mgrTags.DoCheckDuplicate(oTag.Name, oTag.ID) Then
MsgBox("A tag with this name already exists.", MsgBoxStyle.Exclamation, "Game Backup Monitor")
txtName.Focus()
Return False
End If
Return True
End Function
Private Sub frmTags_Load(sender As Object, e As EventArgs) Handles MyBase.Load
LoadData()
ModeChange()
AssignDirtyHandlers(grpTag.Controls)
End Sub
Private Sub lstTags_SelectedIndexChanged(sender As Object, e As EventArgs) Handles lstTags.SelectedIndexChanged
SwitchTag()
End Sub
Private Sub btnAdd_Click(sender As Object, e As EventArgs) Handles btnAdd.Click
AddTag()
End Sub
Private Sub btnDelete_Click(sender As Object, e As EventArgs) Handles btnDelete.Click
DeleteTag()
End Sub
Private Sub btnSave_Click(sender As Object, e As EventArgs) Handles btnSave.Click
SaveTag()
End Sub
Private Sub btnCancel_Click(sender As Object, e As EventArgs) Handles btnCancel.Click
CancelEdit()
End Sub
Private Sub btnClose_Click(sender As Object, e As EventArgs) Handles btnClose.Click
Me.Close()
End Sub
Private Sub frmTags_FormClosing(sender As Object, e As FormClosingEventArgs) Handles MyBase.FormClosing
If bIsDirty Then
Select Case HandleDirty()
Case MsgBoxResult.Yes
SaveTag()
Case MsgBoxResult.No
'Do Nothing
Case MsgBoxResult.Cancel
e.Cancel = True
End Select
End If
End Sub
End Class
+6 -6
View File
@@ -51,7 +51,7 @@ Partial Class frmVariableManager
' '
Me.btnDelete.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles) Me.btnDelete.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles)
Me.btnDelete.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.btnDelete.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.btnDelete.Location = New System.Drawing.Point(48, 227) Me.btnDelete.Location = New System.Drawing.Point(48, 226)
Me.btnDelete.Name = "btnDelete" Me.btnDelete.Name = "btnDelete"
Me.btnDelete.Size = New System.Drawing.Size(30, 23) Me.btnDelete.Size = New System.Drawing.Size(30, 23)
Me.btnDelete.TabIndex = 2 Me.btnDelete.TabIndex = 2
@@ -62,7 +62,7 @@ Partial Class frmVariableManager
' '
Me.btnAdd.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles) Me.btnAdd.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles)
Me.btnAdd.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.btnAdd.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.btnAdd.Location = New System.Drawing.Point(12, 227) Me.btnAdd.Location = New System.Drawing.Point(12, 226)
Me.btnAdd.Name = "btnAdd" Me.btnAdd.Name = "btnAdd"
Me.btnAdd.Size = New System.Drawing.Size(30, 23) Me.btnAdd.Size = New System.Drawing.Size(30, 23)
Me.btnAdd.TabIndex = 1 Me.btnAdd.TabIndex = 1
@@ -72,7 +72,7 @@ Partial Class frmVariableManager
'btnClose 'btnClose
' '
Me.btnClose.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) Me.btnClose.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.btnClose.Location = New System.Drawing.Point(497, 227) Me.btnClose.Location = New System.Drawing.Point(497, 226)
Me.btnClose.Name = "btnClose" Me.btnClose.Name = "btnClose"
Me.btnClose.Size = New System.Drawing.Size(75, 23) Me.btnClose.Size = New System.Drawing.Size(75, 23)
Me.btnClose.TabIndex = 6 Me.btnClose.TabIndex = 6
@@ -137,7 +137,7 @@ Partial Class frmVariableManager
'btnCancel 'btnCancel
' '
Me.btnCancel.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) Me.btnCancel.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.btnCancel.Location = New System.Drawing.Point(497, 95) Me.btnCancel.Location = New System.Drawing.Point(497, 94)
Me.btnCancel.Name = "btnCancel" Me.btnCancel.Name = "btnCancel"
Me.btnCancel.Size = New System.Drawing.Size(75, 23) Me.btnCancel.Size = New System.Drawing.Size(75, 23)
Me.btnCancel.TabIndex = 5 Me.btnCancel.TabIndex = 5
@@ -147,7 +147,7 @@ Partial Class frmVariableManager
'btnSave 'btnSave
' '
Me.btnSave.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) Me.btnSave.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.btnSave.Location = New System.Drawing.Point(416, 95) Me.btnSave.Location = New System.Drawing.Point(416, 94)
Me.btnSave.Name = "btnSave" Me.btnSave.Name = "btnSave"
Me.btnSave.Size = New System.Drawing.Size(75, 23) Me.btnSave.Size = New System.Drawing.Size(75, 23)
Me.btnSave.TabIndex = 4 Me.btnSave.TabIndex = 4
@@ -168,7 +168,7 @@ Partial Class frmVariableManager
' '
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(584, 262) Me.ClientSize = New System.Drawing.Size(584, 261)
Me.Controls.Add(Me.txtID) Me.Controls.Add(Me.txtID)
Me.Controls.Add(Me.btnCancel) Me.Controls.Add(Me.btnCancel)
Me.Controls.Add(Me.btnSave) Me.Controls.Add(Me.btnSave)
+22
View File
@@ -113,9 +113,11 @@
<Import Include="System.Windows.Forms" /> <Import Include="System.Windows.Forms" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Classes\clsGameTag.vb" />
<Compile Include="Classes\clsPathVariable.vb" /> <Compile Include="Classes\clsPathVariable.vb" />
<Compile Include="Classes\clsBackup.vb" /> <Compile Include="Classes\clsBackup.vb" />
<Compile Include="Classes\clsGame.vb" /> <Compile Include="Classes\clsGame.vb" />
<Compile Include="Classes\clsTag.vb" />
<Compile Include="Forms\frmAdvancedImport.Designer.vb"> <Compile Include="Forms\frmAdvancedImport.Designer.vb">
<DependentUpon>frmAdvancedImport.vb</DependentUpon> <DependentUpon>frmAdvancedImport.vb</DependentUpon>
</Compile> </Compile>
@@ -134,6 +136,12 @@
<Compile Include="Forms\frmFileFolderSearch.vb"> <Compile Include="Forms\frmFileFolderSearch.vb">
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>
<Compile Include="Forms\frmGameTags.Designer.vb">
<DependentUpon>frmGameTags.vb</DependentUpon>
</Compile>
<Compile Include="Forms\frmGameTags.vb">
<SubType>Form</SubType>
</Compile>
<Compile Include="Forms\frmStartUpWizard.Designer.vb"> <Compile Include="Forms\frmStartUpWizard.Designer.vb">
<DependentUpon>frmStartUpWizard.vb</DependentUpon> <DependentUpon>frmStartUpWizard.vb</DependentUpon>
</Compile> </Compile>
@@ -165,6 +173,12 @@
<DependentUpon>frmMain.vb</DependentUpon> <DependentUpon>frmMain.vb</DependentUpon>
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>
<Compile Include="Forms\frmTags.Designer.vb">
<DependentUpon>frmTags.vb</DependentUpon>
</Compile>
<Compile Include="Forms\frmTags.vb">
<SubType>Form</SubType>
</Compile>
<Compile Include="Forms\frmVariableManager.Designer.vb"> <Compile Include="Forms\frmVariableManager.Designer.vb">
<DependentUpon>frmVariableManager.vb</DependentUpon> <DependentUpon>frmVariableManager.vb</DependentUpon>
</Compile> </Compile>
@@ -172,6 +186,7 @@
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>
<Compile Include="Managers\mgrCommon.vb" /> <Compile Include="Managers\mgrCommon.vb" />
<Compile Include="Managers\mgrGameTags.vb" />
<Compile Include="Managers\mgrHash.vb" /> <Compile Include="Managers\mgrHash.vb" />
<Compile Include="Managers\mgrManifest.vb" /> <Compile Include="Managers\mgrManifest.vb" />
<Compile Include="Managers\mgrMonitorList.vb" /> <Compile Include="Managers\mgrMonitorList.vb" />
@@ -180,6 +195,7 @@
<Compile Include="Managers\mgrSettings.vb" /> <Compile Include="Managers\mgrSettings.vb" />
<Compile Include="Managers\mgrBackup.vb" /> <Compile Include="Managers\mgrBackup.vb" />
<Compile Include="Managers\mgrSQLite.vb" /> <Compile Include="Managers\mgrSQLite.vb" />
<Compile Include="Managers\mgrTags.vb" />
<Compile Include="Managers\mgrVariables.vb" /> <Compile Include="Managers\mgrVariables.vb" />
<Compile Include="Managers\mgrXML.vb" /> <Compile Include="Managers\mgrXML.vb" />
<Compile Include="Managers\mgrProcesses.vb" /> <Compile Include="Managers\mgrProcesses.vb" />
@@ -209,6 +225,9 @@
<EmbeddedResource Include="Forms\frmFileFolderSearch.resx"> <EmbeddedResource Include="Forms\frmFileFolderSearch.resx">
<DependentUpon>frmFileFolderSearch.vb</DependentUpon> <DependentUpon>frmFileFolderSearch.vb</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Include="Forms\frmGameTags.resx">
<DependentUpon>frmGameTags.vb</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Forms\frmStartUpWizard.resx"> <EmbeddedResource Include="Forms\frmStartUpWizard.resx">
<DependentUpon>frmStartUpWizard.vb</DependentUpon> <DependentUpon>frmStartUpWizard.vb</DependentUpon>
<SubType>Designer</SubType> <SubType>Designer</SubType>
@@ -226,6 +245,9 @@
<DependentUpon>frmMain.vb</DependentUpon> <DependentUpon>frmMain.vb</DependentUpon>
<SubType>Designer</SubType> <SubType>Designer</SubType>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Include="Forms\frmTags.resx">
<DependentUpon>frmTags.vb</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Forms\frmVariableManager.resx"> <EmbeddedResource Include="Forms\frmVariableManager.resx">
<DependentUpon>frmVariableManager.vb</DependentUpon> <DependentUpon>frmVariableManager.vb</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
+135
View File
@@ -0,0 +1,135 @@
Public Class mgrGameTags
Public Shared Sub DoGameTagAdd(ByVal oGameTag As clsGameTag)
Dim oDatabase As New mgrSQLite(mgrSQLite.Database.Local)
Dim sSQL As String
Dim hshParams As New Hashtable
sSQL = "INSERT INTO gametags VALUES (@TagID, @MonitorID)"
hshParams.Add("TagID", oGameTag.TagID)
hshParams.Add("MonitorID", oGameTag.MonitorID)
oDatabase.RunParamQuery(sSQL, hshParams)
End Sub
Public Shared Sub DoGameTagAddBatch(ByVal oGameTags As List(Of clsGameTag))
Dim oDatabase As New mgrSQLite(mgrSQLite.Database.Local)
Dim sSQL As String
Dim hshParams As Hashtable
Dim oParamList As New List(Of Hashtable)
sSQL = "INSERT INTO gametags VALUES (@TagID, @MonitorID)"
For Each oGameTag As clsGameTag In oGameTags
hshParams = New Hashtable
hshParams.Add("TagID", oGameTag.TagID)
hshParams.Add("MonitorID", oGameTag.MonitorID)
oParamList.Add(hshParams)
Next
oDatabase.RunMassParamQuery(sSQL, oParamList)
End Sub
Public Shared Sub DoGameTagDelete(ByVal oGameTags As List(Of clsGameTag))
Dim oDatabase As New mgrSQLite(mgrSQLite.Database.Local)
Dim sSQL As String
Dim hshParams As Hashtable
Dim oParamList As New List(Of Hashtable)
sSQL = "DELETE FROM gametags "
sSQL &= "WHERE TagID = @TagID AND MonitorID = @MonitorID;"
For Each oGameTag As clsGameTag In oGameTags
hshParams = New Hashtable
hshParams.Add("TagID", oGameTag.TagID)
hshParams.Add("MonitorID", oGameTag.MonitorID)
oParamList.Add(hshParams)
Next
oDatabase.RunMassParamQuery(sSQL, oParamList)
End Sub
Public Shared Sub DoGameTagDeleteByGame(ByVal sMonitorID As String)
Dim oDatabase As New mgrSQLite(mgrSQLite.Database.Local)
Dim sSQL As String
Dim hshParams As New Hashtable
sSQL = "DELETE FROM gametags "
sSQL &= "WHERE MonitorID = @ID;"
hshParams.Add("ID", sMonitorID)
oDatabase.RunParamQuery(sSQL, hshParams)
End Sub
Public Shared Sub DoGameTagDeleteByTag(ByVal sTagID As String)
Dim oDatabase As New mgrSQLite(mgrSQLite.Database.Local)
Dim sSQL As String
Dim hshParams As New Hashtable
sSQL = "DELETE FROM gametags "
sSQL &= "WHERE TagID = @ID;"
hshParams.Add("ID", sTagID)
oDatabase.RunParamQuery(sSQL, hshParams)
End Sub
Public Shared Function GetTagsByGame(ByVal sMonitorID As String) As Hashtable
Dim oDatabase As New mgrSQLite(mgrSQLite.Database.Local)
Dim oData As DataSet
Dim sSQL As String
Dim hshList As New Hashtable
Dim hshParams As New Hashtable
Dim oTag As clsTag
sSQL = "SELECT TagID, tags.Name FROM gametags NATURAL JOIN tags WHERE MonitorID = @ID"
hshParams.Add("ID", sMonitorID)
oData = oDatabase.ReadParamData(sSQL, hshParams)
For Each dr As DataRow In oData.Tables(0).Rows
oTag = New clsTag
oTag.ID = CStr(dr(0))
oTag.Name = CStr(dr(1))
hshList.Add(oTag.Name, oTag)
Next
Return hshList
End Function
Public Shared Function GetTagsByGameMulti(ByVal sMonitorIDs As List(Of String)) As Hashtable
Dim oDatabase As New mgrSQLite(mgrSQLite.Database.Local)
Dim oData As DataSet
Dim sSQL As String
Dim hshList As New Hashtable
Dim hshParams As New Hashtable
Dim oTag As clsTag
Dim iCounter As Integer
sSQL = "SELECT DISTINCT TagID, tags.Name FROM gametags NATURAL JOIN tags WHERE MonitorID IN ("
For Each s As String In sMonitorIDs
sSQL &= "@MonitorID" & iCounter & ","
hshParams.Add("MonitorID" & iCounter, s)
iCounter += 1
Next
sSQL = sSQL.TrimEnd(",")
sSQL &= ")"
oData = oDatabase.ReadParamData(sSQL, hshParams)
For Each dr As DataRow In oData.Tables(0).Rows
oTag = New clsTag
oTag.ID = CStr(dr(0))
oTag.Name = CStr(dr(1))
hshList.Add(oTag.Name, oTag)
Next
Return hshList
End Function
End Class
+18 -4
View File
@@ -403,8 +403,10 @@ Public Class mgrMonitorList
Dim sSQL As String Dim sSQL As String
Dim hshParams As New Hashtable Dim hshParams As New Hashtable
sSQL = "DELETE FROM monitorlist " sSQL = "DELETE FROM gametags "
sSQL &= "WHERE MonitorID = @MonitorID" sSQL &= "WHERE MonitorID = @MonitorID;"
sSQL &= "DELETE FROM monitorlist "
sSQL &= "WHERE MonitorID = @MonitorID;"
hshParams.Add("MonitorID", sMonitorID) hshParams.Add("MonitorID", sMonitorID)
@@ -418,7 +420,7 @@ Public Class mgrMonitorList
Dim hshParams As New Hashtable Dim hshParams As New Hashtable
Dim iCounter As Integer Dim iCounter As Integer
sSQL = "DELETE FROM monitorlist " sSQL = "DELETE FROM gametags "
sSQL &= "WHERE MonitorID IN (" sSQL &= "WHERE MonitorID IN ("
For Each s As String In sMonitorIDs For Each s As String In sMonitorIDs
@@ -428,7 +430,19 @@ Public Class mgrMonitorList
Next Next
sSQL = sSQL.TrimEnd(",") sSQL = sSQL.TrimEnd(",")
sSQL &= ")" sSQL &= ");"
sSQL &= "DELETE FROM monitorlist "
sSQL &= "WHERE MonitorID IN ("
For Each s As String In sMonitorIDs
sSQL &= "@MonitorID" & iCounter & ","
hshParams.Add("MonitorID" & iCounter, s)
iCounter += 1
Next
sSQL = sSQL.TrimEnd(",")
sSQL &= ");"
oDatabase.RunParamQuery(sSQL, hshParams) oDatabase.RunParamQuery(sSQL, hshParams)
End Sub End Sub
+49 -2
View File
@@ -79,6 +79,12 @@ Public Class mgrSQLite
"ProcessPath TEXT, Icon TEXT, Hours REAL, Version TEXT, Company TEXT, Enabled BOOLEAN NOT NULL, MonitorOnly BOOLEAN NOT NULL, " & _ "ProcessPath TEXT, Icon TEXT, Hours REAL, Version TEXT, Company TEXT, Enabled BOOLEAN NOT NULL, MonitorOnly BOOLEAN NOT NULL, " & _
"PRIMARY KEY(Name, Process));" "PRIMARY KEY(Name, Process));"
'Add Tables (Tags)
sSql &= "CREATE TABLE tags (TagID TEXT NOT NULL UNIQUE, Name TEXT NOT NULL PRIMARY KEY); "
'Add Tables (Game Tags)
sSql &= "CREATE TABLE gametags (TagID TEXT NOT NULL, MonitorID TEXT NOT NULL, PRIMARY KEY(TagID, MonitorID)); "
'Add Tables (Variables) 'Add Tables (Variables)
sSql &= "CREATE TABLE variables (VariableID TEXT NOT NULL UNIQUE, Name TEXT NOT NULL PRIMARY KEY, Path TEXT NOT NULL);" sSql &= "CREATE TABLE variables (VariableID TEXT NOT NULL UNIQUE, Name TEXT NOT NULL PRIMARY KEY, Path TEXT NOT NULL);"
@@ -114,6 +120,12 @@ Public Class mgrSQLite
sSql &= "CREATE TABLE manifest (ManifestID TEXT NOT NULL UNIQUE, Name TEXT NOT NULL PRIMARY KEY, FileName TEXT NOT NULL, RestorePath TEXT NOT NULL, " & _ sSql &= "CREATE TABLE manifest (ManifestID TEXT NOT NULL UNIQUE, Name TEXT NOT NULL PRIMARY KEY, FileName TEXT NOT NULL, RestorePath TEXT NOT NULL, " & _
"AbsolutePath BOOLEAN NOT NULL, DateUpdated TEXT NOT NULL, UpdatedBy TEXT NOT NULL, CheckSum TEXT);" "AbsolutePath BOOLEAN NOT NULL, DateUpdated TEXT NOT NULL, UpdatedBy TEXT NOT NULL, CheckSum TEXT);"
'Add Tables (Remote Tags)
sSql &= "CREATE TABLE tags (TagID TEXT NOT NULL UNIQUE, Name TEXT NOT NULL PRIMARY KEY); "
'Add Tables (Remote Game Tags)
sSql &= "CREATE TABLE gametags (TagID TEXT NOT NULL, MonitorID TEXT NOT NULL, PRIMARY KEY(TagID, MonitorID)); "
'Set Version 'Set Version
sSql &= "PRAGMA user_version=" & mgrCommon.AppVersion sSql &= "PRAGMA user_version=" & mgrCommon.AppVersion
@@ -182,6 +194,32 @@ Public Class mgrSQLite
Return True Return True
End Function End Function
Public Function RunMassParamQuery(ByVal sSQL As String, ByVal oParamList As List(Of Hashtable)) As Boolean
Dim trans As SQLiteTransaction
Dim command As SQLiteCommand
Connect()
command = New SQLiteCommand(sSQL, db)
trans = db.BeginTransaction()
Try
For Each hshParams In oParamList
BuildParams(command, hshParams)
command.ExecuteNonQuery()
Next
trans.Commit()
Catch e As Exception
trans.Rollback()
MsgBox("An error has occured attempting run the query." & vbCrLf & vbCrLf & sSQL & vbCrLf & vbCrLf & e.Message)
Return False
Finally
command.Dispose()
Disconnect()
End Try
Return True
End Function
Public Function ReadParamData(ByVal sSQL As String, ByVal hshParams As Hashtable) As DataSet Public Function ReadParamData(ByVal sSQL As String, ByVal hshParams As Hashtable) As DataSet
Dim adapter As SQLiteDataAdapter Dim adapter As SQLiteDataAdapter
Dim command As SQLiteCommand Dim command As SQLiteCommand
@@ -417,8 +455,13 @@ Public Class mgrSQLite
'Backup DB before starting 'Backup DB before starting
BackupDB("v93") BackupDB("v93")
'Add Tags Tables
sSQL = "CREATE TABLE tags (TagID TEXT NOT NULL UNIQUE, Name TEXT NOT NULL PRIMARY KEY); "
sSQL &= "CREATE TABLE gametags (TagID TEXT NOT NULL, MonitorID TEXT NOT NULL, PRIMARY KEY(TagID, MonitorID)); "
'Add new setting 'Add new setting
sSQL = "ALTER TABLE settings ADD COLUMN TimeTracking BOOLEAN NOT NULL DEFAULT 1;" sSQL &= "ALTER TABLE settings ADD COLUMN TimeTracking BOOLEAN NOT NULL DEFAULT 1;"
sSQL &= "PRAGMA user_version=94" sSQL &= "PRAGMA user_version=94"
RunParamQuery(sSQL, New Hashtable) RunParamQuery(sSQL, New Hashtable)
@@ -427,7 +470,11 @@ Public Class mgrSQLite
'Backup DB before starting 'Backup DB before starting
BackupDB("v93") BackupDB("v93")
sSQL = "PRAGMA user_version=94" 'Add Tags Tables
sSQL = "CREATE TABLE tags (TagID TEXT NOT NULL UNIQUE, Name TEXT NOT NULL PRIMARY KEY); "
sSQL &= "CREATE TABLE gametags (TagID TEXT NOT NULL, MonitorID TEXT NOT NULL, PRIMARY KEY(TagID, MonitorID)); "
sSQL &= "PRAGMA user_version=94"
RunParamQuery(sSQL, New Hashtable) RunParamQuery(sSQL, New Hashtable)
End If End If
+136
View File
@@ -0,0 +1,136 @@
Public Class mgrTags
Public Shared Sub DoTagAdd(ByVal oTag As clsTag)
Dim oDatabase As New mgrSQLite(mgrSQLite.Database.Local)
Dim sSQL As String
Dim hshParams As New Hashtable
sSQL = "INSERT INTO tags VALUES (@ID, @Name)"
hshParams.Add("ID", oTag.ID)
hshParams.Add("Name", oTag.Name)
oDatabase.RunParamQuery(sSQL, hshParams)
End Sub
Public Shared Sub DoTagUpdate(ByVal oTag As clsTag)
Dim oDatabase As New mgrSQLite(mgrSQLite.Database.Local)
Dim sSQL As String
Dim hshParams As New Hashtable
sSQL = "UPDATE tags SET Name=@Name "
sSQL &= "WHERE TagID = @ID"
hshParams.Add("Name", oTag.Name)
hshParams.Add("ID", oTag.ID)
oDatabase.RunParamQuery(sSQL, hshParams)
End Sub
Public Shared Sub DoTagDelete(ByVal sTagID As String)
Dim oDatabase As New mgrSQLite(mgrSQLite.Database.Local)
Dim sSQL As String
Dim hshParams As New Hashtable
sSQL = "DELETE FROM gametags "
sSQL &= "WHERE TagID = @ID;"
sSQL = "DELETE FROM tags "
sSQL &= "WHERE TagID = @ID;"
hshParams.Add("ID", sTagID)
oDatabase.RunParamQuery(sSQL, hshParams)
End Sub
Public Shared Function DoTagGetbyID(ByVal sTagID As String) As clsTag
Dim oDatabase As New mgrSQLite(mgrSQLite.Database.Local)
Dim sSQL As String
Dim oData As DataSet
Dim oTag As New clsTag
Dim hshParams As New Hashtable
sSQL = "SELECT * FROM tags "
sSQL &= "WHERE TagID = @ID"
hshParams.Add("ID", sTagID)
oData = oDatabase.ReadParamData(sSQL, hshParams)
For Each dr As DataRow In oData.Tables(0).Rows
oTag = New clsTag
oTag.ID = CStr(dr(0))
oTag.Name = CStr(dr(1))
Next
Return oTag
End Function
Public Shared Function DoTagGetbyName(ByVal sTagName As String) As clsTag
Dim oDatabase As New mgrSQLite(mgrSQLite.Database.Local)
Dim sSQL As String
Dim oData As DataSet
Dim oTag As New clsTag
Dim hshParams As New Hashtable
sSQL = "SELECT * FROM tags "
sSQL &= "WHERE Name = @Name"
hshParams.Add("Name", sTagName)
oData = oDatabase.ReadParamData(sSQL, hshParams)
For Each dr As DataRow In oData.Tables(0).Rows
oTag = New clsTag
oTag.ID = CStr(dr(0))
oTag.Name = CStr(dr(1))
Next
Return oTag
End Function
Public Shared Function DoCheckDuplicate(ByVal sTagName As String, Optional ByVal sExcludeID As String = "") As Boolean
Dim oDatabase As New mgrSQLite(mgrSQLite.Database.Local)
Dim sSQL As String
Dim oData As DataSet
Dim hshParams As New Hashtable
sSQL = "SELECT * FROM tags "
sSQL &= "WHERE Name = @Name"
hshParams.Add("Name", sTagName)
If sExcludeID <> String.Empty Then
sSQL &= " AND TagID <> @TagID"
hshParams.Add("TagID", sExcludeID)
End If
oData = oDatabase.ReadParamData(sSQL, hshParams)
If oData.Tables(0).Rows.Count > 0 Then
Return True
Else
Return False
End If
End Function
Public Shared Function ReadTags() As Hashtable
Dim oDatabase As New mgrSQLite(mgrSQLite.Database.Local)
Dim oData As DataSet
Dim sSQL As String
Dim hshList As New Hashtable
Dim oTag As clsTag
sSQL = "SELECT * from tags"
oData = oDatabase.ReadParamData(sSQL, New Hashtable)
For Each dr As DataRow In oData.Tables(0).Rows
oTag = New clsTag
oTag.ID = CStr(dr(0))
oTag.Name = CStr(dr(1))
hshList.Add(oTag.Name, oTag)
Next
Return hshList
End Function
End Class
+1 -3
View File
@@ -1,6 +1,4 @@
Imports System.IO Public Class mgrVariables
Public Class mgrVariables
Public Shared Sub DoPathUpdate(ByVal sOld As String, ByVal sNew As String) Public Shared Sub DoPathUpdate(ByVal sOld As String, ByVal sNew As String)
Dim oDatabase As New mgrSQLite(mgrSQLite.Database.Local) Dim oDatabase As New mgrSQLite(mgrSQLite.Database.Local)