Manifest Re-write (Functional, New Features, Pass 2)

This commit is contained in:
Michael J. Seiferling
2016-08-21 20:14:07 -06:00
parent bfe2346e8a
commit 18befc19b3
12 changed files with 404 additions and 266 deletions
+13
View File
@@ -7,6 +7,7 @@
Private bFolderSave As Boolean = False
Private sFileType As String = String.Empty
Private bAppendTimeStamp As Boolean = False
Private iBackupLimit As Integer = 2
Private sExcludeList As String = String.Empty
Private sProcessPath As String = String.Empty
Private sIcon As String = String.Empty
@@ -117,6 +118,15 @@
End Set
End Property
Property BackupLimit As Integer
Get
Return iBackupLimit
End Get
Set(value As Integer)
iBackupLimit = value
End Set
End Property
Property ExcludeList As String
Set(value As String)
sExcludeList = value
@@ -293,6 +303,9 @@
If AppendTimeStamp <> oGame.AppendTimeStamp Then
Return False
End If
If BackupLimit <> oGame.BackupLimit Then
Return False
End If
End If
If (eSyncFields And eOptionalSyncFields.Version) = eOptionalSyncFields.Version Then
If Version <> oGame.Version Then
+90 -76
View File
@@ -28,6 +28,8 @@ Partial Class frmGameManager
Me.btnBackup = New System.Windows.Forms.Button()
Me.btnClose = New System.Windows.Forms.Button()
Me.grpConfig = New System.Windows.Forms.GroupBox()
Me.lblLimit = New System.Windows.Forms.Label()
Me.nudLimit = New System.Windows.Forms.NumericUpDown()
Me.btnExclude = New System.Windows.Forms.Button()
Me.btnInclude = New System.Windows.Forms.Button()
Me.txtID = New System.Windows.Forms.TextBox()
@@ -61,18 +63,17 @@ Partial Class frmGameManager
Me.lblHours = New System.Windows.Forms.Label()
Me.btnTags = New System.Windows.Forms.Button()
Me.grpStats = New System.Windows.Forms.GroupBox()
Me.cboRemoteBackup = New System.Windows.Forms.ComboBox()
Me.lblRestorePathData = New System.Windows.Forms.Label()
Me.lblBackupFileData = New System.Windows.Forms.Label()
Me.lblCurrentBackupData = New System.Windows.Forms.Label()
Me.lblLatestBackupData = New System.Windows.Forms.Label()
Me.lblLocalBackupData = New System.Windows.Forms.Label()
Me.lblRestorePath = New System.Windows.Forms.Label()
Me.btnChangeBackup = New System.Windows.Forms.Button()
Me.btnOpenRestorePath = New System.Windows.Forms.Button()
Me.btnOpenBackupFile = New System.Windows.Forms.Button()
Me.btnDeleteBackup = New System.Windows.Forms.Button()
Me.lblBackupFile = New System.Windows.Forms.Label()
Me.lblLatestBackup = New System.Windows.Forms.Label()
Me.lblCurrentBackup = New System.Windows.Forms.Label()
Me.lblRemote = New System.Windows.Forms.Label()
Me.lblLocalData = New System.Windows.Forms.Label()
Me.btnMarkAsRestored = New System.Windows.Forms.Button()
Me.btnRestore = New System.Windows.Forms.Button()
Me.btnSave = New System.Windows.Forms.Button()
@@ -92,6 +93,7 @@ Partial Class frmGameManager
Me.txtQuickFilter = New System.Windows.Forms.TextBox()
Me.lblQuickFilter = New System.Windows.Forms.Label()
Me.grpConfig.SuspendLayout()
CType(Me.nudLimit, System.ComponentModel.ISupportInitialize).BeginInit()
Me.grpExtra.SuspendLayout()
CType(Me.pbIcon, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.nudHours, System.ComponentModel.ISupportInitialize).BeginInit()
@@ -145,6 +147,8 @@ Partial Class frmGameManager
'grpConfig
'
Me.grpConfig.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.grpConfig.Controls.Add(Me.lblLimit)
Me.grpConfig.Controls.Add(Me.nudLimit)
Me.grpConfig.Controls.Add(Me.btnExclude)
Me.grpConfig.Controls.Add(Me.btnInclude)
Me.grpConfig.Controls.Add(Me.txtID)
@@ -168,12 +172,33 @@ Partial Class frmGameManager
Me.grpConfig.TabStop = False
Me.grpConfig.Text = "Configuration"
'
'lblLimit
'
Me.lblLimit.AutoSize = True
Me.lblLimit.Location = New System.Drawing.Point(375, 130)
Me.lblLimit.Name = "lblLimit"
Me.lblLimit.Size = New System.Drawing.Size(68, 13)
Me.lblLimit.TabIndex = 13
Me.lblLimit.Text = "Backup Limit"
Me.lblLimit.Visible = False
'
'nudLimit
'
Me.nudLimit.Location = New System.Drawing.Point(329, 128)
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 = 12
Me.nudLimit.TextAlign = System.Windows.Forms.HorizontalAlignment.Right
Me.nudLimit.Value = New Decimal(New Integer() {2, 0, 0, 0})
Me.nudLimit.Visible = False
'
'btnExclude
'
Me.btnExclude.Location = New System.Drawing.Point(9, 125)
Me.btnExclude.Name = "btnExclude"
Me.btnExclude.Size = New System.Drawing.Size(175, 23)
Me.btnExclude.TabIndex = 13
Me.btnExclude.TabIndex = 9
Me.btnExclude.Text = "E&xclude Items..."
Me.btnExclude.UseVisualStyleBackColor = True
'
@@ -182,7 +207,7 @@ Partial Class frmGameManager
Me.btnInclude.Location = New System.Drawing.Point(9, 97)
Me.btnInclude.Name = "btnInclude"
Me.btnInclude.Size = New System.Drawing.Size(175, 23)
Me.btnInclude.TabIndex = 10
Me.btnInclude.TabIndex = 8
Me.btnInclude.Text = "In&clude Items..."
Me.btnInclude.UseVisualStyleBackColor = True
'
@@ -192,7 +217,7 @@ Partial Class frmGameManager
Me.txtID.Location = New System.Drawing.Point(489, 19)
Me.txtID.Name = "txtID"
Me.txtID.Size = New System.Drawing.Size(30, 20)
Me.txtID.TabIndex = 16
Me.txtID.TabIndex = 0
Me.txtID.TabStop = False
Me.txtID.Visible = False
'
@@ -201,7 +226,7 @@ Partial Class frmGameManager
Me.btnSavePathBrowse.Location = New System.Drawing.Point(489, 71)
Me.btnSavePathBrowse.Name = "btnSavePathBrowse"
Me.btnSavePathBrowse.Size = New System.Drawing.Size(30, 20)
Me.btnSavePathBrowse.TabIndex = 9
Me.btnSavePathBrowse.TabIndex = 7
Me.btnSavePathBrowse.Text = "..."
Me.btnSavePathBrowse.UseVisualStyleBackColor = True
'
@@ -210,7 +235,7 @@ Partial Class frmGameManager
Me.btnProcessBrowse.Location = New System.Drawing.Point(489, 45)
Me.btnProcessBrowse.Name = "btnProcessBrowse"
Me.btnProcessBrowse.Size = New System.Drawing.Size(30, 20)
Me.btnProcessBrowse.TabIndex = 7
Me.btnProcessBrowse.TabIndex = 5
Me.btnProcessBrowse.Text = "..."
Me.btnProcessBrowse.UseVisualStyleBackColor = True
'
@@ -243,18 +268,18 @@ Partial Class frmGameManager
'
'txtExclude
'
Me.txtExclude.Location = New System.Drawing.Point(363, 128)
Me.txtExclude.Location = New System.Drawing.Point(489, 122)
Me.txtExclude.Name = "txtExclude"
Me.txtExclude.Size = New System.Drawing.Size(156, 20)
Me.txtExclude.Size = New System.Drawing.Size(30, 20)
Me.txtExclude.TabIndex = 0
Me.txtExclude.TabStop = False
Me.txtExclude.Visible = False
'
'txtFileType
'
Me.txtFileType.Location = New System.Drawing.Point(363, 99)
Me.txtFileType.Location = New System.Drawing.Point(489, 99)
Me.txtFileType.Name = "txtFileType"
Me.txtFileType.Size = New System.Drawing.Size(156, 20)
Me.txtFileType.Size = New System.Drawing.Size(30, 20)
Me.txtFileType.TabIndex = 0
Me.txtFileType.TabStop = False
Me.txtFileType.Visible = False
@@ -264,9 +289,9 @@ Partial Class frmGameManager
Me.chkTimeStamp.AutoSize = True
Me.chkTimeStamp.Location = New System.Drawing.Point(190, 129)
Me.chkTimeStamp.Name = "chkTimeStamp"
Me.chkTimeStamp.Size = New System.Drawing.Size(146, 17)
Me.chkTimeStamp.TabIndex = 14
Me.chkTimeStamp.Text = "Time stamp each backup"
Me.chkTimeStamp.Size = New System.Drawing.Size(133, 17)
Me.chkTimeStamp.TabIndex = 11
Me.chkTimeStamp.Text = "Save multiple backups"
Me.chkTimeStamp.UseVisualStyleBackColor = True
'
'chkFolderSave
@@ -275,7 +300,7 @@ Partial Class frmGameManager
Me.chkFolderSave.Location = New System.Drawing.Point(190, 101)
Me.chkFolderSave.Name = "chkFolderSave"
Me.chkFolderSave.Size = New System.Drawing.Size(109, 17)
Me.chkFolderSave.TabIndex = 11
Me.chkFolderSave.TabIndex = 10
Me.chkFolderSave.Text = "Save entire folder"
Me.chkFolderSave.UseVisualStyleBackColor = True
'
@@ -284,21 +309,21 @@ Partial Class frmGameManager
Me.txtSavePath.Location = New System.Drawing.Point(69, 71)
Me.txtSavePath.Name = "txtSavePath"
Me.txtSavePath.Size = New System.Drawing.Size(414, 20)
Me.txtSavePath.TabIndex = 8
Me.txtSavePath.TabIndex = 6
'
'txtProcess
'
Me.txtProcess.Location = New System.Drawing.Point(69, 45)
Me.txtProcess.Name = "txtProcess"
Me.txtProcess.Size = New System.Drawing.Size(414, 20)
Me.txtProcess.TabIndex = 6
Me.txtProcess.TabIndex = 4
'
'txtName
'
Me.txtName.Location = New System.Drawing.Point(69, 19)
Me.txtName.Name = "txtName"
Me.txtName.Size = New System.Drawing.Size(414, 20)
Me.txtName.TabIndex = 5
Me.txtName.TabIndex = 3
'
'chkMonitorOnly
'
@@ -468,18 +493,17 @@ Partial Class frmGameManager
'grpStats
'
Me.grpStats.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.grpStats.Controls.Add(Me.cboRemoteBackup)
Me.grpStats.Controls.Add(Me.lblRestorePathData)
Me.grpStats.Controls.Add(Me.lblBackupFileData)
Me.grpStats.Controls.Add(Me.lblCurrentBackupData)
Me.grpStats.Controls.Add(Me.lblLatestBackupData)
Me.grpStats.Controls.Add(Me.lblLocalBackupData)
Me.grpStats.Controls.Add(Me.lblRestorePath)
Me.grpStats.Controls.Add(Me.btnChangeBackup)
Me.grpStats.Controls.Add(Me.btnOpenRestorePath)
Me.grpStats.Controls.Add(Me.btnOpenBackupFile)
Me.grpStats.Controls.Add(Me.btnDeleteBackup)
Me.grpStats.Controls.Add(Me.lblBackupFile)
Me.grpStats.Controls.Add(Me.lblLatestBackup)
Me.grpStats.Controls.Add(Me.lblCurrentBackup)
Me.grpStats.Controls.Add(Me.lblRemote)
Me.grpStats.Controls.Add(Me.lblLocalData)
Me.grpStats.Location = New System.Drawing.Point(247, 365)
Me.grpStats.Name = "grpStats"
Me.grpStats.Size = New System.Drawing.Size(525, 154)
@@ -487,6 +511,15 @@ Partial Class frmGameManager
Me.grpStats.TabStop = False
Me.grpStats.Text = "Backup Information"
'
'cboRemoteBackup
'
Me.cboRemoteBackup.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
Me.cboRemoteBackup.FormattingEnabled = True
Me.cboRemoteBackup.Location = New System.Drawing.Point(96, 24)
Me.cboRemoteBackup.Name = "cboRemoteBackup"
Me.cboRemoteBackup.Size = New System.Drawing.Size(387, 21)
Me.cboRemoteBackup.TabIndex = 12
'
'lblRestorePathData
'
Me.lblRestorePathData.AutoEllipsis = True
@@ -509,27 +542,16 @@ Partial Class frmGameManager
Me.lblBackupFileData.Tag = "wipe"
Me.lblBackupFileData.TextAlign = System.Drawing.ContentAlignment.MiddleLeft
'
'lblCurrentBackupData
'lblLocalBackupData
'
Me.lblCurrentBackupData.AutoEllipsis = True
Me.lblCurrentBackupData.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
Me.lblCurrentBackupData.Location = New System.Drawing.Point(96, 49)
Me.lblCurrentBackupData.Name = "lblCurrentBackupData"
Me.lblCurrentBackupData.Size = New System.Drawing.Size(387, 20)
Me.lblCurrentBackupData.TabIndex = 5
Me.lblCurrentBackupData.Tag = "wipe"
Me.lblCurrentBackupData.TextAlign = System.Drawing.ContentAlignment.MiddleLeft
'
'lblLatestBackupData
'
Me.lblLatestBackupData.AutoEllipsis = True
Me.lblLatestBackupData.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
Me.lblLatestBackupData.Location = New System.Drawing.Point(96, 23)
Me.lblLatestBackupData.Name = "lblLatestBackupData"
Me.lblLatestBackupData.Size = New System.Drawing.Size(387, 20)
Me.lblLatestBackupData.TabIndex = 4
Me.lblLatestBackupData.Tag = "wipe"
Me.lblLatestBackupData.TextAlign = System.Drawing.ContentAlignment.MiddleLeft
Me.lblLocalBackupData.AutoEllipsis = True
Me.lblLocalBackupData.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
Me.lblLocalBackupData.Location = New System.Drawing.Point(96, 49)
Me.lblLocalBackupData.Name = "lblLocalBackupData"
Me.lblLocalBackupData.Size = New System.Drawing.Size(387, 20)
Me.lblLocalBackupData.TabIndex = 5
Me.lblLocalBackupData.Tag = "wipe"
Me.lblLocalBackupData.TextAlign = System.Drawing.ContentAlignment.MiddleLeft
'
'lblRestorePath
'
@@ -540,16 +562,6 @@ Partial Class frmGameManager
Me.lblRestorePath.TabIndex = 3
Me.lblRestorePath.Text = "Restore Path:"
'
'btnChangeBackup
'
Me.btnChangeBackup.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.btnChangeBackup.Location = New System.Drawing.Point(129, 125)
Me.btnChangeBackup.Name = "btnChangeBackup"
Me.btnChangeBackup.Size = New System.Drawing.Size(114, 23)
Me.btnChangeBackup.TabIndex = 9
Me.btnChangeBackup.Text = "&Change Backup File"
Me.btnChangeBackup.UseVisualStyleBackColor = True
'
'btnOpenRestorePath
'
Me.btnOpenRestorePath.Location = New System.Drawing.Point(369, 125)
@@ -570,7 +582,7 @@ Partial Class frmGameManager
'
'btnDeleteBackup
'
Me.btnDeleteBackup.Location = New System.Drawing.Point(9, 125)
Me.btnDeleteBackup.Location = New System.Drawing.Point(129, 125)
Me.btnDeleteBackup.Name = "btnDeleteBackup"
Me.btnDeleteBackup.Size = New System.Drawing.Size(114, 23)
Me.btnDeleteBackup.TabIndex = 8
@@ -586,23 +598,23 @@ Partial Class frmGameManager
Me.lblBackupFile.TabIndex = 2
Me.lblBackupFile.Text = "Backup File:"
'
'lblLatestBackup
'lblRemote
'
Me.lblLatestBackup.AutoSize = True
Me.lblLatestBackup.Location = New System.Drawing.Point(6, 27)
Me.lblLatestBackup.Name = "lblLatestBackup"
Me.lblLatestBackup.Size = New System.Drawing.Size(79, 13)
Me.lblLatestBackup.TabIndex = 0
Me.lblLatestBackup.Text = "Latest Backup:"
Me.lblRemote.AutoSize = True
Me.lblRemote.Location = New System.Drawing.Point(6, 27)
Me.lblRemote.Name = "lblRemote"
Me.lblRemote.Size = New System.Drawing.Size(73, 13)
Me.lblRemote.TabIndex = 0
Me.lblRemote.Text = "Backup Data:"
'
'lblCurrentBackup
'lblLocalData
'
Me.lblCurrentBackup.AutoSize = True
Me.lblCurrentBackup.Location = New System.Drawing.Point(6, 53)
Me.lblCurrentBackup.Name = "lblCurrentBackup"
Me.lblCurrentBackup.Size = New System.Drawing.Size(84, 13)
Me.lblCurrentBackup.TabIndex = 1
Me.lblCurrentBackup.Text = "Current Backup:"
Me.lblLocalData.AutoSize = True
Me.lblLocalData.Location = New System.Drawing.Point(6, 53)
Me.lblLocalData.Name = "lblLocalData"
Me.lblLocalData.Size = New System.Drawing.Size(62, 13)
Me.lblLocalData.TabIndex = 1
Me.lblLocalData.Text = "Local Data:"
'
'btnMarkAsRestored
'
@@ -807,6 +819,7 @@ Partial Class frmGameManager
Me.Text = "Game Manager"
Me.grpConfig.ResumeLayout(False)
Me.grpConfig.PerformLayout()
CType(Me.nudLimit, System.ComponentModel.ISupportInitialize).EndInit()
Me.grpExtra.ResumeLayout(False)
Me.grpExtra.PerformLayout()
CType(Me.pbIcon, System.ComponentModel.ISupportInitialize).EndInit()
@@ -857,8 +870,8 @@ Partial Class frmGameManager
Friend WithEvents btnIconBrowse As System.Windows.Forms.Button
Friend WithEvents txtIcon As System.Windows.Forms.TextBox
Friend WithEvents txtID As System.Windows.Forms.TextBox
Friend WithEvents lblLatestBackup As System.Windows.Forms.Label
Friend WithEvents lblCurrentBackup As System.Windows.Forms.Label
Friend WithEvents lblRemote As System.Windows.Forms.Label
Friend WithEvents lblLocalData As System.Windows.Forms.Label
Friend WithEvents chkEnabled As System.Windows.Forms.CheckBox
Friend WithEvents lblBackupFile As System.Windows.Forms.Label
Friend WithEvents btnMarkAsRestored As System.Windows.Forms.Button
@@ -883,9 +896,10 @@ Partial Class frmGameManager
Friend WithEvents cmsFile As System.Windows.Forms.ToolStripMenuItem
Friend WithEvents txtQuickFilter As TextBox
Friend WithEvents lblQuickFilter As Label
Friend WithEvents btnChangeBackup As Button
Friend WithEvents lblLatestBackupData As Label
Friend WithEvents lblCurrentBackupData As Label
Friend WithEvents lblLocalBackupData As Label
Friend WithEvents lblRestorePathData As Label
Friend WithEvents lblBackupFileData As Label
Friend WithEvents lblLimit As Label
Friend WithEvents nudLimit As NumericUpDown
Friend WithEvents cboRemoteBackup As ComboBox
End Class
+131 -115
View File
@@ -11,7 +11,7 @@ Public Class frmGameManager
Private bTriggerBackup As Boolean = False
Private bTriggerRestore As Boolean = False
Private oBackupList As New List(Of clsGame)
Private oRestoreList As New List(Of clsGame)
Private oRestoreList As New Hashtable
Private oAppData As Hashtable
Private oLocalBackupData As SortedList
Private oRemoteBackupData As SortedList
@@ -114,11 +114,11 @@ Public Class frmGameManager
End Set
End Property
Property RestoreList As List(Of clsGame)
Property RestoreList As Hashtable
Get
Return oRestoreList
End Get
Set(value As List(Of clsGame))
Set(value As Hashtable)
oRestoreList = value
End Set
End Property
@@ -193,7 +193,7 @@ Public Class frmGameManager
oBackupItem.Name = oNewApp.Name
oBackupItem.FileName = oBackupItem.FileName.Replace(oOriginalApp.Name, oNewApp.Name)
mgrManifest.DoManifestNameUpdate(oOriginalApp.Name, oBackupItem, mgrSQLite.Database.Local)
mgrManifest.DoManifestUpdateByID(oBackupItem, mgrSQLite.Database.Local)
Next
oLocalBackupData = mgrManifest.ReadLatestManifest(mgrSQLite.Database.Local)
End If
@@ -205,7 +205,7 @@ Public Class frmGameManager
For Each oBackupItem As clsBackup In oBackupItems
oBackupItem.Name = oNewApp.Name
oBackupItem.FileName = oBackupItem.FileName.Replace(oOriginalApp.Name, oNewApp.Name)
mgrManifest.DoManifestNameUpdate(oOriginalApp.Name, oBackupItem, mgrSQLite.Database.Remote)
mgrManifest.DoManifestUpdateByID(oBackupItem, mgrSQLite.Database.Remote)
Next
oRemoteBackupData = mgrManifest.ReadLatestManifest(mgrSQLite.Database.Remote)
End If
@@ -547,20 +547,51 @@ Public Class frmGameManager
ModeChange()
End Sub
Private Sub GetBackupInfo(ByVal oApp As clsGame)
Dim oBackupInfo As clsBackup
Private Sub UpdateBackupInfo(ByVal sManifestID As String)
Dim sFileName As String
If sManifestID <> String.Empty Then
CurrentBackupItem = mgrManifest.DoManifestGetByID(sManifestID, mgrSQLite.Database.Remote)
sFileName = BackupFolder & CurrentBackupItem.FileName
If File.Exists(sFileName) Then
lblBackupFileData.Text = Path.GetFileName(CurrentBackupItem.FileName) & " (" & mgrCommon.GetFileSize(sFileName) & ")"
Else
lblBackupFileData.Text = frmGameManager_ErrorNoBackupExists
End If
mgrRestore.DoPathOverride(CurrentBackupItem, CurrentGame)
lblRestorePathData.Text = CurrentBackupItem.RestorePath
End If
End Sub
Private Sub GetBackupInfo(ByVal oApp As clsGame)
Dim oBackupInfo As clsBackup
Dim oCurrentBackup As clsBackup
Dim oCurrentBackups As List(Of clsBackup)
Dim sFileName As String
Dim oComboItems As New List(Of KeyValuePair(Of String, String))
'cboRemoteBackup
cboRemoteBackup.ValueMember = "Key"
cboRemoteBackup.DisplayMember = "Value"
If oRemoteBackupData.Contains(oApp.Name) Then
oCurrentBackups = mgrManifest.DoManifestGetByName(oApp.Name, mgrSQLite.Database.Remote)
For Each oCurrentBackup In oCurrentBackups
oComboItems.Add(New KeyValuePair(Of String, String)(oCurrentBackup.ID, mgrCommon.FormatString(frmGameManager_BackupTimeAndName, New String() {oCurrentBackup.DateUpdated, oCurrentBackup.UpdatedBy})))
Next
CurrentBackupItem = DirectCast(oRemoteBackupData(oApp.Name), clsBackup)
lblLatestBackupData.Text = mgrCommon.FormatString(frmGameManager_BackupTimeAndName, New String() {CurrentBackupItem.DateUpdated, CurrentBackupItem.UpdatedBy})
lblLatestBackupData.ForeColor = Color.Green
sFileName = BackupFolder & CurrentBackupItem.FileName
btnOpenBackupFile.Enabled = True
btnOpenRestorePath.Enabled = True
btnRestore.Enabled = True
btnChangeBackup.Enabled = True
btnDeleteBackup.Enabled = True
If File.Exists(sFileName) Then
@@ -572,71 +603,75 @@ Public Class frmGameManager
mgrRestore.DoPathOverride(CurrentBackupItem, oApp)
lblRestorePathData.Text = CurrentBackupItem.RestorePath
Else
lblLatestBackupData.Text = frmGameManager_Never
oComboItems.Add(New KeyValuePair(Of String, String)(String.Empty, frmGameManager_Never))
lblBackupFileData.Text = String.Empty
lblRestorePathData.Text = String.Empty
btnOpenBackupFile.Enabled = False
btnOpenRestorePath.Enabled = False
btnRestore.Enabled = False
btnChangeBackup.Enabled = False
btnDeleteBackup.Enabled = False
End If
cboRemoteBackup.DataSource = oComboItems
If oLocalBackupData.Contains(oApp.Name) Then
oBackupInfo = DirectCast(oLocalBackupData(oApp.Name), clsBackup)
lblCurrentBackupData.Text = mgrCommon.FormatString(frmGameManager_BackupTimeAndName, New String() {oBackupInfo.DateUpdated, oBackupInfo.UpdatedBy})
lblLocalBackupData.Text = mgrCommon.FormatString(frmGameManager_BackupTimeAndName, New String() {oBackupInfo.DateUpdated, oBackupInfo.UpdatedBy})
Else
lblCurrentBackupData.Text = frmGameManager_Never
lblLocalBackupData.Text = frmGameManager_Never
End If
If lblLatestBackupData.Text = frmGameManager_Never And lblCurrentBackupData.Text = frmGameManager_Never Then
If oComboItems(0).Value = frmGameManager_Never And lblLocalBackupData.Text = frmGameManager_Never Then
btnMarkAsRestored.Enabled = False
lblLatestBackupData.ForeColor = Color.Black
lblCurrentBackupData.ForeColor = Color.Black
ElseIf lblLatestBackupData.Text = frmGameManager_Never And lblCurrentBackupData.Text <> frmGameManager_Never Then
lblLocalBackupData.ForeColor = Color.Black
ElseIf oComboItems(0).Value = frmGameManager_Never And lblLocalBackupData.Text <> frmGameManager_Never Then
btnMarkAsRestored.Enabled = False
lblLatestBackupData.ForeColor = Color.Black
lblCurrentBackupData.ForeColor = Color.Red
ElseIf lblLatestBackupData.Text <> lblCurrentBackupData.Text Then
lblCurrentBackupData.ForeColor = Color.Red
lblLocalBackupData.ForeColor = Color.Red
ElseIf oComboItems(0).Value <> lblLocalBackupData.Text Then
lblLocalBackupData.ForeColor = Color.Red
btnMarkAsRestored.Enabled = True
Else
lblCurrentBackupData.ForeColor = Color.Green
lblLocalBackupData.ForeColor = Color.Green
btnMarkAsRestored.Enabled = False
End If
End Sub
Private Sub DeleteBackup()
Dim oDir As DirectoryInfo
Dim sSubDir As String
'Dim oDir As DirectoryInfo
'Dim sSubDir As String
If mgrCommon.ShowMessage(frmGameManager_ConfirmBackupDelete, CurrentBackupItem.Name, MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then
mgrManifest.DoManifestDeletebyID(CurrentBackupItem, mgrSQLite.Database.Local)
If mgrCommon.ShowMessage(frmGameManager_ConfirmBackupDelete, Path.GetFileName(CurrentBackupItem.FileName), MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then
'Delete the specific remote manifest entry
mgrManifest.DoManifestDeletebyID(CurrentBackupItem, mgrSQLite.Database.Remote)
'If a remote manifest entry no longer exists for this game, delete the local entry
If Not mgrManifest.DoGlobalManifestCheck(CurrentBackupItem.Name, mgrSQLite.Database.Remote) Then
mgrManifest.DoManifestDeletebyName(CurrentBackupItem, mgrSQLite.Database.Local)
End If
'Delete referenced backup file from the backup folder
mgrCommon.DeleteFile(BackupFolder & CurrentBackupItem.FileName)
'Check if using backup sub-directories (Probably not the best way to check for this)
If CurrentBackupItem.FileName.StartsWith(CurrentBackupItem.Name & Path.DirectorySeparatorChar) Then
'Build sub-dir backup path
sSubDir = BackupFolder & CurrentBackupItem.Name
'If CurrentBackupItem.FileName.StartsWith(CurrentBackupItem.Name & Path.DirectorySeparatorChar) Then
' 'Build sub-dir backup path
' sSubDir = BackupFolder & CurrentBackupItem.Name
If Directory.Exists(sSubDir) Then
'Check if there's any sub-directories or files remaining
oDir = New DirectoryInfo(sSubDir)
If oDir.GetDirectories.Length > 0 Or oDir.GetFiles.Length > 0 Then
'Confirm
If mgrCommon.ShowMessage(frmGameManager_ConfirmBackupFolderDelete, New String() {sSubDir, oDir.GetDirectories.Length, oDir.GetFiles.Length}, MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then
If Directory.Exists(sSubDir) Then mgrCommon.DeleteDirectory(sSubDir, True)
End If
Else
'Folder is empty, delete the empty sub-folder
If Directory.Exists(sSubDir) Then mgrCommon.DeleteDirectory(sSubDir)
End If
End If
End If
' If Directory.Exists(sSubDir) Then
' 'Check if there's any sub-directories or files remaining
' oDir = New DirectoryInfo(sSubDir)
' If oDir.GetDirectories.Length > 0 Or oDir.GetFiles.Length > 0 Then
' 'Confirm
' If mgrCommon.ShowMessage(frmGameManager_ConfirmBackupFolderDelete, New String() {sSubDir, oDir.GetDirectories.Length, oDir.GetFiles.Length}, MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then
' If Directory.Exists(sSubDir) Then mgrCommon.DeleteDirectory(sSubDir, True)
' End If
' Else
' 'Folder is empty, delete the empty sub-folder
' If Directory.Exists(sSubDir) Then mgrCommon.DeleteDirectory(sSubDir)
' End If
' End If
'End If
LoadBackupData()
@@ -665,6 +700,7 @@ Public Class frmGameManager
txtExclude.Text = oApp.ExcludeList
chkFolderSave.Checked = oApp.FolderSave
chkTimeStamp.Checked = oApp.AppendTimeStamp
nudLimit.Value = oApp.BackupLimit
chkEnabled.Checked = oApp.Enabled
chkMonitorOnly.Checked = oApp.MonitorOnly
@@ -752,7 +788,9 @@ Public Class frmGameManager
ElseIf TypeOf ctl Is Label Then
If ctl.Tag = "wipe" Then DirectCast(ctl, Label).Text = String.Empty
ElseIf TypeOf ctl Is NumericUpDown Then
DirectCast(ctl, NumericUpDown).Value = 0
DirectCast(ctl, NumericUpDown).Value = DirectCast(ctl, NumericUpDown).Minimum
ElseIf TypeOf ctl Is ComboBox Then
DirectCast(ctl, ComboBox).DataSource = Nothing
End If
Next
End Sub
@@ -783,7 +821,6 @@ Public Class frmGameManager
btnBackup.Enabled = False
btnMarkAsRestored.Enabled = False
btnRestore.Enabled = False
btnChangeBackup.Enabled = False
btnDeleteBackup.Enabled = False
btnOpenBackupFile.Enabled = False
btnOpenRestorePath.Enabled = False
@@ -812,7 +849,6 @@ Public Class frmGameManager
btnBackup.Enabled = False
btnMarkAsRestored.Enabled = False
btnRestore.Enabled = False
btnChangeBackup.Enabled = False
btnDeleteBackup.Enabled = False
btnOpenBackupFile.Enabled = False
btnOpenRestorePath.Enabled = False
@@ -966,6 +1002,16 @@ Public Class frmGameManager
End If
End Sub
Private Sub TimeStampModeChange()
If chkTimeStamp.Checked Then
nudLimit.Visible = True
lblLimit.Visible = True
Else
nudLimit.Visible = False
lblLimit.Visible = False
End If
End Sub
Private Sub EditApp()
eCurrentMode = eModes.Edit
ModeChange()
@@ -1033,6 +1079,7 @@ Public Class frmGameManager
oApp.ExcludeList = txtExclude.Text
oApp.FolderSave = chkFolderSave.Checked
oApp.AppendTimeStamp = chkTimeStamp.Checked
oApp.BackupLimit = nudLimit.Value
oApp.Enabled = chkEnabled.Checked
oApp.MonitorOnly = chkMonitorOnly.Checked
oApp.ProcessPath = txtAppPath.Text
@@ -1148,53 +1195,6 @@ Public Class frmGameManager
Return True
End Function
Private Sub ChangeBackup()
Dim sNewBackup As String
Dim sNewBackupFile As String
Dim sNewBackupPath As String
Dim sBackupPath As String = Path.GetDirectoryName(BackupFolder & CurrentBackupItem.FileName)
Dim sBackupFile As String = Path.GetFileName(BackupFolder & CurrentBackupItem.FileName)
Dim oBackup As clsBackup = oCurrentBackupItem
sNewBackup = mgrCommon.OpenFileBrowser(mgrCommon.FormatString(frmGameManager_BrowseBackup, CurrentGame.CroppedName), "7z", frmGameManager_BrowseBackupType, sBackupPath, False)
'Check that a selection was made
If sNewBackup <> String.Empty Then
sNewBackupFile = Path.GetFileName(sNewBackup)
sNewBackupPath = Path.GetDirectoryName(sNewBackup)
'The new file must be located in the current backup folder for the selected game
If sNewBackupPath <> sBackupPath Then
mgrCommon.ShowMessage(frmGameManager_ErrorBackupChangePath, CurrentGame.CroppedName, MsgBoxStyle.Exclamation)
'Check that the selection is a new file
ElseIf sNewBackupFile = sBackupFile Then
mgrCommon.ShowMessage(frmGameManager_ErrorBackupChangeFileName, sNewBackupFile, MsgBoxStyle.Exclamation)
Else
'Verify that the user still wants to continue
If mgrCommon.ShowMessage(frmGameManager_ConfirmBackupChange, New String() {sNewBackupFile, CurrentGame.CroppedName}, MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then
'Set the new file
oBackup.FileName = oBackup.FileName.Replace(Path.GetFileName(oBackup.FileName), sNewBackupFile)
'Clear the checksum (old checksums aren't stored)
oBackup.CheckSum = String.Empty
'Reset date
oBackup.DateUpdated = Date.Now
mgrManifest.DoManifestUpdateByID(oBackup, mgrSQLite.Database.Remote)
'Refresh backup data and GUI
bIsLoading = True
LoadBackupData()
GetBackupInfo(CurrentGame)
bIsLoading = False
'Check if we want to restore immediately after changing
If mgrCommon.ShowMessage(frmGameManager_ConfirmBackupChangeRestore, sNewBackupFile, MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then
TriggerSelectedRestore(False)
End If
End If
End If
End If
End Sub
Private Sub MarkAsRestored()
Dim oData As KeyValuePair(Of String, String)
Dim oGameBackup As clsBackup
@@ -1212,8 +1212,8 @@ Public Class frmGameManager
If oMarkList.Count = 1 Then
If mgrCommon.ShowMessage(frmGameManager_ConfirmMark, oMarkList(0).Name, MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then
bWasUpdated = True
If mgrManifest.DoManifestCheck(oMarkList(0).Name, oMarkList(0).FileName, mgrSQLite.Database.Local) Then
mgrManifest.DoManifestUpdateByID(oMarkList(0), mgrSQLite.Database.Local)
If mgrManifest.DoGlobalManifestCheck(oMarkList(0).Name, mgrSQLite.Database.Local) Then
mgrManifest.DoManifestUpdateByName(oMarkList(0), mgrSQLite.Database.Local)
Else
mgrManifest.DoManifestAdd(oMarkList(0), mgrSQLite.Database.Local)
End If
@@ -1222,8 +1222,8 @@ Public Class frmGameManager
If mgrCommon.ShowMessage(frmGameManager_ConfirmMultiMark, oMarkList.Count, MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then
bWasUpdated = True
For Each oGameBackup In oMarkList
If mgrManifest.DoManifestCheck(oGameBackup.Name, oGameBackup.FileName, mgrSQLite.Database.Local) Then
mgrManifest.DoManifestUpdateByID(oGameBackup, mgrSQLite.Database.Local)
If mgrManifest.DoGlobalManifestCheck(oGameBackup.Name, mgrSQLite.Database.Local) Then
mgrManifest.DoManifestUpdateByName(oGameBackup, mgrSQLite.Database.Local)
Else
mgrManifest.DoManifestAdd(oGameBackup, mgrSQLite.Database.Local)
End If
@@ -1293,25 +1293,35 @@ Public Class frmGameManager
Dim oData As KeyValuePair(Of String, String)
Dim sMsg As String = String.Empty
Dim oGame As clsGame
Dim oBackup As clsBackup
Dim bDoRestore As Boolean = False
If lstGames.SelectedItems.Count > 0 Then
RestoreList.Clear()
For Each oData In lstGames.SelectedItems
If oRemoteBackupData.Contains(oData.Value) Then
oGame = DirectCast(AppData(oData.Key), clsGame)
'Filter out any games set to monitor only
If Not oGame.MonitorOnly Then RestoreList.Add(oGame)
End If
Next
If lstGames.SelectedItems.Count = 1 Then
RestoreList.Add(CurrentGame, CurrentBackupItem)
Else
For Each oData In lstGames.SelectedItems
If oRemoteBackupData.Contains(oData.Value) Then
oGame = DirectCast(AppData(oData.Key), clsGame)
oBackup = DirectCast(oRemoteBackupData(oData.Value), clsBackup)
'Filter out any games set to monitor only
If Not oGame.MonitorOnly Then RestoreList.Add(oGame, oBackup)
End If
Next
End If
If RestoreList.Count = 1 Then
bDoRestore = True
If Not mgrRestore.CheckManifest(RestoreList(0).Name) Then
sMsg = mgrCommon.FormatString(frmGameManager_ConfirmRestoreAnyway, RestoreList(0).Name)
oGame = New clsGame
For Each de As DictionaryEntry In RestoreList
oGame = DirectCast(de.Key, clsGame)
Next
If Not mgrRestore.CheckManifest(oGame.Name) Then
sMsg = mgrCommon.FormatString(frmGameManager_ConfirmRestoreAnyway, oGame.Name)
Else
sMsg = mgrCommon.FormatString(frmGameManager_ConfirmRestore, RestoreList(0).Name)
sMsg = mgrCommon.FormatString(frmGameManager_ConfirmRestore, oGame.Name)
End If
ElseIf RestoreList.Count > 1 Then
bDoRestore = True
@@ -1399,11 +1409,10 @@ Public Class frmGameManager
lblRestorePath.Text = frmGameManager_lblRestorePath
btnOpenRestorePath.Text = frmGameManager_btnOpenRestorePath
btnOpenBackupFile.Text = frmGameManager_btnOpenBackupFile
btnChangeBackup.Text = frmGameManager_btnChangeBackup
btnDeleteBackup.Text = frmGameManager_btnDeleteBackup
lblBackupFile.Text = frmGameManager_lblBackupFile
lblLatestBackup.Text = frmGameManager_lblLatestbackup
lblCurrentBackup.Text = frmGameManager_lblCurrentBackup
lblRemote.Text = frmGameManager_lblRemote
lblLocalData.Text = frmGameManager_lblLocalData
btnIconBrowse.Text = frmGameManager_btnIconBrowse
lblVersion.Text = frmGameManager_lblVersion
lblCompany.Text = frmGameManager_lblCompany
@@ -1427,6 +1436,7 @@ Public Class frmGameManager
cmsOfficial.Text = frmGameManager_cmsOfficial
cmsFile.Text = frmGameManager_cmsFile
lblQuickFilter.Text = frmGameManager_lblQuickFilter
lblLimit.Text = frmGameManager_lblLimit
'Init Filter Timer
tmFilterTimer = New Timer()
@@ -1537,10 +1547,6 @@ Public Class frmGameManager
DeleteBackup()
End Sub
Private Sub btnChangeBackup_Click(sender As Object, e As EventArgs) Handles btnChangeBackup.Click
ChangeBackup()
End Sub
Private Sub btnMarkAsRestored_Click(sender As Object, e As EventArgs) Handles btnMarkAsRestored.Click
MarkAsRestored()
End Sub
@@ -1576,6 +1582,16 @@ Public Class frmGameManager
MonitorOnlyModeChange()
End Sub
Private Sub chkTimeStamp_CheckedChanged(sender As Object, e As EventArgs) Handles chkTimeStamp.CheckedChanged
TimeStampModeChange()
End Sub
Private Sub cboRemoteBackup_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cboRemoteBackup.SelectedIndexChanged
If Not bIsLoading Then
UpdateBackupInfo(DirectCast(cboRemoteBackup.SelectedItem, KeyValuePair(Of String, String)).Key)
End If
End Sub
Private Sub btnImport_Click(sender As Object, e As EventArgs) Handles btnImport.Click
cmsImport.Show(btnImport, New Drawing.Point(70, 11), ToolStripDropDownDirection.AboveRight)
End Sub
+4 -4
View File
@@ -157,8 +157,7 @@ Public Class frmMain
OperationEnded()
End Sub
Private Sub RunRestore(ByVal oRestoreList As List(Of clsGame))
Dim oBackupData As SortedList = mgrManifest.ReadLatestManifest(mgrSQLite.Database.Remote)
Private Sub RunRestore(ByVal oRestoreList As Hashtable)
Dim oGame As clsGame
Dim oReadyList As New List(Of clsBackup)
Dim oRestoreInfo As clsBackup
@@ -168,9 +167,10 @@ Public Class frmMain
OperationStarted()
'Build Restore List
For Each oGame In oRestoreList
For Each de As DictionaryEntry In oRestoreList
bPathVerified = False
oRestoreInfo = oBackupData(oGame.Name)
oGame = DirectCast(de.Key, clsGame)
oRestoreInfo = DirectCast(de.Value, clsBackup)
If mgrRestore.CheckPath(oRestoreInfo, oGame, bTriggerReload) Then
bPathVerified = True
+2 -2
View File
@@ -104,9 +104,9 @@ Partial Class frmSyncFields
Me.chkTimeStamp.AutoSize = True
Me.chkTimeStamp.Location = New System.Drawing.Point(6, 19)
Me.chkTimeStamp.Name = "chkTimeStamp"
Me.chkTimeStamp.Size = New System.Drawing.Size(146, 17)
Me.chkTimeStamp.Size = New System.Drawing.Size(133, 17)
Me.chkTimeStamp.TabIndex = 0
Me.chkTimeStamp.Text = "Time stamp each backup"
Me.chkTimeStamp.Text = "Save multiple backups"
Me.chkTimeStamp.UseVisualStyleBackColor = True
'
'btnCancel
+31 -3
View File
@@ -50,15 +50,15 @@ Public Class mgrBackup
oItem.CheckSum = sCheckSum
'Save Remote Manifest
If mgrManifest.DoManifestCheck(oItem.Name, oItem.FileName, mgrSQLite.Database.Remote) Then
If mgrManifest.DoSpecificManifestCheck(oItem.Name, oItem.FileName, mgrSQLite.Database.Remote) Then
mgrManifest.DoManifestUpdateByID(oItem, mgrSQLite.Database.Remote)
Else
mgrManifest.DoManifestAdd(oItem, mgrSQLite.Database.Remote)
End If
'Save Local Manifest
If mgrManifest.DoManifestCheck(oItem.Name, oItem.FileName, mgrSQLite.Database.Local) Then
mgrManifest.DoManifestUpdateByID(oItem, mgrSQLite.Database.Local)
If mgrManifest.DoGlobalManifestCheck(oItem.Name, mgrSQLite.Database.Local) Then
mgrManifest.DoManifestUpdateByName(oItem, mgrSQLite.Database.Local)
Else
mgrManifest.DoManifestAdd(oItem, mgrSQLite.Database.Local)
End If
@@ -107,6 +107,33 @@ Public Class mgrBackup
Return True
End Function
Private Sub CheckOldBackups(ByVal oGame As clsGame, ByVal sBackupPath As String)
Dim oGameBackups As List(Of clsBackup) = mgrManifest.DoManifestGetByName(oGame.Name, mgrSQLite.Database.Remote)
Dim oGameBackup As clsBackup
Dim sOldBackup As String
Dim iBackupCount As Integer = oGameBackups.Count
Dim iDelCount As Integer
'If we've hit or exceeded the maximum backup limit
If oGameBackups.Count >= oGame.BackupLimit Then
'How many do we need to delete
iDelCount = (oGameBackups.Count - oGame.BackupLimit) + 1
'Delete the oldest backup(s) (Manifest entry and backup file)
For i = 1 To iDelCount
oGameBackup = oGameBackups(oGameBackups.Count - i)
sOldBackup = sBackupPath & Path.DirectorySeparatorChar & oGameBackup.FileName
mgrManifest.DoManifestDeletebyID(oGameBackup, mgrSQLite.Database.Remote)
mgrManifest.DoManifestDeletebyID(oGameBackup, mgrSQLite.Database.Local)
If File.Exists(sOldBackup) Then
mgrCommon.DeleteFile(sOldBackup)
End If
RaiseEvent UpdateLog(mgrCommon.FormatString(mgrBackup_BackupLimitExceeded, New String() {oGame.Name, oGame.BackupLimit, Path.GetFileName(sOldBackup)}), False, ToolTipIcon.Info, True)
Next
End If
End Sub
Public Sub DoBackup(ByVal oBackupList As List(Of clsGame))
Dim oGame As clsGame
Dim bDoBackup As Boolean
@@ -144,6 +171,7 @@ Public Class mgrBackup
End If
If oGame.AppendTimeStamp Then
CheckOldBackups(oGame, sBackupFile)
sBackupFile = sBackupFile & Path.DirectorySeparatorChar & oGame.Name & sTimeStamp & ".7z"
Else
sBackupFile = sBackupFile & Path.DirectorySeparatorChar & oGame.Name & ".7z"
+56 -31
View File
@@ -54,43 +54,17 @@
End Function
Public Shared Function ReadManifestByGame(ByVal sGame As String, ByVal iSelectDB As mgrSQLite.Database) As SortedList
Dim oDatabase As New mgrSQLite(iSelectDB)
Dim oData As DataSet
Dim sSQL As String
Dim oBackupItem As clsBackup
Dim slList As New SortedList
sSQL = "SELECT * from manifest WHERE Name=@Name ORDER BY DateUpdated Desc"
oData = oDatabase.ReadParamData(sSQL, New Hashtable)
For Each dr As DataRow In oData.Tables(0).Rows
oBackupItem = New clsBackup
oBackupItem.ID = CStr(dr("ManifestID"))
oBackupItem.Name = CStr(dr("Name"))
oBackupItem.FileName = CStr(dr("FileName"))
oBackupItem.RestorePath = CStr(dr("RestorePath"))
oBackupItem.AbsolutePath = CBool(dr("AbsolutePath"))
oBackupItem.DateUpdated = mgrCommon.UnixToDate(dr("DateUpdated"))
oBackupItem.UpdatedBy = CStr(dr("UpdatedBy"))
If Not IsDBNull(dr("CheckSum")) Then oBackupItem.CheckSum = CStr(dr("CheckSum"))
slList.Add(oBackupItem.ID, oBackupItem)
Next
Return slList
End Function
Public Shared Function DoManifestGetByName(ByVal sName As String, ByVal iSelectDB As mgrSQLite.Database) As List(Of clsBackup)
Dim oDatabase As New mgrSQLite(iSelectDB)
Dim oData As DataSet
Dim sSQL As String
Dim hshParams As New Hashtable
Dim oList As New List(Of clsBackup)
Dim oBackupItem As New clsBackup
Dim oList As New List(Of clsBackup)
sSQL = "SELECT * from manifest "
sSQL &= "WHERE Name = @Name"
sSQL &= "WHERE Name = @Name ORDER BY DateUpdated Desc"
hshParams.Add("Name", sName)
@@ -112,7 +86,37 @@
Return oList
End Function
Public Shared Function DoManifestCheck(ByVal sName As String, ByVal sFileName As String, ByVal iSelectDB As mgrSQLite.Database) As Boolean
Public Shared Function DoManifestGetByID(ByVal sID As String, ByVal iSelectDB As mgrSQLite.Database) As clsBackup
Dim oDatabase As New mgrSQLite(iSelectDB)
Dim oData As DataSet
Dim sSQL As String
Dim hshParams As New Hashtable
Dim oBackupItem As New clsBackup
Dim oList As New List(Of clsBackup)
sSQL = "SELECT * from manifest "
sSQL &= "WHERE ManifestID = @ID ORDER BY DateUpdated Desc"
hshParams.Add("ID", sID)
oData = oDatabase.ReadParamData(sSQL, hshParams)
For Each dr As DataRow In oData.Tables(0).Rows
oBackupItem = New clsBackup
oBackupItem.ID = CStr(dr("ManifestID"))
oBackupItem.Name = CStr(dr("Name"))
oBackupItem.FileName = CStr(dr("FileName"))
oBackupItem.RestorePath = CStr(dr("RestorePath"))
oBackupItem.AbsolutePath = CBool(dr("AbsolutePath"))
oBackupItem.DateUpdated = mgrCommon.UnixToDate(dr("DateUpdated"))
oBackupItem.UpdatedBy = CStr(dr("UpdatedBy"))
If Not IsDBNull(dr("CheckSum")) Then oBackupItem.CheckSum = CStr(dr("CheckSum"))
Next
Return oBackupItem
End Function
Public Shared Function DoSpecificManifestCheck(ByVal sName As String, ByVal sFileName As String, ByVal iSelectDB As mgrSQLite.Database) As Boolean
Dim oDatabase As New mgrSQLite(iSelectDB)
Dim oData As DataSet
Dim sSQL As String
@@ -134,6 +138,27 @@
End Function
Public Shared Function DoGlobalManifestCheck(ByVal sName As String, ByVal iSelectDB As mgrSQLite.Database) As Boolean
Dim oDatabase As New mgrSQLite(iSelectDB)
Dim oData As DataSet
Dim sSQL As String
Dim hshParams As New Hashtable
sSQL = "SELECT * from manifest "
sSQL &= "WHERE Name = @Name"
hshParams.Add("Name", sName)
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 DoManifestNameCheck(ByVal sName As String, ByVal iSelectDB As mgrSQLite.Database) As Boolean
Dim oDatabase As New mgrSQLite(iSelectDB)
Dim oData As DataSet
@@ -246,7 +271,7 @@
Dim hshParams As New Hashtable
sSQL = "UPDATE manifest SET Name = @Name, FileName = @FileName, RestorePath = @Path, AbsolutePath = @AbsolutePath, "
sSQL &= "DateUpdated = @DateUpdated, UpdatedBy = @UpdatedBy, CheckSum = @CheckSum WHERE Name = @QueryName"
sSQL &= "DateUpdated = @DateUpdated, UpdatedBy = @UpdatedBy, CheckSum = @CheckSum WHERE ManifestID = @QueryID"
hshParams.Add("Name", oBackupItem.Name)
hshParams.Add("FileName", oBackupItem.FileName)
+19 -9
View File
@@ -75,6 +75,7 @@ Public Class mgrMonitorList
Dim sCompany As String
Dim sMonitorGame As String
Dim sTimeStamp As String
Dim sBackupLimit As String
'Setup SQL for optional fields
If (eSyncFields And clsGame.eOptionalSyncFields.Company) = clsGame.eOptionalSyncFields.Company Then
@@ -99,8 +100,10 @@ Public Class mgrMonitorList
End If
If (eSyncFields And clsGame.eOptionalSyncFields.TimeStamp) = clsGame.eOptionalSyncFields.TimeStamp Then
sTimeStamp = "@TimeStamp"
sBackupLimit = "@BackupLimit"
Else
sTimeStamp = "COALESCE((SELECT TimeStamp FROM monitorlist WHERE MonitorID=@ID),0)"
sBackupLimit = "(SELECT BackupLimit FROM monitorlist WHERE MonitorID=@ID),0)"
End If
If (eSyncFields And clsGame.eOptionalSyncFields.Version) = clsGame.eOptionalSyncFields.Version Then
sVersion = "@Version"
@@ -108,11 +111,11 @@ Public Class mgrMonitorList
sVersion = "(SELECT Version FROM monitorlist WHERE MonitorID=@ID)"
End If
sSQL = "INSERT OR REPLACE INTO monitorlist (MonitorID, Name, Process, Path, AbsolutePath, FolderSave, FileType, TimeStamp, ExcludeList, ProcessPath, Icon, Hours, Version, Company, Enabled, MonitorOnly) "
sSQL = "INSERT OR REPLACE INTO monitorlist (MonitorID, Name, Process, Path, AbsolutePath, FolderSave, FileType, TimeStamp, ExcludeList, ProcessPath, Icon, Hours, Version, Company, Enabled, MonitorOnly, BackupLimit) "
sSQL &= "VALUES (@ID, @Name, @Process, @Path, @AbsolutePath, @FolderSave, @FileType, "
sSQL &= sTimeStamp & ", @ExcludeList, " & sGamePath & ", "
sSQL &= sIcon & ", @Hours, " & sVersion & ", "
sSQL &= sCompany & ", " & sMonitorGame & ", @MonitorOnly);"
sSQL &= sCompany & ", " & sMonitorGame & ", @MonitorOnly, " & sBackupLimit & ");"
For Each oGame As clsGame In hshGames.Values
hshParams = New Hashtable
@@ -144,6 +147,7 @@ Public Class mgrMonitorList
End If
If (eSyncFields And clsGame.eOptionalSyncFields.TimeStamp) = clsGame.eOptionalSyncFields.TimeStamp Then
hshParams.Add("TimeStamp", oGame.AppendTimeStamp)
hshParams.Add("BackupLimit", oGame.BackupLimit)
End If
If (eSyncFields And clsGame.eOptionalSyncFields.Version) = clsGame.eOptionalSyncFields.Version Then
hshParams.Add("Version", oGame.Version)
@@ -329,9 +333,9 @@ Public Class mgrMonitorList
Select Case eFilterType
Case frmFilter.eFilterType.NoFilter
sSQL = "SELECT MonitorID, Name, Process, Path, AbsolutePath, FolderSave, FileType, TimeStamp, ExcludeList, ProcessPath, Icon, Hours, Version, Company, Enabled, MonitorOnly FROM monitorlist ORDER BY Name Asc"
sSQL = "SELECT MonitorID, Name, Process, Path, AbsolutePath, FolderSave, FileType, TimeStamp, ExcludeList, ProcessPath, Icon, Hours, Version, Company, Enabled, MonitorOnly, BackupLimit FROM monitorlist ORDER BY Name Asc"
Case frmFilter.eFilterType.FieldAnd, frmFilter.eFilterType.FieldOr
sSQL = "SELECT MonitorID, Name, Process, Path, AbsolutePath, FolderSave, FileType, TimeStamp, ExcludeList, ProcessPath, Icon, Hours, Version, Company, Enabled, MonitorOnly FROM monitorlist"
sSQL = "SELECT MonitorID, Name, Process, Path, AbsolutePath, FolderSave, FileType, TimeStamp, ExcludeList, ProcessPath, Icon, Hours, Version, Company, Enabled, MonitorOnly, BackupLimit FROM monitorlist"
If hshStringFilters.Count > 0 Then
sSQL &= " WHERE ("
@@ -353,7 +357,7 @@ Public Class mgrMonitorList
End If
sSQL &= " ORDER BY Name Asc"
Case frmFilter.eFilterType.AnyTag
sSQL = "SELECT DISTINCT MonitorID, Name, Process, Path, AbsolutePath, FolderSave, FileType, TimeStamp, ExcludeList, ProcessPath, Icon, Hours, Version, Company, Enabled, MonitorOnly FROM monitorlist "
sSQL = "SELECT DISTINCT MonitorID, Name, Process, Path, AbsolutePath, FolderSave, FileType, TimeStamp, ExcludeList, ProcessPath, Icon, Hours, Version, Company, Enabled, MonitorOnly, BackupLimit FROM monitorlist "
sSQL &= "NATURAL JOIN gametags WHERE gametags.TagID IN ("
For Each oTag As clsTag In oTagFilters
@@ -365,7 +369,7 @@ Public Class mgrMonitorList
sSQL = sSQL.TrimEnd(",")
sSQL &= ") ORDER BY Name Asc"
Case frmFilter.eFilterType.AllTags
sSQL = "SELECT MonitorID, Name, Process, Path, AbsolutePath, FolderSave, FileType, TimeStamp, ExcludeList, ProcessPath, Icon, Hours, Version, Company, Enabled, MonitorOnly FROM monitorlist WHERE MonitorID IN "
sSQL = "SELECT MonitorID, Name, Process, Path, AbsolutePath, FolderSave, FileType, TimeStamp, ExcludeList, ProcessPath, Icon, Hours, Version, Company, Enabled, MonitorOnly, BackupLimit FROM monitorlist WHERE MonitorID IN "
For Each oTag As clsTag In oTagFilters
sSQL &= "(SELECT MonitorID FROM gametags WHERE monitorlist.MonitorID = gametags.MonitorID And TagID = @TagID" & iCounter & ")"
@@ -378,7 +382,7 @@ Public Class mgrMonitorList
sSQL &= " ORDER BY Name Asc"
Case frmFilter.eFilterType.NoTags
sSQL = "SELECT MonitorID, Name, Process, Path, AbsolutePath, FolderSave, FileType, TimeStamp, ExcludeList, ProcessPath, Icon, Hours, Version, Company, Enabled, MonitorOnly FROM monitorlist WHERE MonitorID NOT IN (SELECT MonitorID FROM gametags) ORDER BY Name Asc"
sSQL = "SELECT MonitorID, Name, Process, Path, AbsolutePath, FolderSave, FileType, TimeStamp, ExcludeList, ProcessPath, Icon, Hours, Version, Company, Enabled, MonitorOnly, BackupLimit FROM monitorlist WHERE MonitorID NOT IN (SELECT MonitorID FROM gametags) ORDER BY Name Asc"
End Select
Return sSQL
@@ -416,6 +420,7 @@ Public Class mgrMonitorList
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)
Next
@@ -482,6 +487,7 @@ Public Class mgrMonitorList
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
@@ -506,7 +512,7 @@ Public Class mgrMonitorList
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)"
sSQL &= "@ExcludeList, @ProcessPath, @Icon, @Hours, @Version, @Company, @Enabled, @MonitorOnly, @BackupLimit)"
'Parameters
hshParams.Add("ID", oGame.ID)
@@ -525,6 +531,7 @@ Public Class mgrMonitorList
hshParams.Add("Company", oGame.Company)
hshParams.Add("Enabled", oGame.Enabled)
hshParams.Add("MonitorOnly", oGame.MonitorOnly)
hshParams.Add("BackupLimit", oGame.BackupLimit)
oDatabase.RunParamQuery(sSQL, hshParams)
@@ -537,7 +544,7 @@ Public Class mgrMonitorList
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 WHERE MonitorID=@ID"
sSQL &= "Hours=@Hours, Version=@Version, Company=@Company, Enabled=@Enabled, MonitorOnly=@MonitorOnly, BackupLimit=@BackupLimit WHERE MonitorID=@ID"
'Parameters
hshParams.Add("Name", oGame.Name)
@@ -556,6 +563,7 @@ Public Class mgrMonitorList
hshParams.Add("Enabled", oGame.Enabled)
hshParams.Add("MonitorOnly", oGame.MonitorOnly)
hshParams.Add("ID", oGame.ID)
hshParams.Add("BackupLimit", oGame.BackupLimit)
oDatabase.RunParamQuery(sSQL, hshParams)
@@ -667,6 +675,7 @@ Public Class mgrMonitorList
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
@@ -706,6 +715,7 @@ Public Class mgrMonitorList
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
+2 -2
View File
@@ -268,8 +268,8 @@ Public Class mgrRestore
If bRestoreCompleted Then
'Save Local Manifest
If mgrManifest.DoManifestCheck(oBackupInfo.Name, oBackupInfo.FileName, mgrSQLite.Database.Local) Then
mgrManifest.DoManifestUpdateByID(oBackupInfo, mgrSQLite.Database.Local)
If mgrManifest.DoGlobalManifestCheck(oBackupInfo.Name, mgrSQLite.Database.Local) Then
mgrManifest.DoManifestUpdateByName(oBackupInfo, mgrSQLite.Database.Local)
Else
mgrManifest.DoManifestAdd(oBackupInfo, mgrSQLite.Database.Local)
End If
+10 -2
View File
@@ -80,7 +80,7 @@ Public Class mgrSQLite
sSql &= "CREATE TABLE monitorlist (MonitorID TEXT NOT NULL UNIQUE, Name TEXT NOT NULL, Process TEXT NOT NULL, Path TEXT, " &
"AbsolutePath BOOLEAN NOT NULL, FolderSave BOOLEAN NOT NULL, FileType TEXT, TimeStamp BOOLEAN NOT NULL, ExcludeList TEXT NOT NULL, " &
"ProcessPath TEXT, Icon TEXT, Hours REAL, Version TEXT, Company TEXT, Enabled BOOLEAN NOT NULL, MonitorOnly BOOLEAN NOT NULL, " &
"PRIMARY KEY(Name, Process));"
"BackupLimit INTEGER NOT NULL, PRIMARY KEY(Name, Process));"
'Add Tables (Tags)
sSql &= "CREATE TABLE tags (TagID TEXT NOT NULL UNIQUE, Name TEXT NOT NULL PRIMARY KEY); "
@@ -117,7 +117,7 @@ Public Class mgrSQLite
sSql = "CREATE TABLE monitorlist (MonitorID TEXT NOT NULL UNIQUE, Name TEXT NOT NULL, Process TEXT NOT NULL, Path TEXT, " &
"AbsolutePath BOOLEAN NOT NULL, FolderSave BOOLEAN NOT NULL, FileType TEXT, TimeStamp BOOLEAN NOT NULL, ExcludeList TEXT NOT NULL, " &
"ProcessPath TEXT, Icon TEXT, Hours REAL, Version TEXT, Company TEXT, Enabled BOOLEAN NOT NULL, MonitorOnly BOOLEAN NOT NULL, " &
"PRIMARY KEY(Name, Process));"
"BackupLimit INTEGER NOT NULL, PRIMARY KEY(Name, Process));"
'Add Tables (Remote Manifest)
sSql &= "CREATE TABLE manifest (ManifestID TEXT NOT NULL PRIMARY KEY, Name TEXT NOT NULL, FileName TEXT NOT NULL, RestorePath TEXT NOT NULL, " &
@@ -567,6 +567,10 @@ Public Class mgrSQLite
sSQL &= "INSERT INTO manifest_new (ManifestID, Name, FileName, RestorePath, AbsolutePath, DateUpdated, UpdatedBy) "
sSQL &= "SELECT ManifestID, Name, FileName, RestorePath, AbsolutePath, DateUpdated, UpdatedBy FROM manifest;"
sSQL &= "DROP TABLE manifest; ALTER TABLE manifest_new RENAME TO manifest;"
'Add backup limit field
sSQL = "ALTER TABLE monitorlist ADD COLUMN BackupLimit INTEGER NOT NULL DEFAULT 5;"
sSQL &= "PRAGMA user_version=98"
RunParamQuery(sSQL, New Hashtable)
@@ -583,6 +587,10 @@ Public Class mgrSQLite
sSQL &= "INSERT INTO manifest_new (ManifestID, Name, FileName, RestorePath, AbsolutePath, DateUpdated, UpdatedBy) "
sSQL &= "SELECT ManifestID, Name, FileName, RestorePath, AbsolutePath, DateUpdated, UpdatedBy FROM manifest;"
sSQL &= "DROP TABLE manifest; ALTER TABLE manifest_new RENAME TO manifest;"
'Add backup limit field
sSQL = "ALTER TABLE monitorlist ADD COLUMN BackupLimit INTEGER NOT NULL DEFAULT 2;"
sSQL &= "PRAGMA user_version=98"
RunParamQuery(sSQL, New Hashtable)
+33 -15
View File
@@ -1312,7 +1312,7 @@ Namespace My.Resources
End Property
'''<summary>
''' Looks up a localized string similar to Timestamp each backup.
''' Looks up a localized string similar to Save multiple backups.
'''</summary>
Friend ReadOnly Property frmGameManager_chkTimeStamp() As String
Get
@@ -1420,7 +1420,7 @@ Namespace My.Resources
End Property
'''<summary>
''' Looks up a localized string similar to This will delete the backup file and all records of this backup. This cannot be undone. [BR][BR]Do you want to remove the data for [PARAM]?.
''' Looks up a localized string similar to This will delete the selected backup file. This cannot be undone. [BR][BR]Do you want to delete [PARAM]?.
'''</summary>
Friend ReadOnly Property frmGameManager_ConfirmBackupDelete() As String
Get
@@ -1770,15 +1770,6 @@ Namespace My.Resources
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Current Backup:.
'''</summary>
Friend ReadOnly Property frmGameManager_lblCurrentBackup() As String
Get
Return ResourceManager.GetString("frmGameManager_lblCurrentBackup", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Game Path:.
'''</summary>
@@ -1807,11 +1798,20 @@ Namespace My.Resources
End Property
'''<summary>
''' Looks up a localized string similar to Latest Backup:.
''' Looks up a localized string similar to Backup Limit.
'''</summary>
Friend ReadOnly Property frmGameManager_lblLatestbackup() As String
Friend ReadOnly Property frmGameManager_lblLimit() As String
Get
Return ResourceManager.GetString("frmGameManager_lblLatestbackup", resourceCulture)
Return ResourceManager.GetString("frmGameManager_lblLimit", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Local Data:.
'''</summary>
Friend ReadOnly Property frmGameManager_lblLocalData() As String
Get
Return ResourceManager.GetString("frmGameManager_lblLocalData", resourceCulture)
End Get
End Property
@@ -1842,6 +1842,15 @@ Namespace My.Resources
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Backup Data:.
'''</summary>
Friend ReadOnly Property frmGameManager_lblRemote() As String
Get
Return ResourceManager.GetString("frmGameManager_lblRemote", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Restore Path:.
'''</summary>
@@ -3913,7 +3922,7 @@ Namespace My.Resources
End Property
'''<summary>
''' Looks up a localized string similar to Time stamp each backup.
''' Looks up a localized string similar to Save multiple backups.
'''</summary>
Friend ReadOnly Property frmSyncFields_chkTimeStamp() As String
Get
@@ -4357,6 +4366,15 @@ Namespace My.Resources
End Get
End Property
'''<summary>
''' Looks up a localized string similar to [PARAM] backup limit ([PARAM]) exceeded. [PARAM] was automatically removed..
'''</summary>
Friend ReadOnly Property mgrBackup_BackupLimitExceeded() As String
Get
Return ResourceManager.GetString("mgrBackup_BackupLimitExceeded", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to [PARAM] backup finished with warnings or errors..
'''</summary>
+13 -7
View File
@@ -503,7 +503,7 @@
<value>Monitor only</value>
</data>
<data name="frmGameManager_chkTimeStamp" xml:space="preserve">
<value>Timestamp each backup</value>
<value>Save multiple backups</value>
</data>
<data name="frmGameManager_ChooseCustomIcon" xml:space="preserve">
<value>Choose a custom icon for the game</value>
@@ -527,7 +527,7 @@
<value>Are you sure you want to run a backup for [PARAM]? This will close the form.</value>
</data>
<data name="frmGameManager_ConfirmBackupDelete" xml:space="preserve">
<value>This will delete the backup file and all records of this backup. This cannot be undone. [BR][BR]Do you want to remove the data for [PARAM]?</value>
<value>This will delete the selected backup file. This cannot be undone. [BR][BR]Do you want to delete [PARAM]?</value>
</data>
<data name="frmGameManager_ConfirmBackupFolderDelete" xml:space="preserve">
<value>The backup folder [PARAM] still contains [PARAM] directories and [PARAM] files.[BR][BR]Do you want to delete the contents and remove the sub-folder for this game?</value>
@@ -616,8 +616,8 @@
<data name="frmGameManager_lblCompany" xml:space="preserve">
<value>Company:</value>
</data>
<data name="frmGameManager_lblLatestbackup" xml:space="preserve">
<value>Latest Backup:</value>
<data name="frmGameManager_lblRemote" xml:space="preserve">
<value>Backup Data:</value>
</data>
<data name="frmGameManager_lblBackupFile" xml:space="preserve">
<value>Backup File:</value>
@@ -631,8 +631,8 @@
<data name="frmGameManager_lblIcon" xml:space="preserve">
<value>Icon:</value>
</data>
<data name="frmGameManager_lblCurrentBackup" xml:space="preserve">
<value>Current Backup:</value>
<data name="frmGameManager_lblLocalData" xml:space="preserve">
<value>Local Data:</value>
</data>
<data name="frmGameManager_lblName" xml:space="preserve">
<value>Name:</value>
@@ -1652,7 +1652,7 @@
<value>Monitor this game</value>
</data>
<data name="frmSyncFields_chkTimeStamp" xml:space="preserve">
<value>Time stamp each backup</value>
<value>Save multiple backups</value>
</data>
<data name="frmSyncFields_chkVersion" xml:space="preserve">
<value>Version</value>
@@ -1714,4 +1714,10 @@
<data name="frmGameManager_ErrorBackupChangePath" xml:space="preserve">
<value>You cannot choose a file located outside the current [PARAM] backup folder.</value>
</data>
<data name="frmGameManager_lblLimit" xml:space="preserve">
<value>Backup Limit</value>
</data>
<data name="mgrBackup_BackupLimitExceeded" xml:space="preserve">
<value>[PARAM] backup limit ([PARAM]) exceeded. [PARAM] was automatically removed.</value>
</data>
</root>