Fixes and issue #60

This commit is contained in:
Michael J. Seiferling
2016-08-26 11:30:12 -06:00
parent f117e7fbaa
commit 7254b6b501
6 changed files with 51 additions and 30 deletions
+24 -25
View File
@@ -36,6 +36,8 @@ Partial Class frmAddWizard
Me.txtProcessPath = New System.Windows.Forms.TextBox()
Me.lblStep2Intro = New System.Windows.Forms.Label()
Me.tbPage3 = New System.Windows.Forms.TabPage()
Me.lblLimit = New System.Windows.Forms.Label()
Me.nudLimit = New System.Windows.Forms.NumericUpDown()
Me.lblStep3Title = New System.Windows.Forms.Label()
Me.lblStep3Instructions = New System.Windows.Forms.Label()
Me.chkTimeStamp = New System.Windows.Forms.CheckBox()
@@ -66,16 +68,14 @@ Partial Class frmAddWizard
Me.btnCancel = New System.Windows.Forms.Button()
Me.btnNext = 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.tbPage1.SuspendLayout()
Me.tbPage2.SuspendLayout()
Me.tbPage3.SuspendLayout()
CType(Me.nudLimit, System.ComponentModel.ISupportInitialize).BeginInit()
Me.tbPage3a.SuspendLayout()
Me.tbPage4.SuspendLayout()
Me.tbPage5.SuspendLayout()
CType(Me.nudLimit, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'tabWizard
@@ -223,6 +223,26 @@ Partial Class frmAddWizard
Me.tbPage3.TabIndex = 2
Me.tbPage3.Text = "TabPage3"
'
'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.Value = New Decimal(New Integer() {2, 0, 0, 0})
Me.nudLimit.Visible = False
'
'lblStep3Title
'
Me.lblStep3Title.AutoSize = True
@@ -521,27 +541,6 @@ Partial Class frmAddWizard
Me.btnBack.Text = "&Back"
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
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
@@ -565,13 +564,13 @@ Partial Class frmAddWizard
Me.tbPage2.PerformLayout()
Me.tbPage3.ResumeLayout(False)
Me.tbPage3.PerformLayout()
CType(Me.nudLimit, System.ComponentModel.ISupportInitialize).EndInit()
Me.tbPage3a.ResumeLayout(False)
Me.tbPage3a.PerformLayout()
Me.tbPage4.ResumeLayout(False)
Me.tbPage4.PerformLayout()
Me.tbPage5.ResumeLayout(False)
Me.tbPage5.PerformLayout()
CType(Me.nudLimit, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)
End Sub
+1
View File
@@ -159,6 +159,7 @@ Public Class frmAddWizard
oGame.AppendTimeStamp = bTimeStamp
oGame.BackupLimit = iLimit
oGame.ExcludeList = sExcludeList
oGame.ProcessPath = sProcessPath
Return oGame
End Function
-1
View File
@@ -193,7 +193,6 @@ Partial Class frmGameManager
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
'
+5 -1
View File
@@ -653,6 +653,8 @@ Public Class frmGameManager
mgrManifest.DoManifestDeletebyID(oBackup, mgrSQLite.Database.Remote)
'Delete referenced backup file from the backup folder
mgrCommon.DeleteFile(BackupFolder & oBackup.FileName)
'Check for sub-directory and delete if empty (we need to do this every pass just in case the user had a mix of settings at one point)
mgrCommon.DeleteDirectoryByBackup(BackupFolder, oBackup)
Next
'Delete local manifest entry
@@ -671,7 +673,6 @@ Public Class frmGameManager
End Sub
Private Sub DeleteBackup()
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)
@@ -684,6 +685,9 @@ Public Class frmGameManager
'Delete referenced backup file from the backup folder
mgrCommon.DeleteFile(BackupFolder & CurrentBackupItem.FileName)
'Check for sub-directory and delete if empty
mgrCommon.DeleteDirectoryByBackup(BackupFolder, CurrentBackupItem)
LoadBackupData()
If oCurrentGame.Temporary Then
+2 -2
View File
@@ -126,9 +126,9 @@ Public Class mgrBackup
mgrManifest.DoManifestDeletebyID(oGameBackup, mgrSQLite.Database.Remote)
mgrManifest.DoManifestDeletebyID(oGameBackup, mgrSQLite.Database.Local)
If File.Exists(sOldBackup) Then
mgrCommon.DeleteFile(sOldBackup)
End If
mgrCommon.DeleteDirectoryByBackup(Settings.BackupFolder & Path.DirectorySeparatorChar, oGameBackup)
RaiseEvent UpdateLog(mgrCommon.FormatString(mgrBackup_BackupLimitExceeded, Path.GetFileName(sOldBackup)), False, ToolTipIcon.Info, True)
Next
End If
+18
View File
@@ -191,6 +191,24 @@ Public Class mgrCommon
End If
End Sub
'Delete a sub-folder based on the provided backup information
Public Shared Sub DeleteDirectoryByBackup(ByVal sBackupFolder As String, ByVal oBackup As clsBackup)
Dim oDir As DirectoryInfo
Dim sDir As String = sBackupFolder & oBackup.Name
'Delete sub directory if it's empty
If oBackup.FileName.StartsWith(oBackup.Name & Path.DirectorySeparatorChar) Then
If Directory.Exists(sDir) Then
'Check if there's any sub-directories or files remaining
oDir = New DirectoryInfo(sDir)
If oDir.GetDirectories.Length = 0 And oDir.GetFiles.Length = 0 Then
'Folder is empty, delete the empty sub-folder
If Directory.Exists(sDir) Then DeleteDirectory(sDir)
End If
End If
End If
End Sub
'Save string as text file
Public Shared Sub SaveText(ByVal sText As String, ByVal sPath As String)
Dim oStream As StreamWriter