diff --git a/GBM/Classes/XML Serialize Classes/Game.vb b/GBM/Classes/XML Serialize Classes/Game.vb index a5f81b5..862d065 100644 --- a/GBM/Classes/XML Serialize Classes/Game.vb +++ b/GBM/Classes/XML Serialize Classes/Game.vb @@ -13,6 +13,7 @@ Private bMonitorOnly As Boolean Private sComments As String Private bIsRegEx As Boolean + Private bRecurseSubFolders As Boolean Private oTags As List(Of Tag) Property ID As String @@ -141,6 +142,15 @@ End Get End Property + Property RecurseSubFolders As Boolean + Set(value As Boolean) + bRecurseSubFolders = value + End Set + Get + Return bRecurseSubFolders + End Get + End Property + Property Tags As List(Of Tag) Get Return oTags diff --git a/GBM/Classes/clsGame.vb b/GBM/Classes/clsGame.vb index 0ea8ec7..ea1447d 100644 --- a/GBM/Classes/clsGame.vb +++ b/GBM/Classes/clsGame.vb @@ -21,6 +21,7 @@ Public Class clsGame Private bMonitorOnly As Boolean = False Private sComments As String = String.Empty Private bIsRegEx As Boolean = False + Private bRecurseSubFolders As Boolean = True Private oImportTags As New List(Of Tag) Private bImportUpdate As Boolean = False @@ -241,6 +242,15 @@ Public Class clsGame End Set End Property + Property RecurseSubFolders As Boolean + Get + Return bRecurseSubFolders + End Get + Set(value As Boolean) + bRecurseSubFolders = value + End Set + End Property + Property TruePath As String Set(value As String) sPath = value @@ -342,6 +352,9 @@ Public Class clsGame If IsRegEx <> oGame.IsRegEx Then Return False End If + If RecurseSubFolders <> oGame.RecurseSubFolders Then + Return False + End If 'Optional Sync Fields If (eSyncFields And eOptionalSyncFields.Company) = eOptionalSyncFields.Company Then @@ -418,6 +431,9 @@ Public Class clsGame If IsRegEx <> oGame.IsRegEx Then Return False End If + If RecurseSubFolders <> oGame.RecurseSubFolders Then + Return False + End If Return True End If End Function diff --git a/GBM/Forms/frmFilter.vb b/GBM/Forms/frmFilter.vb index d861608..28b6302 100644 --- a/GBM/Forms/frmFilter.vb +++ b/GBM/Forms/frmFilter.vb @@ -202,6 +202,14 @@ Public Class frmFilter oField.Status = clsGameFilterField.eFieldStatus.ValidFilter oValidFields.Add(oField) + 'Include Sub Folders + oField = New clsGameFilterField + oField.FieldName = "RecurseSubFolders" + oField.FriendlyFieldName = frmFilter_FieldRecurseSubFolders + oField.Type = clsGameFilterField.eDataType.fBool + oField.Status = clsGameFilterField.eFieldStatus.ValidFilter + oValidFields.Add(oField) + 'Delete Folder on Restore oField = New clsGameFilterField oField.FieldName = "CleanFolder" diff --git a/GBM/Forms/frmGameManager.Designer.vb b/GBM/Forms/frmGameManager.Designer.vb index 2b5f370..e7fc41f 100644 --- a/GBM/Forms/frmGameManager.Designer.vb +++ b/GBM/Forms/frmGameManager.Designer.vb @@ -107,6 +107,7 @@ Partial Class frmGameManager Me.cmsDeleteAll = New System.Windows.Forms.ToolStripMenuItem() Me.btnProcesses = New System.Windows.Forms.Button() Me.ttFullPath = New System.Windows.Forms.ToolTip(Me.components) + Me.chkRecurseSubFolders = New System.Windows.Forms.CheckBox() Me.grpConfig.SuspendLayout() CType(Me.nudLimit, System.ComponentModel.ISupportInitialize).BeginInit() Me.grpExtra.SuspendLayout() @@ -163,6 +164,7 @@ 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.chkRecurseSubFolders) Me.grpConfig.Controls.Add(Me.btnGameID) Me.grpConfig.Controls.Add(Me.chkRegEx) Me.grpConfig.Controls.Add(Me.lblComments) @@ -860,13 +862,13 @@ Partial Class frmGameManager 'cmsOfficialWindows ' Me.cmsOfficialWindows.Name = "cmsOfficialWindows" - Me.cmsOfficialWindows.Size = New System.Drawing.Size(180, 22) + Me.cmsOfficialWindows.Size = New System.Drawing.Size(132, 22) Me.cmsOfficialWindows.Text = "&Windows..." ' 'cmsOfficialLinux ' Me.cmsOfficialLinux.Name = "cmsOfficialLinux" - Me.cmsOfficialLinux.Size = New System.Drawing.Size(180, 22) + Me.cmsOfficialLinux.Size = New System.Drawing.Size(132, 22) Me.cmsOfficialLinux.Text = "&Linux..." ' 'cmsFile @@ -925,6 +927,17 @@ Partial Class frmGameManager Me.ttFullPath.InitialDelay = 300 Me.ttFullPath.ReshowDelay = 60 ' + 'chkRecurseSubFolders + ' + Me.chkRecurseSubFolders.AutoSize = True + Me.chkRecurseSubFolders.Location = New System.Drawing.Point(489, 206) + Me.chkRecurseSubFolders.Name = "chkRecurseSubFolders" + Me.chkRecurseSubFolders.Size = New System.Drawing.Size(15, 14) + Me.chkRecurseSubFolders.TabIndex = 0 + Me.chkRecurseSubFolders.TabStop = False + Me.chkRecurseSubFolders.UseVisualStyleBackColor = True + Me.chkRecurseSubFolders.Visible = False + ' 'frmGameManager ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) @@ -1059,4 +1072,5 @@ Partial Class frmGameManager Friend WithEvents btnImportBackup As Button Friend WithEvents cmsOfficialWindows As ToolStripMenuItem Friend WithEvents cmsOfficialLinux As ToolStripMenuItem + Friend WithEvents chkRecurseSubFolders As CheckBox End Class diff --git a/GBM/Forms/frmGameManager.vb b/GBM/Forms/frmGameManager.vb index 19a475d..14441c4 100644 --- a/GBM/Forms/frmGameManager.vb +++ b/GBM/Forms/frmGameManager.vb @@ -585,10 +585,11 @@ Public Class frmGameManager frm.FormName = sFormText frm.BuilderString = txtBox.Text frm.RootFolder = GetBuilderRoot() - + frm.RecurseSubFolders = chkRecurseSubFolders.Checked frm.ShowDialog() txtBox.Text = frm.BuilderString + chkRecurseSubFolders.Checked = frm.RecurseSubFolders VerifyCleanFolder() End Sub @@ -923,6 +924,7 @@ Public Class frmGameManager txtFileType.Text = oApp.FileType txtExclude.Text = oApp.ExcludeList chkFolderSave.Checked = oApp.FolderSave + chkRecurseSubFolders.Checked = oApp.RecurseSubFolders chkCleanFolder.Checked = oApp.CleanFolder chkTimeStamp.Checked = oApp.AppendTimeStamp nudLimit.Value = oApp.BackupLimit @@ -1062,6 +1064,7 @@ Public Class frmGameManager btnOpenRestorePath.Enabled = False chkEnabled.Checked = True chkMonitorOnly.Checked = False + chkRecurseSubFolders.Checked = True btnTags.Enabled = True btnProcesses.Enabled = True lblTags.Text = String.Empty @@ -1185,6 +1188,7 @@ Public Class frmGameManager Private Sub FolderSaveModeChange() If chkFolderSave.Checked Then btnInclude.Enabled = False + chkRecurseSubFolders.Checked = False If txtFileType.Text <> String.Empty Then txtFileType.Text = String.Empty UpdateBuilderButtonLabel(txtFileType.Text, frmGameManager_IncludeShortcut, btnInclude, False) @@ -1348,6 +1352,7 @@ Public Class frmGameManager oApp.FileType = txtFileType.Text oApp.ExcludeList = txtExclude.Text oApp.FolderSave = chkFolderSave.Checked + oApp.RecurseSubFolders = chkRecurseSubFolders.Checked oApp.CleanFolder = chkCleanFolder.Checked oApp.AppendTimeStamp = chkTimeStamp.Checked oApp.BackupLimit = nudLimit.Value diff --git a/GBM/Forms/frmIncludeExclude.Designer.vb b/GBM/Forms/frmIncludeExclude.Designer.vb index 73e8c03..6a538bd 100644 --- a/GBM/Forms/frmIncludeExclude.Designer.vb +++ b/GBM/Forms/frmIncludeExclude.Designer.vb @@ -37,15 +37,16 @@ Partial Class frmIncludeExclude Me.cmsAdd = New System.Windows.Forms.ToolStripMenuItem() Me.btnRemove = New System.Windows.Forms.Button() Me.btnAdd = New System.Windows.Forms.Button() - Me.grpFileOptions = New System.Windows.Forms.GroupBox() + Me.grpOptions = New System.Windows.Forms.GroupBox() Me.optFileTypes = New System.Windows.Forms.RadioButton() Me.optIndividualFiles = New System.Windows.Forms.RadioButton() Me.lblItems = New System.Windows.Forms.Label() Me.btnRawEdit = New System.Windows.Forms.Button() Me.lblSaveFolder = New System.Windows.Forms.Label() Me.ttWarning = New System.Windows.Forms.ToolTip(Me.components) + Me.chkRecurseSubFolders = New System.Windows.Forms.CheckBox() Me.cmsItems.SuspendLayout() - Me.grpFileOptions.SuspendLayout() + Me.grpOptions.SuspendLayout() Me.SuspendLayout() ' 'treFiles @@ -157,16 +158,17 @@ Partial Class frmIncludeExclude Me.btnAdd.Text = ">" Me.btnAdd.UseVisualStyleBackColor = True ' - 'grpFileOptions + 'grpOptions ' - Me.grpFileOptions.Controls.Add(Me.optFileTypes) - Me.grpFileOptions.Controls.Add(Me.optIndividualFiles) - Me.grpFileOptions.Location = New System.Drawing.Point(12, 403) - Me.grpFileOptions.Name = "grpFileOptions" - Me.grpFileOptions.Size = New System.Drawing.Size(194, 46) - Me.grpFileOptions.TabIndex = 2 - Me.grpFileOptions.TabStop = False - Me.grpFileOptions.Text = "File Options" + Me.grpOptions.Controls.Add(Me.chkRecurseSubFolders) + Me.grpOptions.Controls.Add(Me.optFileTypes) + Me.grpOptions.Controls.Add(Me.optIndividualFiles) + Me.grpOptions.Location = New System.Drawing.Point(12, 403) + Me.grpOptions.Name = "grpOptions" + Me.grpOptions.Size = New System.Drawing.Size(317, 46) + Me.grpOptions.TabIndex = 2 + Me.grpOptions.TabStop = False + Me.grpOptions.Text = "Options" ' 'optFileTypes ' @@ -222,6 +224,16 @@ Partial Class frmIncludeExclude Me.ttWarning.ReshowDelay = 50 Me.ttWarning.ToolTipIcon = System.Windows.Forms.ToolTipIcon.Warning ' + 'chkRecurseSubFolders + ' + Me.chkRecurseSubFolders.AutoSize = True + Me.chkRecurseSubFolders.Location = New System.Drawing.Point(185, 20) + Me.chkRecurseSubFolders.Name = "chkRecurseSubFolders" + Me.chkRecurseSubFolders.Size = New System.Drawing.Size(120, 17) + Me.chkRecurseSubFolders.TabIndex = 2 + Me.chkRecurseSubFolders.Text = "Recurse sub-folders" + Me.chkRecurseSubFolders.UseVisualStyleBackColor = True + ' 'frmIncludeExclude ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) @@ -230,7 +242,7 @@ Partial Class frmIncludeExclude Me.Controls.Add(Me.lblSaveFolder) Me.Controls.Add(Me.btnRawEdit) Me.Controls.Add(Me.lblItems) - Me.Controls.Add(Me.grpFileOptions) + Me.Controls.Add(Me.grpOptions) Me.Controls.Add(Me.btnRemove) Me.Controls.Add(Me.btnAdd) Me.Controls.Add(Me.lstBuilder) @@ -247,7 +259,8 @@ Partial Class frmIncludeExclude Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen Me.Text = "Include / Exclude Builder" Me.cmsItems.ResumeLayout(False) - Me.grpFileOptions.ResumeLayout(False) + Me.grpOptions.ResumeLayout(False) + Me.grpOptions.PerformLayout() Me.ResumeLayout(False) Me.PerformLayout() @@ -261,7 +274,7 @@ Partial Class frmIncludeExclude Friend WithEvents lstBuilder As System.Windows.Forms.ListView Friend WithEvents btnRemove As System.Windows.Forms.Button Friend WithEvents btnAdd As System.Windows.Forms.Button - Friend WithEvents grpFileOptions As System.Windows.Forms.GroupBox + Friend WithEvents grpOptions As System.Windows.Forms.GroupBox Friend WithEvents optFileTypes As System.Windows.Forms.RadioButton Friend WithEvents optIndividualFiles As System.Windows.Forms.RadioButton Friend WithEvents lblItems As System.Windows.Forms.Label @@ -272,4 +285,5 @@ Partial Class frmIncludeExclude Friend WithEvents btnRawEdit As Button Friend WithEvents lblSaveFolder As Label Friend WithEvents ttWarning As ToolTip + Friend WithEvents chkRecurseSubFolders As CheckBox End Class diff --git a/GBM/Forms/frmIncludeExclude.resx b/GBM/Forms/frmIncludeExclude.resx index c7440a4..aa98d69 100644 --- a/GBM/Forms/frmIncludeExclude.resx +++ b/GBM/Forms/frmIncludeExclude.resx @@ -125,7 +125,7 @@ AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAAB6 - CQAAAk1TRnQBSQFMAgEBAwEAAbgBAAG4AQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo + CQAAAk1TRnQBSQFMAgEBAwEAAcABAAHAAQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo AwABQAMAARADAAEBAQABCAYAAQQYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5 AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA diff --git a/GBM/Forms/frmIncludeExclude.vb b/GBM/Forms/frmIncludeExclude.vb index 276cd51..eb5c16f 100644 --- a/GBM/Forms/frmIncludeExclude.vb +++ b/GBM/Forms/frmIncludeExclude.vb @@ -6,6 +6,7 @@ Public Class frmIncludeExclude Dim sFormName As String = String.Empty Dim sRootFolder As String = String.Empty Dim sBuilderString As String + Dim bRecurseSubFolders As Boolean Public Property BuilderString As String Get @@ -34,6 +35,15 @@ Public Class frmIncludeExclude End Set End Property + Public Property RecurseSubFolders As Boolean + Get + Return bRecurseSubFolders + End Get + Set(value As Boolean) + bRecurseSubFolders = value + End Set + End Property + Private Sub BuildBranch(ByVal sDirectory As String, ByVal oNode As TreeNode) Dim sFolders As String() Dim sFiles As String() @@ -239,9 +249,10 @@ Public Class frmIncludeExclude lblSaveFolder.Text = frmIncludeExclude_lblSaveFolder btnRawEdit.Text = frmIncludeExclude_btnRawEdit lblItems.Text = mgrCommon.FormatString(frmIncludeExclude_lblItems, FormName) - grpFileOptions.Text = mgrCommon.FormatString(frmIncludeExclude_grpFileOptions, FormName) + grpOptions.Text = mgrCommon.FormatString(frmIncludeExclude_grpOptions, FormName) optFileTypes.Text = frmIncludeExclude_optFileTypes optIndividualFiles.Text = frmIncludeExclude_optIndividualFiles + chkRecurseSubFolders.Text = frmIncludeExclude_chkRecurseSubFolders btnRemove.Text = frmIncludeExclude_btnRemove btnAdd.Text = frmIncludeExclude_btnAdd btnBrowse.Text = frmIncludeExclude_btnBrowse @@ -254,6 +265,7 @@ Public Class frmIncludeExclude 'Set Defaults txtRootFolder.Text = RootFolder optFileTypes.Checked = True + chkRecurseSubFolders.Checked = bRecurseSubFolders If BuilderString <> String.Empty Then ParseBuilderString(BuilderString) If txtRootFolder.Text <> String.Empty Then BuildTrunk() End Sub @@ -285,6 +297,7 @@ Public Class frmIncludeExclude Private Sub btnSave_Click(sender As Object, e As EventArgs) Handles btnSave.Click BuilderString = CreateNewBuilderString() + RecurseSubFolders = chkRecurseSubFolders.Checked Me.Close() End Sub diff --git a/GBM/Managers/mgrBackup.vb b/GBM/Managers/mgrBackup.vb index acdc03a..f4eb557 100644 --- a/GBM/Managers/mgrBackup.vb +++ b/GBM/Managers/mgrBackup.vb @@ -128,7 +128,7 @@ Public Class mgrBackup 'Calculate space lAvailableSpace = mgrCommon.GetAvailableDiskSpace(oSettings.BackupFolder) - lFolderSize = mgrCommon.GetFolderSize(sSavePath, oGame.IncludeArray, oGame.ExcludeArray) + lFolderSize = mgrCommon.GetFolderSize(sSavePath, oGame.IncludeArray, oGame.ExcludeArray, oGame.RecurseSubFolders) 'Show Available Space RaiseEvent UpdateLog(mgrCommon.FormatString(mgrCommon_AvailableDiskSpace, mgrCommon.FormatDiskSpace(lAvailableSpace)), False, ToolTipIcon.Info, True) @@ -283,6 +283,7 @@ Public Class mgrBackup Dim dTimeStamp As DateTime Dim sTimeStamp As String Dim sHash As String + Dim sArguments As String For Each oGame In oBackupList 'Init @@ -321,6 +322,10 @@ Public Class mgrBackup BuildFileList(oGame.ExcludeList, mgrPath.ExcludeFileLocation) + sArguments = "a" & oSettings.Prepared7zArguments & "-t7z -mx" & oSettings.CompressionLevel & " -i@""" & mgrPath.IncludeFileLocation & """ -x@""" & mgrPath.ExcludeFileLocation & """ """ & sBackupFile & """" + + If oGame.RecurseSubFolders Then sArguments &= " -r" + Try If Directory.Exists(sSavePath) Then If Settings.Is7zUtilityValid Then @@ -330,7 +335,7 @@ Public Class mgrBackup File.Delete(sBackupFile) End If - prs7z.StartInfo.Arguments = "a" & oSettings.Prepared7zArguments & "-t7z -mx" & oSettings.CompressionLevel & " -i@""" & mgrPath.IncludeFileLocation & """ -x@""" & mgrPath.ExcludeFileLocation & """ """ & sBackupFile & """ -r" + prs7z.StartInfo.Arguments = sArguments prs7z.StartInfo.FileName = oSettings.Utility7zLocation prs7z.StartInfo.WorkingDirectory = sSavePath prs7z.StartInfo.UseShellExecute = False diff --git a/GBM/Managers/mgrCommon.vb b/GBM/Managers/mgrCommon.vb index 92246e9..0bedf94 100644 --- a/GBM/Managers/mgrCommon.vb +++ b/GBM/Managers/mgrCommon.vb @@ -300,7 +300,7 @@ Public Class mgrCommon Public Shared Function CompareValueToArrayRegEx(ByVal sValue As String, ByVal sValues As String()) As Boolean For Each se As String In sValues - If Regex.IsMatch(sValue, WildcardToRegex(se)) Then + If Regex.IsMatch(sValue, Regex.Escape(WildcardToRegex(se))) Then Return True End If Next @@ -318,7 +318,7 @@ Public Class mgrCommon End Function 'Calculate the current size of a folder - Public Shared Function GetFolderSize(ByVal sPath As String, ByVal sInclude As String(), ByVal sExclude As String()) As Long + Public Shared Function GetFolderSize(ByVal sPath As String, ByVal sInclude As String(), ByVal sExclude As String(), Optional ByVal b7zStyleRecurse As Boolean = True) As Long Dim oFolder As DirectoryInfo Dim bInclude As Boolean Dim bExclude As Boolean @@ -351,16 +351,36 @@ Public Class mgrCommon 'Sub Folders For Each di As DirectoryInfo In oFolder.EnumerateDirectories() If Not ((di.Attributes And FileAttributes.ReparsePoint) = FileAttributes.ReparsePoint) Then - If sExclude.Length > 0 Then - bExclude = CompareValueToArrayRegEx(di.Name, sExclude) + If b7zStyleRecurse Then + If sExclude.Length > 0 Then + bExclude = CompareValueToArrayRegEx(di.FullName, sExclude) + Else + bExclude = False + End If + + If Not bExclude Then + lSize += GetFolderSize(di.FullName, sInclude, sExclude) + End If Else - bExclude = False - End If - If Not bExclude Then - lSize += GetFolderSize(di.FullName, sInclude, sExclude) + If sInclude.Length > 0 Then + bInclude = CompareValueToArrayRegEx(di.FullName, sInclude) + Else + bInclude = True + End If + + If sExclude.Length > 0 Then + bExclude = CompareValueToArrayRegEx(di.FullName, sExclude) + Else + bExclude = False + End If + + If bInclude And Not bExclude Then + lSize += GetFolderSize(di.FullName, sInclude, sExclude) + End If End If End If Next + Catch 'Do Nothing End Try diff --git a/GBM/Managers/mgrMonitorList.vb b/GBM/Managers/mgrMonitorList.vb index d66f33e..1112f19 100644 --- a/GBM/Managers/mgrMonitorList.vb +++ b/GBM/Managers/mgrMonitorList.vb @@ -36,6 +36,7 @@ Public Class mgrMonitorList If Not IsDBNull(dr("Parameter")) Then oGame.Parameter = CStr(dr("Parameter")) If Not IsDBNull(dr("Comments")) Then oGame.Comments = CStr(dr("Comments")) oGame.IsRegEx = CBool(dr("IsRegEx")) + oGame.RecurseSubFolders = CBool(dr("RecurseSubFolders")) Return oGame End Function @@ -64,6 +65,7 @@ Public Class mgrMonitorList hshParams.Add("Parameter", oGame.Parameter) hshParams.Add("Comments", oGame.Comments) hshParams.Add("IsRegEx", oGame.IsRegEx) + hshParams.Add("RecurseSubFolders", oGame.RecurseSubFolders) Return hshParams End Function @@ -99,7 +101,7 @@ Public Class mgrMonitorList sSQL = "INSERT INTO monitorlist VALUES (@ID, @Name, @Process, @Path, @AbsolutePath, @FolderSave, @FileType, @TimeStamp, " sSQL &= "@ExcludeList, @ProcessPath, @Icon, @Hours, @Version, @Company, @Enabled, @MonitorOnly, @BackupLimit, @CleanFolder, " - sSQL &= "@Parameter, @Comments, @IsRegEx)" + sSQL &= "@Parameter, @Comments, @IsRegEx, @RecurseSubFolders)" 'Parameters hshParams = SetCoreParameters(oGame) @@ -116,7 +118,7 @@ Public Class mgrMonitorList sSQL = "UPDATE monitorlist SET MonitorID=@ID, Name=@Name, Process=@Process, Path=@Path, AbsolutePath=@AbsolutePath, FolderSave=@FolderSave, " sSQL &= "FileType=@FileType, TimeStamp=@TimeStamp, ExcludeList=@ExcludeList, ProcessPath=@ProcessPath, Icon=@Icon, " sSQL &= "Hours=@Hours, Version=@Version, Company=@Company, Enabled=@Enabled, MonitorOnly=@MonitorOnly, BackupLimit=@BackupLimit, " - sSQL &= "CleanFolder=@CleanFolder, Parameter=@Parameter, Comments=@Comments, IsRegEx=@IsRegEx WHERE MonitorID=@QueryID;" + sSQL &= "CleanFolder=@CleanFolder, Parameter=@Parameter, Comments=@Comments, IsRegEx=@IsRegEx, RecurseSubFolders=@RecurseSubFolders WHERE MonitorID=@QueryID;" sSQL &= "UPDATE gametags SET MonitorID=@ID WHERE MonitorID=@QueryID;" If iSelectDB = mgrSQLite.Database.Local Then @@ -367,11 +369,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, BackupLimit, CleanFolder, Parameter, Comments, IsRegEx) " + sSQL = "INSERT OR REPLACE INTO monitorlist (MonitorID, Name, Process, Path, AbsolutePath, FolderSave, FileType, TimeStamp, ExcludeList, ProcessPath, Icon, Hours, Version, Company, Enabled, MonitorOnly, BackupLimit, CleanFolder, Parameter, Comments, IsRegEx, RecurseSubFolders) " sSQL &= "VALUES (@ID, @Name, @Process, @Path, @AbsolutePath, @FolderSave, @FileType, " sSQL &= "@TimeStamp, @ExcludeList, " & sGamePath & ", " sSQL &= sIcon & ", @Hours, " & sVersion & ", " - sSQL &= sCompany & ", " & sMonitorGame & ", @MonitorOnly, @BackupLimit, @CleanFolder, @Parameter, @Comments, @IsRegEx);" + sSQL &= sCompany & ", " & sMonitorGame & ", @MonitorOnly, @BackupLimit, @CleanFolder, @Parameter, @Comments, @IsRegEx, @RecurseSubFolders);" For Each oGame As clsGame In hshGames.Values hshParams = New Hashtable @@ -393,6 +395,7 @@ Public Class mgrMonitorList hshParams.Add("Parameter", oGame.Parameter) hshParams.Add("Comments", oGame.Comments) hshParams.Add("IsRegEx", oGame.IsRegEx) + hshParams.Add("RecurseSubFolders", oGame.RecurseSubFolders) 'Optional Parameters If (eSyncFields And clsGame.eOptionalSyncFields.Company) = clsGame.eOptionalSyncFields.Company Then @@ -548,7 +551,7 @@ Public Class mgrMonitorList ByRef hshParams As Hashtable) As String Dim sSQL As String = String.Empty Dim iCounter As Integer = 0 - Dim sBaseSelect As String = "MonitorID, Name, Process, Path, AbsolutePath, FolderSave, FileType, TimeStamp, ExcludeList, ProcessPath, Icon, Hours, Version, Company, Enabled, MonitorOnly, BackupLimit, CleanFolder, Parameter, Comments, IsRegEx FROM monitorlist" + Dim sBaseSelect As String = "MonitorID, Name, Process, Path, AbsolutePath, FolderSave, FileType, TimeStamp, ExcludeList, ProcessPath, Icon, Hours, Version, Company, Enabled, MonitorOnly, BackupLimit, CleanFolder, Parameter, Comments, IsRegEx, RecurseSubFolders FROM monitorlist" Dim sSort As String = " ORDER BY " & sSortField If bSortAsc Then @@ -745,6 +748,7 @@ Public Class mgrMonitorList If Not IsDBNull(dr("Parameter")) Then oGame.Parameter = CStr(dr("Parameter")) If Not IsDBNull(dr("Comments")) Then oGame.Comments = CStr(dr("Comments")) oGame.IsRegEx = CBool(dr("IsRegEx")) + oGame.RecurseSubFolders = CBool(dr("RecurseSubFolders")) oGame.Tags = mgrGameTags.GetTagsByGameForExport(oGame.ID) oList.Add(oGame) Next diff --git a/GBM/Managers/mgrSQLite.vb b/GBM/Managers/mgrSQLite.vb index 7ead303..025dd3a 100644 --- a/GBM/Managers/mgrSQLite.vb +++ b/GBM/Managers/mgrSQLite.vb @@ -84,7 +84,7 @@ Public Class mgrSQLite sSql &= "CREATE TABLE monitorlist (MonitorID TEXT NOT NULL PRIMARY KEY, 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, " & - "BackupLimit INTEGER NOT NULL, CleanFolder BOOLEAN NOT NULL, Parameter TEXT, Comments TEXT, IsRegEx BOOLEAN NOT NULL);" + "BackupLimit INTEGER NOT NULL, CleanFolder BOOLEAN NOT NULL, Parameter TEXT, Comments TEXT, IsRegEx BOOLEAN NOT NULL, RecurseSubFolders NOT NULL);" 'Add Tables (Tags) sSql &= "CREATE TABLE tags (TagID TEXT NOT NULL UNIQUE, Name TEXT NOT NULL PRIMARY KEY); " @@ -130,7 +130,7 @@ Public Class mgrSQLite sSql = "CREATE TABLE monitorlist (MonitorID TEXT NOT NULL PRIMARY KEY, 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, " & - "BackupLimit INTEGER NOT NULL, CleanFolder BOOLEAN NOT NULL, Parameter TEXT, Comments TEXT, IsRegEx BOOLEAN NOT NULL);" + "BackupLimit INTEGER NOT NULL, CleanFolder BOOLEAN NOT NULL, Parameter TEXT, Comments TEXT, IsRegEx BOOLEAN NOT NULL, RecurseSubFolders NOT NULL);" 'Add Tables (Remote Manifest) sSql &= "CREATE TABLE manifest (ManifestID TEXT NOT NULL PRIMARY KEY, MonitorID TEXT NOT NULL, FileName TEXT NOT NULL, " & @@ -889,9 +889,33 @@ Public Class mgrSQLite sSQL &= "PRAGMA user_version=115" - RunParamQuery(sSQL, New Hashtable) - End If + RunParamQuery(sSQL, New Hashtable) End If + End If + + '1.16 Upgrade + If GetDatabaseVersion() < 116 Then + If eDatabase = Database.Local Then + 'Backup DB before starting + BackupDB("v115") + + 'Add new field(s) + sSQL = "ALTER TABLE monitorlist ADD COLUMN RecurseSubFolders BOOLEAN NOT NULL DEFAULT 1;" + sSQL &= "PRAGMA user_version=116" + + RunParamQuery(sSQL, New Hashtable) + End If + If eDatabase = Database.Remote Then + 'Backup DB before starting + BackupDB("v115") + + 'Add new field(s) + sSQL = "ALTER TABLE monitorlist ADD COLUMN RecurseSubFolders BOOLEAN NOT NULL DEFAULT 1;" + sSQL &= "PRAGMA user_version=116" + + RunParamQuery(sSQL, New Hashtable) + End If + End If End Sub Public Function GetDBSize() As Long diff --git a/GBM/Managers/mgrXML.vb b/GBM/Managers/mgrXML.vb index 9c1be4d..48bca19 100644 --- a/GBM/Managers/mgrXML.vb +++ b/GBM/Managers/mgrXML.vb @@ -41,6 +41,7 @@ Public Class mgrXML oGame.Parameter = g.Parameter oGame.Comments = g.Comments oGame.IsRegEx = g.IsRegEx + oGame.RecurseSubFolders = g.RecurseSubFolders For Each t As Tag In g.Tags oGame.ImportTags.Add(t) Next diff --git a/GBM/My Project/Resources.Designer.vb b/GBM/My Project/Resources.Designer.vb index 3758a8c..ef084d2 100644 --- a/GBM/My Project/Resources.Designer.vb +++ b/GBM/My Project/Resources.Designer.vb @@ -1203,6 +1203,15 @@ Namespace My.Resources End Get End Property + ''' + ''' Looks up a localized string similar to Recurse Sub-Folders. + ''' + Friend ReadOnly Property frmFilter_FieldRecurseSubFolders() As String + Get + Return ResourceManager.GetString("frmFilter_FieldRecurseSubFolders", resourceCulture) + End Get + End Property + ''' ''' Looks up a localized string similar to Save Multiple Backups. ''' @@ -2715,6 +2724,15 @@ Namespace My.Resources End Get End Property + ''' + ''' Looks up a localized string similar to Recurse sub-folders. + ''' + Friend ReadOnly Property frmIncludeExclude_chkRecurseSubFolders() As String + Get + Return ResourceManager.GetString("frmIncludeExclude_chkRecurseSubFolders", resourceCulture) + End Get + End Property + ''' ''' Looks up a localized string similar to Add Custom Item. ''' @@ -2772,9 +2790,9 @@ Namespace My.Resources ''' ''' Looks up a localized string similar to [PARAM] Options. ''' - Friend ReadOnly Property frmIncludeExclude_grpFileOptions() As String + Friend ReadOnly Property frmIncludeExclude_grpOptions() As String Get - Return ResourceManager.GetString("frmIncludeExclude_grpFileOptions", resourceCulture) + Return ResourceManager.GetString("frmIncludeExclude_grpOptions", resourceCulture) End Get End Property diff --git a/GBM/My Project/Resources.resx b/GBM/My Project/Resources.resx index 00d9bcd..f37fc8b 100644 --- a/GBM/My Project/Resources.resx +++ b/GBM/My Project/Resources.resx @@ -967,7 +967,7 @@ [PARAM] Builder - + [PARAM] Options @@ -2269,4 +2269,10 @@ Importing this backup file will overwrite the current backup file for [PARAM].[BR][BR]Do you want to continue? This will close the form. + + Recurse Sub-Folders + + + Recurse sub-folders + \ No newline at end of file