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
+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