Manifest Re-write (Clean-up, Pass 3)

This commit is contained in:
Michael J. Seiferling
2016-08-23 10:14:12 -06:00
parent 7a93fd799b
commit 77b5efbe02
9 changed files with 520 additions and 475 deletions
+43 -14
View File
@@ -66,6 +66,8 @@ Partial Class frmAddWizard
Me.btnCancel = New System.Windows.Forms.Button() Me.btnCancel = New System.Windows.Forms.Button()
Me.btnNext = New System.Windows.Forms.Button() Me.btnNext = New System.Windows.Forms.Button()
Me.btnBack = New System.Windows.Forms.Button() Me.btnBack = New System.Windows.Forms.Button()
Me.lblLimit = New System.Windows.Forms.Label()
Me.nudLimit = New System.Windows.Forms.NumericUpDown()
Me.tabWizard.SuspendLayout() Me.tabWizard.SuspendLayout()
Me.tbPage1.SuspendLayout() Me.tbPage1.SuspendLayout()
Me.tbPage2.SuspendLayout() Me.tbPage2.SuspendLayout()
@@ -73,6 +75,7 @@ Partial Class frmAddWizard
Me.tbPage3a.SuspendLayout() Me.tbPage3a.SuspendLayout()
Me.tbPage4.SuspendLayout() Me.tbPage4.SuspendLayout()
Me.tbPage5.SuspendLayout() Me.tbPage5.SuspendLayout()
CType(Me.nudLimit, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout() Me.SuspendLayout()
' '
'tabWizard 'tabWizard
@@ -121,8 +124,8 @@ Partial Class frmAddWizard
Me.lblStep1Instructions.Name = "lblStep1Instructions" Me.lblStep1Instructions.Name = "lblStep1Instructions"
Me.lblStep1Instructions.Size = New System.Drawing.Size(303, 85) Me.lblStep1Instructions.Size = New System.Drawing.Size(303, 85)
Me.lblStep1Instructions.TabIndex = 6 Me.lblStep1Instructions.TabIndex = 6
Me.lblStep1Instructions.Text = "The name will be automatically filtered for length and invalid characters. You m" & _ Me.lblStep1Instructions.Text = "The name will be automatically filtered for length and invalid characters. You m" &
"ay drag and drop a shortcut here to complete this step, only Windows shortcuts a" & _ "ay drag and drop a shortcut here to complete this step, only Windows shortcuts a" &
"re currently supported." "re currently supported."
' '
'txtName 'txtName
@@ -205,6 +208,8 @@ Partial Class frmAddWizard
'tbPage3 'tbPage3
' '
Me.tbPage3.BackColor = System.Drawing.SystemColors.Control Me.tbPage3.BackColor = System.Drawing.SystemColors.Control
Me.tbPage3.Controls.Add(Me.lblLimit)
Me.tbPage3.Controls.Add(Me.nudLimit)
Me.tbPage3.Controls.Add(Me.lblStep3Title) Me.tbPage3.Controls.Add(Me.lblStep3Title)
Me.tbPage3.Controls.Add(Me.lblStep3Instructions) Me.tbPage3.Controls.Add(Me.lblStep3Instructions)
Me.tbPage3.Controls.Add(Me.chkTimeStamp) Me.tbPage3.Controls.Add(Me.chkTimeStamp)
@@ -230,32 +235,32 @@ Partial Class frmAddWizard
' '
'lblStep3Instructions 'lblStep3Instructions
' '
Me.lblStep3Instructions.Location = New System.Drawing.Point(14, 116) Me.lblStep3Instructions.Location = New System.Drawing.Point(14, 139)
Me.lblStep3Instructions.Name = "lblStep3Instructions" Me.lblStep3Instructions.Name = "lblStep3Instructions"
Me.lblStep3Instructions.Size = New System.Drawing.Size(303, 42) Me.lblStep3Instructions.Size = New System.Drawing.Size(303, 42)
Me.lblStep3Instructions.TabIndex = 9 Me.lblStep3Instructions.TabIndex = 9
Me.lblStep3Instructions.Text = "If you're unsure of exactly which files to backup, make sure Save Entire Folder " & _ Me.lblStep3Instructions.Text = "If you're unsure of exactly which files to backup, make sure Save entire folder " &
"is checked. You can also time stamp your backup files to make incremental backu" & _ "is checked. You can also choose to save multiple backups and set a limit on how" &
"ps." " many to keep."
' '
'chkTimeStamp 'chkTimeStamp
' '
Me.chkTimeStamp.AutoSize = True Me.chkTimeStamp.AutoSize = True
Me.chkTimeStamp.Location = New System.Drawing.Point(139, 87) Me.chkTimeStamp.Location = New System.Drawing.Point(18, 108)
Me.chkTimeStamp.Name = "chkTimeStamp" Me.chkTimeStamp.Name = "chkTimeStamp"
Me.chkTimeStamp.Size = New System.Drawing.Size(122, 17) Me.chkTimeStamp.Size = New System.Drawing.Size(133, 17)
Me.chkTimeStamp.TabIndex = 8 Me.chkTimeStamp.TabIndex = 8
Me.chkTimeStamp.Text = "Time Stamp Backup" Me.chkTimeStamp.Text = "Save multiple backups"
Me.chkTimeStamp.UseVisualStyleBackColor = True Me.chkTimeStamp.UseVisualStyleBackColor = True
' '
'chkFolderSave 'chkFolderSave
' '
Me.chkFolderSave.AutoSize = True Me.chkFolderSave.AutoSize = True
Me.chkFolderSave.Location = New System.Drawing.Point(17, 87) Me.chkFolderSave.Location = New System.Drawing.Point(18, 87)
Me.chkFolderSave.Name = "chkFolderSave" Me.chkFolderSave.Name = "chkFolderSave"
Me.chkFolderSave.Size = New System.Drawing.Size(113, 17) Me.chkFolderSave.Size = New System.Drawing.Size(109, 17)
Me.chkFolderSave.TabIndex = 7 Me.chkFolderSave.TabIndex = 7
Me.chkFolderSave.Text = "Save Entire Folder" Me.chkFolderSave.Text = "Save entire folder"
Me.chkFolderSave.UseVisualStyleBackColor = True Me.chkFolderSave.UseVisualStyleBackColor = True
' '
'btnSaveBrowse 'btnSaveBrowse
@@ -352,7 +357,7 @@ Partial Class frmAddWizard
Me.lblStep3aInstructions.Name = "lblStep3aInstructions" Me.lblStep3aInstructions.Name = "lblStep3aInstructions"
Me.lblStep3aInstructions.Size = New System.Drawing.Size(303, 56) Me.lblStep3aInstructions.Size = New System.Drawing.Size(303, 56)
Me.lblStep3aInstructions.TabIndex = 5 Me.lblStep3aInstructions.TabIndex = 5
Me.lblStep3aInstructions.Text = "Choose any file types, specific files or folders you wish to include in the back" & _ Me.lblStep3aInstructions.Text = "Choose any file types, specific files or folders you wish to include in the back" &
"up. If you're unsure, go back a step and choose to save the entire folder. " "up. If you're unsure, go back a step and choose to save the entire folder. "
' '
'txtFileTypes 'txtFileTypes
@@ -434,7 +439,7 @@ Partial Class frmAddWizard
Me.lblStep4Instructions.Name = "lblStep4Instructions" Me.lblStep4Instructions.Name = "lblStep4Instructions"
Me.lblStep4Instructions.Size = New System.Drawing.Size(303, 59) Me.lblStep4Instructions.Size = New System.Drawing.Size(303, 59)
Me.lblStep4Instructions.TabIndex = 5 Me.lblStep4Instructions.TabIndex = 5
Me.lblStep4Instructions.Text = "Choose any file types, specific files or folders you wish to exclude from the ba" & _ Me.lblStep4Instructions.Text = "Choose any file types, specific files or folders you wish to exclude from the ba" &
"ckup. You may choose multiple items to exclude. This step can be skipped." "ckup. You may choose multiple items to exclude. This step can be skipped."
' '
'txtExcludeList 'txtExcludeList
@@ -516,6 +521,27 @@ Partial Class frmAddWizard
Me.btnBack.Text = "&Back" Me.btnBack.Text = "&Back"
Me.btnBack.UseVisualStyleBackColor = True Me.btnBack.UseVisualStyleBackColor = True
' '
'lblLimit
'
Me.lblLimit.AutoSize = True
Me.lblLimit.Location = New System.Drawing.Point(203, 109)
Me.lblLimit.Name = "lblLimit"
Me.lblLimit.Size = New System.Drawing.Size(68, 13)
Me.lblLimit.TabIndex = 15
Me.lblLimit.Text = "Backup Limit"
Me.lblLimit.Visible = False
'
'nudLimit
'
Me.nudLimit.Location = New System.Drawing.Point(157, 107)
Me.nudLimit.Minimum = New Decimal(New Integer() {2, 0, 0, 0})
Me.nudLimit.Name = "nudLimit"
Me.nudLimit.Size = New System.Drawing.Size(40, 20)
Me.nudLimit.TabIndex = 14
Me.nudLimit.TextAlign = System.Windows.Forms.HorizontalAlignment.Right
Me.nudLimit.Value = New Decimal(New Integer() {2, 0, 0, 0})
Me.nudLimit.Visible = False
'
'frmAddWizard 'frmAddWizard
' '
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
@@ -545,6 +571,7 @@ Partial Class frmAddWizard
Me.tbPage4.PerformLayout() Me.tbPage4.PerformLayout()
Me.tbPage5.ResumeLayout(False) Me.tbPage5.ResumeLayout(False)
Me.tbPage5.PerformLayout() Me.tbPage5.PerformLayout()
CType(Me.nudLimit, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False) Me.ResumeLayout(False)
End Sub End Sub
@@ -591,4 +618,6 @@ Partial Class frmAddWizard
Friend WithEvents lblExcludePath As Label Friend WithEvents lblExcludePath As Label
Friend WithEvents lblIncludePathTitle As Label Friend WithEvents lblIncludePathTitle As Label
Friend WithEvents lblExcludePathTitle As Label Friend WithEvents lblExcludePathTitle As Label
Friend WithEvents lblLimit As Label
Friend WithEvents nudLimit As NumericUpDown
End Class End Class
+32 -1
View File
@@ -46,6 +46,7 @@ Public Class frmAddWizard
lblStep3Instructions.Text = frmAddWizard_lblStep3Instructions lblStep3Instructions.Text = frmAddWizard_lblStep3Instructions
chkTimeStamp.Text = frmAddWizard_chkTimeStamp chkTimeStamp.Text = frmAddWizard_chkTimeStamp
chkFolderSave.Text = frmAddWizard_chkFolderSave chkFolderSave.Text = frmAddWizard_chkFolderSave
lblLimit.Text = frmAddWizard_lblLimit
btnSaveBrowse.Text = frmAddWizard_btnSaveBrowse btnSaveBrowse.Text = frmAddWizard_btnSaveBrowse
lblStep3Intro.Text = frmAddWizard_lblStep3Intro lblStep3Intro.Text = frmAddWizard_lblStep3Intro
lblIncludePathTitle.Text = frmAddWizard_lblIncludePathTitle lblIncludePathTitle.Text = frmAddWizard_lblIncludePathTitle
@@ -68,6 +69,28 @@ Public Class frmAddWizard
StepHandler() StepHandler()
End Sub End Sub
Private Sub ShowHideLimit()
If chkTimeStamp.Checked Then
nudLimit.Visible = True
lblLimit.Visible = True
nudLimit.Value = 5
Else
nudLimit.Visible = False
nudLimit.Value = nudLimit.Minimum
lblLimit.Visible = False
End If
End Sub
Private Function ShowSummaryLimit(ByVal bTimeStamp As Boolean, ByVal iLimit As Integer) As String
Dim sLimit As String = String.Empty
If bTimeStamp Then
Return mgrCommon.BooleanYesNo(bTimeStamp) & " (" & iLimit & ")"
Else
Return mgrCommon.BooleanYesNo(bTimeStamp)
End If
End Function
Private Function StringEmptyText(ByVal sString As String) As String Private Function StringEmptyText(ByVal sString As String) As String
If sString = String.Empty Then If sString = String.Empty Then
Return frmAddWizard_None Return frmAddWizard_None
@@ -86,6 +109,7 @@ Public Class frmAddWizard
Dim bIsAbsolute As Boolean = mgrPath.IsAbsolute(sSavePath) Dim bIsAbsolute As Boolean = mgrPath.IsAbsolute(sSavePath)
Dim bFolderBackup As Boolean = chkFolderSave.Checked Dim bFolderBackup As Boolean = chkFolderSave.Checked
Dim bTimeStamp As Boolean = chkTimeStamp.Checked Dim bTimeStamp As Boolean = chkTimeStamp.Checked
Dim iLimit As Integer = nudLimit.Value
Dim sFileType As String = txtFileTypes.Text Dim sFileType As String = txtFileTypes.Text
Dim sExcludeList As String = txtExcludeList.Text Dim sExcludeList As String = txtExcludeList.Text
Dim sProcess As String Dim sProcess As String
@@ -117,7 +141,7 @@ Public Class frmAddWizard
lstSummary.Columns(1).Width = 210 lstSummary.Columns(1).Width = 210
sItems = {frmAddWizard_Summary_Name, frmAddWizard_Summary_Process, frmAddWizard_Summary_AbsolutePath, frmAddWizard_Summary_SavePath, frmAddWizard_Summary_FolderSave, frmAddWizard_Summary_Timestamp, frmAddWizard_Summary_Include, frmAddWizard_Summary_Exclude} sItems = {frmAddWizard_Summary_Name, frmAddWizard_Summary_Process, frmAddWizard_Summary_AbsolutePath, frmAddWizard_Summary_SavePath, frmAddWizard_Summary_FolderSave, frmAddWizard_Summary_Timestamp, frmAddWizard_Summary_Include, frmAddWizard_Summary_Exclude}
sValues = {sName, sProcessSummaryText, mgrCommon.BooleanYesNo(bIsAbsolute), sSavePath, mgrCommon.BooleanYesNo(bFolderBackup), mgrCommon.BooleanYesNo(bTimeStamp), StringEmptyText(sFileType), StringEmptyText(sExcludeList)} sValues = {sName, sProcessSummaryText, mgrCommon.BooleanYesNo(bIsAbsolute), sSavePath, mgrCommon.BooleanYesNo(bFolderBackup), ShowSummaryLimit(bTimeStamp, iLimit), StringEmptyText(sFileType), StringEmptyText(sExcludeList)}
For i = 0 To sItems.Length - 1 For i = 0 To sItems.Length - 1
sItem = {sItems(i), sValues(i)} sItem = {sItems(i), sValues(i)}
@@ -133,6 +157,7 @@ Public Class frmAddWizard
oGame.FolderSave = bFolderBackup oGame.FolderSave = bFolderBackup
oGame.FileType = sFileType oGame.FileType = sFileType
oGame.AppendTimeStamp = bTimeStamp oGame.AppendTimeStamp = bTimeStamp
oGame.BackupLimit = iLimit
oGame.ExcludeList = sExcludeList oGame.ExcludeList = sExcludeList
Return oGame Return oGame
@@ -501,6 +526,10 @@ Public Class frmAddWizard
txtFileTypes.Clear() txtFileTypes.Clear()
End Sub End Sub
Private Sub chkTimeStamp_CheckedChanged(sender As Object, e As EventArgs) Handles chkTimeStamp.CheckedChanged
ShowHideLimit()
End Sub
Private Sub btnInclude_Click(sender As Object, e As EventArgs) Handles btnInclude.Click Private Sub btnInclude_Click(sender As Object, e As EventArgs) Handles btnInclude.Click
OpenBuilder(frmAddWizard_Include, txtFileTypes) OpenBuilder(frmAddWizard_Include, txtFileTypes)
UpdateBuilderLabel(txtFileTypes.Text, lblFileTypes) UpdateBuilderLabel(txtFileTypes.Text, lblFileTypes)
@@ -510,4 +539,6 @@ Public Class frmAddWizard
OpenBuilder(frmAddWizard_Exclude, txtExcludeList) OpenBuilder(frmAddWizard_Exclude, txtExcludeList)
UpdateBuilderLabel(txtExcludeList.Text, lblExclude) UpdateBuilderLabel(txtExcludeList.Text, lblExclude)
End Sub End Sub
End Class End Class
+2 -1
View File
@@ -171,7 +171,7 @@ Public Class frmGameManager
'Local 'Local
If mgrManifest.DoManifestNameCheck(oOriginalApp.Name, mgrSQLite.Database.Local) Then If mgrManifest.DoManifestNameCheck(oOriginalApp.Name, mgrSQLite.Database.Local) Then
oBackupItems = mgrManifest.DoManifestGetByName(oOriginalApp.Name, mgrSQLite.Database.Local) oBackupItems = mgrManifest.DoManifestGetByName(oOriginalApp.Name, mgrSQLite.Database.Local)
'The local manifest will only have one entry per game, therefore this runs only once
For Each oBackupItem As clsBackup In oBackupItems For Each oBackupItem As clsBackup In oBackupItems
'Rename Current Backup File & Folder 'Rename Current Backup File & Folder
sFileName = BackupFolder & oBackupItem.FileName sFileName = BackupFolder & oBackupItem.FileName
@@ -1013,6 +1013,7 @@ Public Class frmGameManager
If chkTimeStamp.Checked Then If chkTimeStamp.Checked Then
nudLimit.Visible = True nudLimit.Visible = True
lblLimit.Visible = True lblLimit.Visible = True
nudLimit.Value = 5
Else Else
nudLimit.Visible = False nudLimit.Visible = False
nudLimit.Value = nudLimit.Minimum nudLimit.Value = nudLimit.Minimum
+2
View File
@@ -115,6 +115,7 @@
Return oBackupItem Return oBackupItem
End Function End Function
'This should only be used to update specific entries in the remote manifest
Public Shared Function DoSpecificManifestCheck(ByRef oItem As clsBackup, ByVal iSelectDB As mgrSQLite.Database) As Boolean Public Shared Function DoSpecificManifestCheck(ByRef oItem As clsBackup, ByVal iSelectDB As mgrSQLite.Database) As Boolean
Dim oDatabase As New mgrSQLite(iSelectDB) Dim oDatabase As New mgrSQLite(iSelectDB)
Dim oData As DataSet Dim oData As DataSet
@@ -140,6 +141,7 @@
End Function End Function
'This should only be used to update entries in the local manifest
Public Shared Function DoGlobalManifestCheck(ByVal sName As String, ByVal iSelectDB As mgrSQLite.Database) As Boolean Public Shared Function DoGlobalManifestCheck(ByVal sName As String, ByVal iSelectDB As mgrSQLite.Database) As Boolean
Dim oDatabase As New mgrSQLite(iSelectDB) Dim oDatabase As New mgrSQLite(iSelectDB)
Dim oData As DataSet Dim oData As DataSet
+359 -408
View File
@@ -10,57 +10,261 @@ Public Class mgrMonitorList
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)
Public Shared Sub HandleBackupLocationChange(ByVal oSettings As mgrSettings) Private Shared Function MapToObject(ByVal dr As DataRow) As clsGame
Dim oDatabase As New mgrSQLite(mgrSQLite.Database.Remote) Dim oGame As New clsGame
Dim iGameCount As Integer
'Check if a remote database already exists in the new backup location oGame.ID = CStr(dr("MonitorID"))
If oDatabase.CheckDB() Then oGame.Name = CStr(dr("Name"))
'Make sure database is the latest version oGame.ProcessName = CStr(dr("Process"))
oDatabase.DatabaseUpgrade() If Not IsDBNull(dr("Path")) Then oGame.Path = CStr(dr("Path"))
oGame.AbsolutePath = CBool(dr("AbsolutePath"))
oGame.FolderSave = CBool(dr("FolderSave"))
If Not IsDBNull(dr("FileType")) Then oGame.FileType = CStr(dr("FileType"))
oGame.AppendTimeStamp = CBool(dr("TimeStamp"))
If Not IsDBNull(dr("ExcludeList")) Then oGame.ExcludeList = CStr(dr("ExcludeList"))
If Not IsDBNull(dr("ProcessPath")) Then oGame.ProcessPath = CStr(dr("ProcessPath"))
If Not IsDBNull(dr("Icon")) Then oGame.Icon = CStr(dr("Icon"))
oGame.Hours = CDbl(dr("Hours"))
If Not IsDBNull(dr("Version")) Then oGame.Version = CStr(dr("Version"))
If Not IsDBNull(dr("Company")) Then oGame.Company = CStr(dr("Company"))
oGame.Enabled = CBool(dr("Enabled"))
oGame.MonitorOnly = CBool(dr("MonitorOnly"))
oGame.BackupLimit = CInt(dr("BackupLimit"))
'See if the remote database is empty Return oGame
iGameCount = mgrMonitorList.ReadList(eListTypes.FullList, mgrSQLite.Database.Remote).Count End Function
'If the remote database actually contains a list, then ask what to do Private Shared Function SetCoreParameters(ByVal oGame As clsGame) As Hashtable
If iGameCount > 0 Then Dim hshParams As New Hashtable
If mgrCommon.ShowMessage(mgrMonitorList_ConfirmExistingData, MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then
mgrMonitorList.SyncMonitorLists(oSettings.SyncFields) hshParams.Add("ID", oGame.ID)
Else hshParams.Add("Name", oGame.Name)
mgrMonitorList.SyncMonitorLists(oSettings.SyncFields, False) hshParams.Add("Process", oGame.TrueProcess)
End If hshParams.Add("Path", oGame.TruePath)
Else hshParams.Add("AbsolutePath", oGame.AbsolutePath)
mgrMonitorList.SyncMonitorLists(oSettings.SyncFields) hshParams.Add("FolderSave", oGame.FolderSave)
End If hshParams.Add("FileType", oGame.FileType)
Else hshParams.Add("TimeStamp", oGame.AppendTimeStamp)
mgrMonitorList.SyncMonitorLists(oSettings.SyncFields) hshParams.Add("ExcludeList", oGame.ExcludeList)
hshParams.Add("ProcessPath", oGame.ProcessPath)
hshParams.Add("Icon", oGame.Icon)
hshParams.Add("Hours", oGame.Hours)
hshParams.Add("Version", oGame.Version)
hshParams.Add("Company", oGame.Company)
hshParams.Add("Enabled", oGame.Enabled)
hshParams.Add("MonitorOnly", oGame.MonitorOnly)
hshParams.Add("BackupLimit", oGame.BackupLimit)
Return hshParams
End Function
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 oData As DataSet
Dim sSQL As String
Dim hshList As New Hashtable
Dim hshDupeList As New Hashtable
Dim oGame As clsGame
sSQL = "Select * from monitorlist ORDER BY Name Asc"
oData = oDatabase.ReadParamData(sSQL, New Hashtable)
For Each dr As DataRow In oData.Tables(0).Rows
oGame = MapToObject(dr)
Select Case eListType
Case eListTypes.FullList
'Don't wrap this, if it fails there's a problem with the database
hshList.Add(oGame.ProcessName & ":" & oGame.Name, oGame)
Case eListTypes.ScanList
If hshList.Contains(oGame.ProcessName) Then
DirectCast(hshList.Item(oGame.ProcessName), clsGame).Duplicate = True
oGame.ProcessName = oGame.ProcessName & ":" & oGame.Name
oGame.Duplicate = True
End If End If
If oGame.Enabled Then hshList.Add(oGame.ProcessName, oGame)
End Select
Next
Return hshList
End Function
Public Shared Sub DoListAdd(ByVal oGame As clsGame, Optional ByVal iSelectDB As mgrSQLite.Database = mgrSQLite.Database.Local)
Dim oDatabase As New mgrSQLite(iSelectDB)
Dim sSQL As String
Dim hshParams As Hashtable
sSQL = "INSERT INTO monitorlist VALUES (@ID, @Name, @Process, @Path, @AbsolutePath, @FolderSave, @FileType, @TimeStamp, "
sSQL &= "@ExcludeList, @ProcessPath, @Icon, @Hours, @Version, @Company, @Enabled, @MonitorOnly, @BackupLimit)"
'Parameters
hshParams = SetCoreParameters(oGame)
oDatabase.RunParamQuery(sSQL, hshParams)
End Sub End Sub
Public Shared Sub ExportMonitorList(ByVal sLocation As String) Public Shared Sub DoListUpdate(ByVal oGame As clsGame, Optional ByVal iSelectDB As mgrSQLite.Database = mgrSQLite.Database.Local)
Dim oList As List(Of Game) Dim oDatabase As New mgrSQLite(iSelectDB)
Dim bSuccess As Boolean = False Dim sSQL As String
Dim oTagFilters As New List(Of clsTag) Dim hshParams As Hashtable
Dim oStringFilters As New Hashtable
Dim eCurrentFilter As frmFilter.eFilterType = frmFilter.eFilterType.NoFilter
If mgrCommon.ShowMessage(mgrMonitorList_ConfirmApplyFilter, MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then sSQL = "UPDATE monitorlist SET Name=@Name, Process=@Process, Path=@Path, AbsolutePath=@AbsolutePath, FolderSave=@FolderSave, "
Dim frm As New frmFilter sSQL &= "FileType=@FileType, TimeStamp=@TimeStamp, ExcludeList=@ExcludeList, ProcessPath=@ProcessPath, Icon=@Icon, "
frm.ShowDialog() sSQL &= "Hours=@Hours, Version=@Version, Company=@Company, Enabled=@Enabled, MonitorOnly=@MonitorOnly, BackupLimit=@BackupLimit WHERE MonitorID=@ID"
oTagFilters = frm.TagFilters
oStringFilters = frm.StringFilters
eCurrentFilter = frm.FilterType
End If
oList = ReadListForExport(oTagFilters, oStringFilters, eCurrentFilter) 'Parameters
hshParams = SetCoreParameters(oGame)
bSuccess = mgrXML.SerializeAndExport(oList, sLocation) oDatabase.RunParamQuery(sSQL, hshParams)
If bSuccess Then
mgrCommon.ShowMessage(mgrMonitorList_ExportComplete, oList.Count, MsgBoxStyle.Information)
End If
End Sub End Sub
Public Shared Sub DoListUpdateMulti(ByVal sMonitorIDs As List(Of String), ByVal oGame As clsGame, Optional ByVal iSelectDB As mgrSQLite.Database = mgrSQLite.Database.Local)
Dim oDatabase As New mgrSQLite(iSelectDB)
Dim sSQL As String
Dim hshParams As New Hashtable
Dim iCounter As Integer
sSQL = "UPDATE monitorlist SET Enabled=@Enabled, MonitorOnly=@MonitorOnly WHERE MonitorID IN ("
'Parameters
hshParams.Add("Enabled", oGame.Enabled)
hshParams.Add("MonitorOnly", oGame.MonitorOnly)
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)
End Sub
Public Shared Sub DoListDelete(ByVal sMonitorID As String, Optional ByVal iSelectDB As mgrSQLite.Database = mgrSQLite.Database.Local)
Dim oDatabase As New mgrSQLite(iSelectDB)
Dim sSQL As String
Dim hshParams As New Hashtable
sSQL = "DELETE FROM gametags "
sSQL &= "WHERE MonitorID = @MonitorID;"
sSQL &= "DELETE FROM monitorlist "
sSQL &= "WHERE MonitorID = @MonitorID;"
hshParams.Add("MonitorID", sMonitorID)
oDatabase.RunParamQuery(sSQL, hshParams)
End Sub
Public Shared Sub DoListDeleteMulti(ByVal sMonitorIDs As List(Of String), Optional ByVal iSelectDB As mgrSQLite.Database = mgrSQLite.Database.Local)
Dim oDatabase As New mgrSQLite(iSelectDB)
Dim sSQL As String
Dim hshParams As New Hashtable
Dim iCounter As Integer
sSQL = "DELETE FROM gametags "
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 &= ");"
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)
End Sub
Public Shared Function DoListGetbyID(ByVal iMonitorID As Integer, Optional ByVal iSelectDB As mgrSQLite.Database = mgrSQLite.Database.Local) As clsGame
Dim oDatabase As New mgrSQLite(iSelectDB)
Dim sSQL As String
Dim oData As DataSet
Dim oGame As New clsGame
Dim hshParams As New Hashtable
sSQL = "SELECT * from monitorlist "
sSQL &= "WHERE MonitorID = @MonitorID"
hshParams.Add("MonitorID", iMonitorID)
oData = oDatabase.ReadParamData(sSQL, hshParams)
For Each dr As DataRow In oData.Tables(0).Rows
oGame = MapToObject(dr)
Next
Return oGame
End Function
Public Shared Function DoListGetbyName(ByVal sName As String, Optional ByVal iSelectDB As mgrSQLite.Database = mgrSQLite.Database.Local) As Hashtable
Dim oDatabase As New mgrSQLite(iSelectDB)
Dim sSQL As String
Dim oData As DataSet
Dim oGame As New clsGame
Dim hshGames As New Hashtable
Dim hshParams As New Hashtable
Dim iCounter As Integer = 0
sSQL = "SELECT * from monitorlist "
sSQL &= "WHERE Name = @Name"
hshParams.Add("Name", sName)
oData = oDatabase.ReadParamData(sSQL, hshParams)
For Each dr As DataRow In oData.Tables(0).Rows
oGame = MapToObject(dr)
hshGames.Add(iCounter, oGame)
iCounter += 1
Next
Return hshGames
End Function
Public Shared Function DoDuplicateListCheck(ByVal sName As String, ByVal sProcess As String, Optional ByVal iSelectDB As mgrSQLite.Database = mgrSQLite.Database.Local, Optional ByVal sExcludeID As String = "") As Boolean
Dim oDatabase As New mgrSQLite(iSelectDB)
Dim sSQL As String
Dim oData As DataSet
Dim hshParams As New Hashtable
sSQL = "SELECT * FROM monitorlist WHERE Name = @Name AND Process= @Process"
hshParams.Add("Name", sName)
hshParams.Add("Process", sProcess)
If sExcludeID <> String.Empty Then
sSQL &= " AND MonitorID <> @MonitorID"
hshParams.Add("MonitorID", 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
'Sync Functions
Public Shared Sub DoListAddUpdateSync(ByVal hshGames As Hashtable, Optional ByVal iSelectDB As mgrSQLite.Database = mgrSQLite.Database.Local, Public Shared Sub DoListAddUpdateSync(ByVal hshGames As Hashtable, Optional ByVal iSelectDB As mgrSQLite.Database = mgrSQLite.Database.Local,
Optional ByVal eSyncFields As clsGame.eOptionalSyncFields = clsGame.eOptionalSyncFields.None) Optional ByVal eSyncFields As clsGame.eOptionalSyncFields = clsGame.eOptionalSyncFields.None)
Dim oDatabase As New mgrSQLite(iSelectDB) Dim oDatabase As New mgrSQLite(iSelectDB)
@@ -260,73 +464,7 @@ Public Class mgrMonitorList
Application.DoEvents() Application.DoEvents()
End Sub End Sub
Private Shared Sub ImportMonitorList(ByVal sLocation As String, Optional ByVal bWebRead As Boolean = False) 'Filter Functions
Dim hshCompareFrom As Hashtable
Dim hshCompareTo As Hashtable
Dim hshSyncItems As Hashtable
Dim oFromItem As clsGame
Dim oToItem As clsGame
Cursor.Current = Cursors.WaitCursor
'Add / Update Sync
hshCompareFrom = mgrXML.ReadMonitorList(sLocation, bWebRead)
hshCompareTo = ReadList(eListTypes.FullList, mgrSQLite.Database.Local)
hshSyncItems = hshCompareFrom.Clone
For Each oFromItem In hshCompareFrom.Values
If hshCompareTo.Contains(oFromItem.CompoundKey) Then
oToItem = DirectCast(hshCompareTo(oFromItem.CompoundKey), clsGame)
If oFromItem.CoreEquals(oToItem) Then
hshSyncItems.Remove(oFromItem.CompoundKey)
End If
End If
Next
Cursor.Current = Cursors.Default
If hshSyncItems.Count > 0 Then
Dim frm As New frmAdvancedImport
frm.ImportData = hshSyncItems
If frm.ShowDialog() = DialogResult.OK Then
Cursor.Current = Cursors.WaitCursor
DoListAddUpdateSync(frm.FinalData)
mgrTags.DoTagAddImport(frm.FinalData)
Cursor.Current = Cursors.Default
mgrCommon.ShowMessage(mgrMonitorList_ImportComplete, MsgBoxStyle.Information)
End If
Else
mgrCommon.ShowMessage(mgrMonitorList_ImportNothing, MsgBoxStyle.Information)
End If
Application.DoEvents()
End Sub
Public Shared Function DoImport(ByVal sPath As String) As Boolean
If (sPath.IndexOf("http://", 0, StringComparison.CurrentCultureIgnoreCase) > -1) Or _
(sPath.IndexOf("https://", 0, StringComparison.CurrentCultureIgnoreCase) > -1) Then
If mgrCommon.CheckAddress(sPath) Then
ImportMonitorList(sPath, True)
Return True
Else
mgrCommon.ShowMessage(mgrMonitorList_WebNoReponse, sPath, MsgBoxStyle.Exclamation)
Return False
End If
Else
If File.Exists(sPath) Then
ImportMonitorList(sPath)
Return True
Else
mgrCommon.ShowMessage(mgrMonitorList_FileNotFound, sPath, MsgBoxStyle.Exclamation)
Return False
End If
End If
Return True
End Function
Private Shared Function BuildFilterQuery(ByVal oTagFilters As List(Of clsTag), ByVal hshStringFilters As Hashtable, eFilterType As frmFilter.eFilterType, ByRef hshParams As Hashtable) As String Private Shared Function BuildFilterQuery(ByVal oTagFilters As List(Of clsTag), ByVal hshStringFilters As Hashtable, eFilterType As frmFilter.eFilterType, ByRef hshParams As Hashtable) As String
Dim sSQL As String = String.Empty Dim sSQL As String = String.Empty
Dim iCounter As Integer = 0 Dim iCounter As Integer = 0
@@ -403,24 +541,7 @@ Public Class mgrMonitorList
oData = oDatabase.ReadParamData(sSQL, hshParams) 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 clsGame oGame = MapToObject(dr)
oGame.ID = CStr(dr("MonitorID"))
oGame.Name = CStr(dr("Name"))
oGame.ProcessName = CStr(dr("Process"))
If Not IsDBNull(dr("Path")) Then oGame.Path = CStr(dr("Path"))
oGame.AbsolutePath = CBool(dr("AbsolutePath"))
oGame.FolderSave = CBool(dr("FolderSave"))
If Not IsDBNull(dr("FileType")) Then oGame.FileType = CStr(dr("FileType"))
oGame.AppendTimeStamp = CBool(dr("TimeStamp"))
If Not IsDBNull(dr("ExcludeList")) Then oGame.ExcludeList = CStr(dr("ExcludeList"))
If Not IsDBNull(dr("ProcessPath")) Then oGame.ProcessPath = CStr(dr("ProcessPath"))
If Not IsDBNull(dr("Icon")) Then oGame.Icon = CStr(dr("Icon"))
oGame.Hours = CDbl(dr("Hours"))
If Not IsDBNull(dr("Version")) Then oGame.Version = CStr(dr("Version"))
If Not IsDBNull(dr("Company")) Then oGame.Company = CStr(dr("Company"))
oGame.Enabled = CBool(dr("Enabled"))
oGame.MonitorOnly = CBool(dr("MonitorOnly"))
oGame.BackupLimit = CInt(dr("BackupLimit"))
hshList.Add(oGame.ID, oGame) hshList.Add(oGame.ID, oGame)
Next Next
@@ -428,6 +549,8 @@ Public Class mgrMonitorList
Return hshList Return hshList
End Function End Function
'Import / Export Functions
Public Shared Function ReadListForExport(ByVal oTagFilters As List(Of clsTag), ByVal hshStringFilters As Hashtable, ByVal eFilterType As frmFilter.eFilterType, Optional ByVal iSelectDB As mgrSQLite.Database = mgrSQLite.Database.Local) As List(Of Game) Public Shared Function ReadListForExport(ByVal oTagFilters As List(Of clsTag), ByVal hshStringFilters As Hashtable, ByVal eFilterType As frmFilter.eFilterType, 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
@@ -458,294 +581,122 @@ Public Class mgrMonitorList
Return oList Return oList
End Function End Function
Public Shared Function ReadList(ByVal eListType As eListTypes, Optional ByVal iSelectDB As mgrSQLite.Database = mgrSQLite.Database.Local) As Hashtable Public Shared Function DoImport(ByVal sPath As String) As Boolean
Dim oDatabase As New mgrSQLite(iSelectDB) If (sPath.IndexOf("http://", 0, StringComparison.CurrentCultureIgnoreCase) > -1) Or
Dim oData As DataSet (sPath.IndexOf("https://", 0, StringComparison.CurrentCultureIgnoreCase) > -1) Then
Dim sSQL As String If mgrCommon.CheckAddress(sPath) Then
Dim hshList As New Hashtable ImportMonitorList(sPath, True)
Dim hshDupeList As New Hashtable
Dim oGame As clsGame
sSQL = "Select * from monitorlist ORDER BY Name Asc"
oData = oDatabase.ReadParamData(sSQL, New Hashtable)
For Each dr As DataRow In oData.Tables(0).Rows
oGame = New clsGame
oGame.ID = CStr(dr("MonitorID"))
oGame.Name = CStr(dr("Name"))
oGame.ProcessName = CStr(dr("Process"))
If Not IsDBNull(dr("Path")) Then oGame.Path = CStr(dr("Path"))
oGame.AbsolutePath = CBool(dr("AbsolutePath"))
oGame.FolderSave = CBool(dr("FolderSave"))
If Not IsDBNull(dr("FileType")) Then oGame.FileType = CStr(dr("FileType"))
oGame.AppendTimeStamp = CBool(dr("TimeStamp"))
If Not IsDBNull(dr("ExcludeList")) Then oGame.ExcludeList = CStr(dr("ExcludeList"))
If Not IsDBNull(dr("ProcessPath")) Then oGame.ProcessPath = CStr(dr("ProcessPath"))
If Not IsDBNull(dr("Icon")) Then oGame.Icon = CStr(dr("Icon"))
oGame.Hours = CDbl(dr("Hours"))
If Not IsDBNull(dr("Version")) Then oGame.Version = CStr(dr("Version"))
If Not IsDBNull(dr("Company")) Then oGame.Company = CStr(dr("Company"))
oGame.Enabled = CBool(dr("Enabled"))
oGame.MonitorOnly = CBool(dr("MonitorOnly"))
oGame.BackupLimit = CInt(dr("BackupLimit"))
Select Case eListType
Case eListTypes.FullList
'Don't wrap this, if it fails there's a problem with the database
hshList.Add(oGame.ProcessName & ":" & oGame.Name, oGame)
Case eListTypes.ScanList
If hshList.Contains(oGame.ProcessName) Then
DirectCast(hshList.Item(oGame.ProcessName), clsGame).Duplicate = True
oGame.ProcessName = oGame.ProcessName & ":" & oGame.Name
oGame.Duplicate = True
End If
If oGame.Enabled Then hshList.Add(oGame.ProcessName, oGame)
End Select
Next
Return hshList
End Function
Public Shared Sub DoListAdd(ByVal oGame As clsGame, Optional ByVal iSelectDB As mgrSQLite.Database = mgrSQLite.Database.Local)
Dim oDatabase As New mgrSQLite(iSelectDB)
Dim sSQL As String
Dim hshParams As New Hashtable
sSQL = "INSERT INTO monitorlist VALUES (@ID, @Name, @Process, @Path, @AbsolutePath, @FolderSave, @FileType, @TimeStamp, "
sSQL &= "@ExcludeList, @ProcessPath, @Icon, @Hours, @Version, @Company, @Enabled, @MonitorOnly, @BackupLimit)"
'Parameters
hshParams.Add("ID", oGame.ID)
hshParams.Add("Name", oGame.Name)
hshParams.Add("Process", oGame.TrueProcess)
hshParams.Add("Path", oGame.TruePath)
hshParams.Add("AbsolutePath", oGame.AbsolutePath)
hshParams.Add("FolderSave", oGame.FolderSave)
hshParams.Add("FileType", oGame.FileType)
hshParams.Add("TimeStamp", oGame.AppendTimeStamp)
hshParams.Add("ExcludeList", oGame.ExcludeList)
hshParams.Add("ProcessPath", oGame.ProcessPath)
hshParams.Add("Icon", oGame.Icon)
hshParams.Add("Hours", oGame.Hours)
hshParams.Add("Version", oGame.Version)
hshParams.Add("Company", oGame.Company)
hshParams.Add("Enabled", oGame.Enabled)
hshParams.Add("MonitorOnly", oGame.MonitorOnly)
hshParams.Add("BackupLimit", oGame.BackupLimit)
oDatabase.RunParamQuery(sSQL, hshParams)
End Sub
Public Shared Sub DoListUpdate(ByVal oGame As clsGame, Optional ByVal iSelectDB As mgrSQLite.Database = mgrSQLite.Database.Local)
Dim oDatabase As New mgrSQLite(iSelectDB)
Dim sSQL As String
Dim hshParams As New Hashtable
sSQL = "UPDATE monitorlist SET Name=@Name, Process=@Process, Path=@Path, AbsolutePath=@AbsolutePath, FolderSave=@FolderSave, "
sSQL &= "FileType=@FileType, TimeStamp=@TimeStamp, ExcludeList=@ExcludeList, ProcessPath=@ProcessPath, Icon=@Icon, "
sSQL &= "Hours=@Hours, Version=@Version, Company=@Company, Enabled=@Enabled, MonitorOnly=@MonitorOnly, BackupLimit=@BackupLimit WHERE MonitorID=@ID"
'Parameters
hshParams.Add("Name", oGame.Name)
hshParams.Add("Process", oGame.TrueProcess)
hshParams.Add("Path", oGame.TruePath)
hshParams.Add("AbsolutePath", oGame.AbsolutePath)
hshParams.Add("FolderSave", oGame.FolderSave)
hshParams.Add("FileType", oGame.FileType)
hshParams.Add("TimeStamp", oGame.AppendTimeStamp)
hshParams.Add("ExcludeList", oGame.ExcludeList)
hshParams.Add("ProcessPath", oGame.ProcessPath)
hshParams.Add("Icon", oGame.Icon)
hshParams.Add("Hours", oGame.Hours)
hshParams.Add("Version", oGame.Version)
hshParams.Add("Company", oGame.Company)
hshParams.Add("Enabled", oGame.Enabled)
hshParams.Add("MonitorOnly", oGame.MonitorOnly)
hshParams.Add("ID", oGame.ID)
hshParams.Add("BackupLimit", oGame.BackupLimit)
oDatabase.RunParamQuery(sSQL, hshParams)
End Sub
Public Shared Sub DoListUpdateMulti(ByVal sMonitorIDs As List(Of String), ByVal oGame As clsGame, Optional ByVal iSelectDB As mgrSQLite.Database = mgrSQLite.Database.Local)
Dim oDatabase As New mgrSQLite(iSelectDB)
Dim sSQL As String
Dim hshParams As New Hashtable
Dim iCounter As Integer
sSQL = "UPDATE monitorlist SET Enabled=@Enabled, MonitorOnly=@MonitorOnly WHERE MonitorID IN ("
'Parameters
hshParams.Add("Enabled", oGame.Enabled)
hshParams.Add("MonitorOnly", oGame.MonitorOnly)
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)
End Sub
Public Shared Sub DoListDelete(ByVal sMonitorID As String, Optional ByVal iSelectDB As mgrSQLite.Database = mgrSQLite.Database.Local)
Dim oDatabase As New mgrSQLite(iSelectDB)
Dim sSQL As String
Dim hshParams As New Hashtable
sSQL = "DELETE FROM gametags "
sSQL &= "WHERE MonitorID = @MonitorID;"
sSQL &= "DELETE FROM monitorlist "
sSQL &= "WHERE MonitorID = @MonitorID;"
hshParams.Add("MonitorID", sMonitorID)
oDatabase.RunParamQuery(sSQL, hshParams)
End Sub
Public Shared Sub DoListDeleteMulti(ByVal sMonitorIDs As List(Of String), Optional ByVal iSelectDB As mgrSQLite.Database = mgrSQLite.Database.Local)
Dim oDatabase As New mgrSQLite(iSelectDB)
Dim sSQL As String
Dim hshParams As New Hashtable
Dim iCounter As Integer
sSQL = "DELETE FROM gametags "
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 &= ");"
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)
End Sub
Public Shared Function DoListGetbyID(ByVal iMonitorID As Integer, Optional ByVal iSelectDB As mgrSQLite.Database = mgrSQLite.Database.Local) As clsGame
Dim oDatabase As New mgrSQLite(iSelectDB)
Dim sSQL As String
Dim oData As DataSet
Dim oGame As New clsGame
Dim hshParams As New Hashtable
sSQL = "SELECT * from monitorlist "
sSQL &= "WHERE MonitorID = @MonitorID"
hshParams.Add("MonitorID", iMonitorID)
oData = oDatabase.ReadParamData(sSQL, hshParams)
For Each dr As DataRow In oData.Tables(0).Rows
oGame = New clsGame
oGame.ID = CStr(dr("MonitorID"))
oGame.Name = CStr(dr("Name"))
oGame.ProcessName = CStr(dr("Process"))
If Not IsDBNull(dr("Path")) Then oGame.Path = CStr(dr("Path"))
oGame.AbsolutePath = CBool(dr("AbsolutePath"))
oGame.FolderSave = CBool(dr("FolderSave"))
If Not IsDBNull(dr("FileType")) Then oGame.FileType = CStr(dr("FileType"))
oGame.AppendTimeStamp = CBool(dr("TimeStamp"))
If Not IsDBNull(dr("ExcludeList")) Then oGame.ExcludeList = CStr(dr("ExcludeList"))
If Not IsDBNull(dr("ProcessPath")) Then oGame.ProcessPath = CStr(dr("ProcessPath"))
If Not IsDBNull(dr("Icon")) Then oGame.Icon = CStr(dr("Icon"))
oGame.Hours = CDbl(dr("Hours"))
If Not IsDBNull(dr("Version")) Then oGame.Version = CStr(dr("Version"))
If Not IsDBNull(dr("Company")) Then oGame.Company = CStr(dr("Company"))
oGame.Enabled = CBool(dr("Enabled"))
oGame.MonitorOnly = CBool(dr("MonitorOnly"))
oGame.BackupLimit = CInt(dr("BackupLimit"))
Next
Return oGame
End Function
Public Shared Function DoListGetbyName(ByVal sName As String, Optional ByVal iSelectDB As mgrSQLite.Database = mgrSQLite.Database.Local) As Hashtable
Dim oDatabase As New mgrSQLite(iSelectDB)
Dim sSQL As String
Dim oData As DataSet
Dim oGame As New clsGame
Dim hshGames As New Hashtable
Dim hshParams As New Hashtable
Dim iCounter As Integer = 0
sSQL = "SELECT * from monitorlist "
sSQL &= "WHERE Name = @Name"
hshParams.Add("Name", sName)
oData = oDatabase.ReadParamData(sSQL, hshParams)
For Each dr As DataRow In oData.Tables(0).Rows
oGame = New clsGame
oGame.ID = CStr(dr("MonitorID"))
oGame.Name = CStr(dr("Name"))
oGame.ProcessName = CStr(dr("Process"))
If Not IsDBNull(dr("Path")) Then oGame.Path = CStr(dr("Path"))
oGame.AbsolutePath = CBool(dr("AbsolutePath"))
oGame.FolderSave = CBool(dr("FolderSave"))
If Not IsDBNull(dr("FileType")) Then oGame.FileType = CStr(dr("FileType"))
oGame.AppendTimeStamp = CBool(dr("TimeStamp"))
If Not IsDBNull(dr("ExcludeList")) Then oGame.ExcludeList = CStr(dr("ExcludeList"))
If Not IsDBNull(dr("ProcessPath")) Then oGame.ProcessPath = CStr(dr("ProcessPath"))
If Not IsDBNull(dr("Icon")) Then oGame.Icon = CStr(dr("Icon"))
oGame.Hours = CDbl(dr("Hours"))
If Not IsDBNull(dr("Version")) Then oGame.Version = CStr(dr("Version"))
If Not IsDBNull(dr("Company")) Then oGame.Company = CStr(dr("Company"))
oGame.Enabled = CBool(dr("Enabled"))
oGame.MonitorOnly = CBool(dr("MonitorOnly"))
oGame.BackupLimit = CInt(dr("BackupLimit"))
hshGames.Add(iCounter, oGame)
iCounter += 1
Next
Return hshGames
End Function
Public Shared Function DoDuplicateListCheck(ByVal sName As String, ByVal sProcess As String, Optional ByVal iSelectDB As mgrSQLite.Database = mgrSQLite.Database.Local, Optional ByVal sExcludeID As String = "") As Boolean
Dim oDatabase As New mgrSQLite(iSelectDB)
Dim sSQL As String
Dim oData As DataSet
Dim hshParams As New Hashtable
sSQL = "SELECT * FROM monitorlist WHERE Name = @Name AND Process= @Process"
hshParams.Add("Name", sName)
hshParams.Add("Process", sProcess)
If sExcludeID <> String.Empty Then
sSQL &= " AND MonitorID <> @MonitorID"
hshParams.Add("MonitorID", sExcludeID)
End If
oData = oDatabase.ReadParamData(sSQL, hshParams)
If oData.Tables(0).Rows.Count > 0 Then
Return True Return True
Else Else
mgrCommon.ShowMessage(mgrMonitorList_WebNoReponse, sPath, MsgBoxStyle.Exclamation)
Return False Return False
End If End If
Else
If File.Exists(sPath) Then
ImportMonitorList(sPath)
Return True
Else
mgrCommon.ShowMessage(mgrMonitorList_FileNotFound, sPath, MsgBoxStyle.Exclamation)
Return False
End If
End If
Return True
End Function End Function
Private Shared Sub ImportMonitorList(ByVal sLocation As String, Optional ByVal bWebRead As Boolean = False)
Dim hshCompareFrom As Hashtable
Dim hshCompareTo As Hashtable
Dim hshSyncItems As Hashtable
Dim oFromItem As clsGame
Dim oToItem As clsGame
Cursor.Current = Cursors.WaitCursor
'Add / Update Sync
hshCompareFrom = mgrXML.ReadMonitorList(sLocation, bWebRead)
hshCompareTo = ReadList(eListTypes.FullList, mgrSQLite.Database.Local)
hshSyncItems = hshCompareFrom.Clone
For Each oFromItem In hshCompareFrom.Values
If hshCompareTo.Contains(oFromItem.CompoundKey) Then
oToItem = DirectCast(hshCompareTo(oFromItem.CompoundKey), clsGame)
If oFromItem.CoreEquals(oToItem) Then
hshSyncItems.Remove(oFromItem.CompoundKey)
End If
End If
Next
Cursor.Current = Cursors.Default
If hshSyncItems.Count > 0 Then
Dim frm As New frmAdvancedImport
frm.ImportData = hshSyncItems
If frm.ShowDialog() = DialogResult.OK Then
Cursor.Current = Cursors.WaitCursor
DoListAddUpdateSync(frm.FinalData)
mgrTags.DoTagAddImport(frm.FinalData)
Cursor.Current = Cursors.Default
mgrCommon.ShowMessage(mgrMonitorList_ImportComplete, MsgBoxStyle.Information)
End If
Else
mgrCommon.ShowMessage(mgrMonitorList_ImportNothing, MsgBoxStyle.Information)
End If
Application.DoEvents()
End Sub
Public Shared Sub ExportMonitorList(ByVal sLocation As String)
Dim oList As List(Of Game)
Dim bSuccess As Boolean = False
Dim oTagFilters As New List(Of clsTag)
Dim oStringFilters As New Hashtable
Dim eCurrentFilter As frmFilter.eFilterType = frmFilter.eFilterType.NoFilter
If mgrCommon.ShowMessage(mgrMonitorList_ConfirmApplyFilter, MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then
Dim frm As New frmFilter
frm.ShowDialog()
oTagFilters = frm.TagFilters
oStringFilters = frm.StringFilters
eCurrentFilter = frm.FilterType
End If
oList = ReadListForExport(oTagFilters, oStringFilters, eCurrentFilter)
bSuccess = mgrXML.SerializeAndExport(oList, sLocation)
If bSuccess Then
mgrCommon.ShowMessage(mgrMonitorList_ExportComplete, oList.Count, MsgBoxStyle.Information)
End If
End Sub
'Other Functions
Public Shared Sub HandleBackupLocationChange(ByVal oSettings As mgrSettings)
Dim oDatabase As New mgrSQLite(mgrSQLite.Database.Remote)
Dim iGameCount As Integer
'Check if a remote database already exists in the new backup location
If oDatabase.CheckDB() Then
'Make sure database is the latest version
oDatabase.DatabaseUpgrade()
'See if the remote database is empty
iGameCount = mgrMonitorList.ReadList(eListTypes.FullList, mgrSQLite.Database.Remote).Count
'If the remote database actually contains a list, then ask what to do
If iGameCount > 0 Then
If mgrCommon.ShowMessage(mgrMonitorList_ConfirmExistingData, MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then
mgrMonitorList.SyncMonitorLists(oSettings.SyncFields)
Else
mgrMonitorList.SyncMonitorLists(oSettings.SyncFields, False)
End If
Else
mgrMonitorList.SyncMonitorLists(oSettings.SyncFields)
End If
Else
mgrMonitorList.SyncMonitorLists(oSettings.SyncFields)
End If
End Sub
End Class End Class
+27 -15
View File
@@ -1,26 +1,44 @@
Public Class mgrTags Public Class mgrTags
Private Shared Function MapToObject(ByVal dr As DataRow) As clsTag
Dim oTag As New clsTag
oTag.ID = CStr(dr("TagID"))
oTag.Name = CStr(dr("Name"))
Return oTag
End Function
Private Shared Function SetCoreParameters(ByVal oTag As clsTag) As Hashtable
Dim hshParams As New Hashtable
hshParams.Add("ID", oTag.ID)
hshParams.Add("Name", oTag.Name)
Return hshParams
End Function
Public Shared Sub DoTagAdd(ByVal oTag As clsTag, Optional ByVal iSelectDB As mgrSQLite.Database = mgrSQLite.Database.Local) Public Shared Sub DoTagAdd(ByVal oTag As clsTag, Optional ByVal iSelectDB As mgrSQLite.Database = mgrSQLite.Database.Local)
Dim oDatabase As New mgrSQLite(iSelectDB) Dim oDatabase As New mgrSQLite(iSelectDB)
Dim sSQL As String Dim sSQL As String
Dim hshParams As New Hashtable Dim hshParams As Hashtable
sSQL = "INSERT INTO tags VALUES (@ID, @Name)" sSQL = "INSERT INTO tags VALUES (@ID, @Name)"
hshParams.Add("ID", oTag.ID)
hshParams.Add("Name", oTag.Name) hshParams = SetCoreParameters(oTag)
oDatabase.RunParamQuery(sSQL, hshParams) oDatabase.RunParamQuery(sSQL, hshParams)
End Sub End Sub
Public Shared Sub DoTagUpdate(ByVal oTag As clsTag, Optional ByVal iSelectDB As mgrSQLite.Database = mgrSQLite.Database.Local) Public Shared Sub DoTagUpdate(ByVal oTag As clsTag, Optional ByVal iSelectDB As mgrSQLite.Database = mgrSQLite.Database.Local)
Dim oDatabase As New mgrSQLite(iSelectDB) Dim oDatabase As New mgrSQLite(iSelectDB)
Dim sSQL As String Dim sSQL As String
Dim hshParams As New Hashtable Dim hshParams As Hashtable
sSQL = "UPDATE tags SET Name=@Name " sSQL = "UPDATE tags SET Name=@Name "
sSQL &= "WHERE TagID = @ID" sSQL &= "WHERE TagID = @ID"
hshParams.Add("Name", oTag.Name) hshParams = SetCoreParameters(oTag)
hshParams.Add("ID", oTag.ID)
oDatabase.RunParamQuery(sSQL, hshParams) oDatabase.RunParamQuery(sSQL, hshParams)
@@ -57,9 +75,7 @@
oData = oDatabase.ReadParamData(sSQL, hshParams) 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
oTag = New clsTag oTag = MapToObject(dr)
oTag.ID = CStr(dr("TagID"))
oTag.Name = CStr(dr("Name"))
Next Next
Return oTag Return oTag
@@ -80,9 +96,7 @@
oData = oDatabase.ReadParamData(sSQL, hshParams) 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
oTag = New clsTag oTag = MapToObject(dr)
oTag.ID = CStr(dr("TagID"))
oTag.Name = CStr(dr("Name"))
Next Next
Return oTag Return oTag
@@ -124,9 +138,7 @@
oData = oDatabase.ReadParamData(sSQL, New Hashtable) oData = oDatabase.ReadParamData(sSQL, New Hashtable)
For Each dr As DataRow In oData.Tables(0).Rows For Each dr As DataRow In oData.Tables(0).Rows
oTag = New clsTag oTag = MapToObject(dr)
oTag.ID = CStr(dr("TagID"))
oTag.Name = CStr(dr("Name"))
hshList.Add(oTag.Name, oTag) hshList.Add(oTag.Name, oTag)
Next Next
+27 -20
View File
@@ -1,5 +1,25 @@
Public Class mgrVariables Public Class mgrVariables
Private Shared Function MapToObject(ByVal dr As DataRow) As clsPathVariable
Dim oCustomVariable As New clsPathVariable
oCustomVariable.ID = CStr(dr("VariableID"))
oCustomVariable.Name = CStr(dr("Name"))
oCustomVariable.Path = CStr(dr("Path"))
Return oCustomVariable
End Function
Private Shared Function SetCoreParameters(ByVal oCustomVariable As clsPathVariable) As Hashtable
Dim hshParams As New Hashtable
hshParams.Add("ID", oCustomVariable.ID)
hshParams.Add("Name", oCustomVariable.Name)
hshParams.Add("Path", oCustomVariable.Path)
Return hshParams
End Function
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)
Dim sSQL As String Dim sSQL As String
@@ -15,26 +35,22 @@
Public Shared Sub DoVariableAdd(ByVal oCustomVariable As clsPathVariable) Public Shared Sub DoVariableAdd(ByVal oCustomVariable As clsPathVariable)
Dim oDatabase As New mgrSQLite(mgrSQLite.Database.Local) Dim oDatabase As New mgrSQLite(mgrSQLite.Database.Local)
Dim sSQL As String Dim sSQL As String
Dim hshParams As New Hashtable Dim hshParams As Hashtable
sSQL = "INSERT INTO variables VALUES (@ID, @Name, @Path)" sSQL = "INSERT INTO variables VALUES (@ID, @Name, @Path)"
hshParams.Add("ID", oCustomVariable.ID) hshParams = SetCoreParameters(oCustomVariable)
hshParams.Add("Name", oCustomVariable.Name)
hshParams.Add("Path", oCustomVariable.Path)
oDatabase.RunParamQuery(sSQL, hshParams) oDatabase.RunParamQuery(sSQL, hshParams)
End Sub End Sub
Public Shared Sub DoVariableUpdate(ByVal oCustomVariable As clsPathVariable) Public Shared Sub DoVariableUpdate(ByVal oCustomVariable As clsPathVariable)
Dim oDatabase As New mgrSQLite(mgrSQLite.Database.Local) Dim oDatabase As New mgrSQLite(mgrSQLite.Database.Local)
Dim sSQL As String Dim sSQL As String
Dim hshParams As New Hashtable Dim hshParams As Hashtable
sSQL = "UPDATE variables SET Name=@Name, Path = @Path " sSQL = "UPDATE variables SET Name=@Name, Path = @Path "
sSQL &= "WHERE VariableID = @ID" sSQL &= "WHERE VariableID = @ID"
hshParams.Add("Name", oCustomVariable.Name) hshParams = SetCoreParameters(oCustomVariable)
hshParams.Add("Path", oCustomVariable.Path)
hshParams.Add("ID", oCustomVariable.ID)
oDatabase.RunParamQuery(sSQL, hshParams) oDatabase.RunParamQuery(sSQL, hshParams)
@@ -69,10 +85,7 @@
oData = oDatabase.ReadParamData(sSQL, hshParams) 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
oCustomVariable = New clsPathVariable oCustomVariable = MapToObject(dr)
oCustomVariable.ID = CStr(dr("VariableID"))
oCustomVariable.Name = CStr(dr("Name"))
oCustomVariable.Path = CStr(dr("Path"))
Next Next
Return oCustomVariable Return oCustomVariable
@@ -93,10 +106,7 @@
oData = oDatabase.ReadParamData(sSQL, hshParams) 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
oCustomVariable = New clsPathVariable oCustomVariable = MapToObject(dr)
oCustomVariable.ID = CStr(dr("VariableID"))
oCustomVariable.Name = CStr(dr("Name"))
oCustomVariable.Path = CStr(dr("Path"))
Next Next
Return oCustomVariable Return oCustomVariable
@@ -138,10 +148,7 @@
oData = oDatabase.ReadParamData(sSQL, New Hashtable) oData = oDatabase.ReadParamData(sSQL, New Hashtable)
For Each dr As DataRow In oData.Tables(0).Rows For Each dr As DataRow In oData.Tables(0).Rows
oCustomVariable = New clsPathVariable oCustomVariable = MapToObject(dr)
oCustomVariable.ID = CStr(dr("VariableID"))
oCustomVariable.Name = CStr(dr("Name"))
oCustomVariable.Path = CStr(dr("Path"))
hshList.Add(oCustomVariable.Name, oCustomVariable) hshList.Add(oCustomVariable.Name, oCustomVariable)
Next Next
+13 -4
View File
@@ -259,7 +259,7 @@ Namespace My.Resources
End Property End Property
'''<summary> '''<summary>
''' Looks up a localized string similar to Save Entire Folder. ''' Looks up a localized string similar to Save entire folder.
'''</summary> '''</summary>
Friend ReadOnly Property frmAddWizard_chkFolderSave() As String Friend ReadOnly Property frmAddWizard_chkFolderSave() As String
Get Get
@@ -268,7 +268,7 @@ Namespace My.Resources
End Property End Property
'''<summary> '''<summary>
''' Looks up a localized string similar to Time Stamp Backup. ''' Looks up a localized string similar to Save multiple backups.
'''</summary> '''</summary>
Friend ReadOnly Property frmAddWizard_chkTimeStamp() As String Friend ReadOnly Property frmAddWizard_chkTimeStamp() As String
Get Get
@@ -501,6 +501,15 @@ Namespace My.Resources
End Get End Get
End Property End Property
'''<summary>
''' Looks up a localized string similar to Backup Limit.
'''</summary>
Friend ReadOnly Property frmAddWizard_lblLimit() As String
Get
Return ResourceManager.GetString("frmAddWizard_lblLimit", resourceCulture)
End Get
End Property
'''<summary> '''<summary>
''' Looks up a localized string similar to The name will be automatically filtered for length and invalid characters. You may drag and drop a shortcut here to complete this step, only Windows shortcuts are currently supported.. ''' Looks up a localized string similar to The name will be automatically filtered for length and invalid characters. You may drag and drop a shortcut here to complete this step, only Windows shortcuts are currently supported..
'''</summary> '''</summary>
@@ -574,7 +583,7 @@ Namespace My.Resources
End Property End Property
'''<summary> '''<summary>
''' Looks up a localized string similar to If you&apos;re unsure of exactly which files to backup, make sure Save Entire Folder is checked. You can also time stamp your backup files to make incremental backups.. ''' Looks up a localized string similar to If you&apos;re unsure of exactly which files to backup, make sure Save entire folder is checked. You can also choose to save multiple backups and set a limit on how many to keep..
'''</summary> '''</summary>
Friend ReadOnly Property frmAddWizard_lblStep3Instructions() As String Friend ReadOnly Property frmAddWizard_lblStep3Instructions() As String
Get Get
@@ -709,7 +718,7 @@ Namespace My.Resources
End Property End Property
'''<summary> '''<summary>
''' Looks up a localized string similar to Timestamp. ''' Looks up a localized string similar to Multiple Backups.
'''</summary> '''</summary>
Friend ReadOnly Property frmAddWizard_Summary_Timestamp() As String Friend ReadOnly Property frmAddWizard_Summary_Timestamp() As String
Get Get
+7 -4
View File
@@ -701,10 +701,10 @@
<value>...</value> <value>...</value>
</data> </data>
<data name="frmAddWizard_chkFolderSave" xml:space="preserve"> <data name="frmAddWizard_chkFolderSave" xml:space="preserve">
<value>Save Entire Folder</value> <value>Save entire folder</value>
</data> </data>
<data name="frmAddWizard_chkTimeStamp" xml:space="preserve"> <data name="frmAddWizard_chkTimeStamp" xml:space="preserve">
<value>Time Stamp Backup</value> <value>Save multiple backups</value>
</data> </data>
<data name="frmAddWizard_ChooseProcess" xml:space="preserve"> <data name="frmAddWizard_ChooseProcess" xml:space="preserve">
<value>Choose exe file that starts the game</value> <value>Choose exe file that starts the game</value>
@@ -806,7 +806,7 @@
<value>Choose Files to Backup</value> <value>Choose Files to Backup</value>
</data> </data>
<data name="frmAddWizard_lblStep3Instructions" xml:space="preserve"> <data name="frmAddWizard_lblStep3Instructions" xml:space="preserve">
<value>If you're unsure of exactly which files to backup, make sure Save Entire Folder is checked. You can also time stamp your backup files to make incremental backups.</value> <value>If you're unsure of exactly which files to backup, make sure Save entire folder is checked. You can also choose to save multiple backups and set a limit on how many to keep.</value>
</data> </data>
<data name="frmAddWizard_lblStep3Intro" xml:space="preserve"> <data name="frmAddWizard_lblStep3Intro" xml:space="preserve">
<value>Choose the location of your game's save files:</value> <value>Choose the location of your game's save files:</value>
@@ -851,7 +851,7 @@
<value>Save Path</value> <value>Save Path</value>
</data> </data>
<data name="frmAddWizard_Summary_Timestamp" xml:space="preserve"> <data name="frmAddWizard_Summary_Timestamp" xml:space="preserve">
<value>Timestamp</value> <value>Multiple Backups</value>
</data> </data>
<data name="frmAdvancedImport_btnCancel" xml:space="preserve"> <data name="frmAdvancedImport_btnCancel" xml:space="preserve">
<value>&amp;Cancel</value> <value>&amp;Cancel</value>
@@ -1726,4 +1726,7 @@
<data name="frmGameManager_ConfirmBackupDeleteAll" xml:space="preserve"> <data name="frmGameManager_ConfirmBackupDeleteAll" xml:space="preserve">
<value>This will delete all backup files for [PARAM]. This cannot be undone. [BR][BR]Do you want to continue?</value> <value>This will delete all backup files for [PARAM]. This cannot be undone. [BR][BR]Do you want to continue?</value>
</data> </data>
<data name="frmAddWizard_lblLimit" xml:space="preserve">
<value>Backup Limit</value>
</data>
</root> </root>