From 3062b20775ee21446d1e4b370c9f6c9777133ff2 Mon Sep 17 00:00:00 2001 From: "Michael J. Seiferling" Date: Mon, 30 Nov 2015 15:05:46 -0600 Subject: [PATCH] Second pass of include / exclude builder --- GBM/Forms/frmGameManager.Designer.vb | 88 ++++++--------- GBM/Forms/frmGameManager.vb | 35 ++++++ GBM/Forms/frmIncludeExclude.Designer.vb | 46 ++++++-- GBM/Forms/frmIncludeExclude.resx | 5 +- GBM/Forms/frmIncludeExclude.vb | 135 ++++++++++++++---------- 5 files changed, 191 insertions(+), 118 deletions(-) diff --git a/GBM/Forms/frmGameManager.Designer.vb b/GBM/Forms/frmGameManager.Designer.vb index 8cc94e2..7a8a877 100644 --- a/GBM/Forms/frmGameManager.Designer.vb +++ b/GBM/Forms/frmGameManager.Designer.vb @@ -30,8 +30,6 @@ Partial Class frmGameManager Me.btnExclude = New System.Windows.Forms.Button() Me.btnInclude = New System.Windows.Forms.Button() Me.txtID = New System.Windows.Forms.TextBox() - Me.lblExclude = New System.Windows.Forms.Label() - Me.lblFileType = New System.Windows.Forms.Label() Me.btnSavePathBrowse = New System.Windows.Forms.Button() Me.btnProcessBrowse = New System.Windows.Forms.Button() Me.lblSavePath = New System.Windows.Forms.Label() @@ -139,8 +137,6 @@ Partial Class frmGameManager Me.grpConfig.Controls.Add(Me.btnExclude) Me.grpConfig.Controls.Add(Me.btnInclude) Me.grpConfig.Controls.Add(Me.txtID) - Me.grpConfig.Controls.Add(Me.lblExclude) - Me.grpConfig.Controls.Add(Me.lblFileType) Me.grpConfig.Controls.Add(Me.btnSavePathBrowse) Me.grpConfig.Controls.Add(Me.btnProcessBrowse) Me.grpConfig.Controls.Add(Me.lblSavePath) @@ -156,57 +152,39 @@ Partial Class frmGameManager Me.grpConfig.Enabled = False Me.grpConfig.Location = New System.Drawing.Point(238, 12) Me.grpConfig.Name = "grpConfig" - Me.grpConfig.Size = New System.Drawing.Size(534, 182) + Me.grpConfig.Size = New System.Drawing.Size(534, 157) Me.grpConfig.TabIndex = 4 Me.grpConfig.TabStop = False Me.grpConfig.Text = "Configuration" ' 'btnExclude ' - Me.btnExclude.Location = New System.Drawing.Point(69, 122) + Me.btnExclude.Location = New System.Drawing.Point(9, 125) Me.btnExclude.Name = "btnExclude" - Me.btnExclude.Size = New System.Drawing.Size(30, 20) + Me.btnExclude.Size = New System.Drawing.Size(176, 23) Me.btnExclude.TabIndex = 13 - Me.btnExclude.Text = "..." + Me.btnExclude.Text = "E&xclude Items..." Me.btnExclude.UseVisualStyleBackColor = True ' 'btnInclude ' - Me.btnInclude.Location = New System.Drawing.Point(69, 97) + Me.btnInclude.Location = New System.Drawing.Point(9, 97) Me.btnInclude.Name = "btnInclude" - Me.btnInclude.Size = New System.Drawing.Size(30, 20) - Me.btnInclude.TabIndex = 11 - Me.btnInclude.Text = "..." + Me.btnInclude.Size = New System.Drawing.Size(176, 23) + Me.btnInclude.TabIndex = 10 + Me.btnInclude.Text = "In&clude Items..." Me.btnInclude.UseVisualStyleBackColor = True ' 'txtID ' Me.txtID.Enabled = False - Me.txtID.Location = New System.Drawing.Point(495, 147) + Me.txtID.Location = New System.Drawing.Point(495, 19) Me.txtID.Name = "txtID" Me.txtID.Size = New System.Drawing.Size(33, 20) Me.txtID.TabIndex = 16 Me.txtID.TabStop = False Me.txtID.Visible = False ' - 'lblExclude - ' - Me.lblExclude.AutoSize = True - Me.lblExclude.Location = New System.Drawing.Point(6, 126) - Me.lblExclude.Name = "lblExclude" - Me.lblExclude.Size = New System.Drawing.Size(48, 13) - Me.lblExclude.TabIndex = 4 - Me.lblExclude.Text = "Exclude:" - ' - 'lblFileType - ' - Me.lblFileType.AutoSize = True - Me.lblFileType.Location = New System.Drawing.Point(6, 100) - Me.lblFileType.Name = "lblFileType" - Me.lblFileType.Size = New System.Drawing.Size(45, 13) - Me.lblFileType.TabIndex = 3 - Me.lblFileType.Text = "Include:" - ' 'btnSavePathBrowse ' Me.btnSavePathBrowse.Location = New System.Drawing.Point(498, 71) @@ -254,37 +232,39 @@ Partial Class frmGameManager ' 'txtExclude ' - Me.txtExclude.Location = New System.Drawing.Point(105, 123) + Me.txtExclude.Location = New System.Drawing.Point(354, 127) Me.txtExclude.Name = "txtExclude" - Me.txtExclude.Size = New System.Drawing.Size(423, 20) - Me.txtExclude.TabIndex = 12 + Me.txtExclude.Size = New System.Drawing.Size(174, 20) + Me.txtExclude.TabIndex = 0 + Me.txtExclude.TabStop = False Me.txtExclude.Visible = False ' 'txtFileType ' - Me.txtFileType.Location = New System.Drawing.Point(105, 97) + Me.txtFileType.Location = New System.Drawing.Point(354, 99) Me.txtFileType.Name = "txtFileType" - Me.txtFileType.Size = New System.Drawing.Size(423, 20) - Me.txtFileType.TabIndex = 10 + Me.txtFileType.Size = New System.Drawing.Size(174, 20) + Me.txtFileType.TabIndex = 0 + Me.txtFileType.TabStop = False Me.txtFileType.Visible = False ' 'chkTimeStamp ' Me.chkTimeStamp.AutoSize = True - Me.chkTimeStamp.Location = New System.Drawing.Point(124, 149) + Me.chkTimeStamp.Location = New System.Drawing.Point(191, 129) Me.chkTimeStamp.Name = "chkTimeStamp" Me.chkTimeStamp.Size = New System.Drawing.Size(146, 17) - Me.chkTimeStamp.TabIndex = 15 + Me.chkTimeStamp.TabIndex = 14 Me.chkTimeStamp.Text = "Time stamp each backup" Me.chkTimeStamp.UseVisualStyleBackColor = True ' 'chkFolderSave ' Me.chkFolderSave.AutoSize = True - Me.chkFolderSave.Location = New System.Drawing.Point(9, 149) + Me.chkFolderSave.Location = New System.Drawing.Point(191, 101) Me.chkFolderSave.Name = "chkFolderSave" Me.chkFolderSave.Size = New System.Drawing.Size(109, 17) - Me.chkFolderSave.TabIndex = 14 + Me.chkFolderSave.TabIndex = 11 Me.chkFolderSave.Text = "Save entire folder" Me.chkFolderSave.UseVisualStyleBackColor = True ' @@ -306,13 +286,13 @@ Partial Class frmGameManager ' Me.txtName.Location = New System.Drawing.Point(69, 19) Me.txtName.Name = "txtName" - Me.txtName.Size = New System.Drawing.Size(459, 20) + Me.txtName.Size = New System.Drawing.Size(423, 20) Me.txtName.TabIndex = 5 ' 'chkMonitorOnly ' Me.chkMonitorOnly.AutoSize = True - Me.chkMonitorOnly.Location = New System.Drawing.Point(353, 365) + Me.chkMonitorOnly.Location = New System.Drawing.Point(353, 340) Me.chkMonitorOnly.Name = "chkMonitorOnly" Me.chkMonitorOnly.Size = New System.Drawing.Size(145, 17) Me.chkMonitorOnly.TabIndex = 7 @@ -336,7 +316,7 @@ Partial Class frmGameManager Me.grpExtra.Controls.Add(Me.txtAppPath) Me.grpExtra.Controls.Add(Me.nudHours) Me.grpExtra.Controls.Add(Me.lblHours) - Me.grpExtra.Location = New System.Drawing.Point(238, 200) + Me.grpExtra.Location = New System.Drawing.Point(238, 175) Me.grpExtra.Name = "grpExtra" Me.grpExtra.Size = New System.Drawing.Size(534, 155) Me.grpExtra.TabIndex = 5 @@ -467,7 +447,7 @@ Partial Class frmGameManager ' 'btnTags ' - Me.btnTags.Location = New System.Drawing.Point(535, 360) + Me.btnTags.Location = New System.Drawing.Point(535, 336) Me.btnTags.Name = "btnTags" Me.btnTags.Size = New System.Drawing.Size(75, 23) Me.btnTags.TabIndex = 8 @@ -487,9 +467,9 @@ Partial Class frmGameManager Me.grpStats.Controls.Add(Me.lblCurrentBackup) Me.grpStats.Controls.Add(Me.txtLocalBackup) Me.grpStats.Controls.Add(Me.lblLastBackup) - Me.grpStats.Location = New System.Drawing.Point(238, 390) + Me.grpStats.Location = New System.Drawing.Point(238, 365) Me.grpStats.Name = "grpStats" - Me.grpStats.Size = New System.Drawing.Size(534, 129) + Me.grpStats.Size = New System.Drawing.Size(534, 154) Me.grpStats.TabIndex = 11 Me.grpStats.TabStop = False Me.grpStats.Text = "Backup Information" @@ -497,7 +477,7 @@ Partial Class frmGameManager 'btnOpenRestorePath ' Me.btnOpenRestorePath.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) - Me.btnOpenRestorePath.Location = New System.Drawing.Point(336, 100) + Me.btnOpenRestorePath.Location = New System.Drawing.Point(339, 105) Me.btnOpenRestorePath.Name = "btnOpenRestorePath" Me.btnOpenRestorePath.Size = New System.Drawing.Size(114, 23) Me.btnOpenRestorePath.TabIndex = 9 @@ -507,7 +487,7 @@ Partial Class frmGameManager 'btnOpenBackupFile ' Me.btnOpenBackupFile.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) - Me.btnOpenBackupFile.Location = New System.Drawing.Point(216, 100) + Me.btnOpenBackupFile.Location = New System.Drawing.Point(216, 105) Me.btnOpenBackupFile.Name = "btnOpenBackupFile" Me.btnOpenBackupFile.Size = New System.Drawing.Size(114, 23) Me.btnOpenBackupFile.TabIndex = 8 @@ -526,7 +506,7 @@ Partial Class frmGameManager 'btnDeleteBackup ' Me.btnDeleteBackup.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) - Me.btnDeleteBackup.Location = New System.Drawing.Point(96, 100) + Me.btnDeleteBackup.Location = New System.Drawing.Point(96, 105) Me.btnDeleteBackup.Name = "btnDeleteBackup" Me.btnDeleteBackup.Size = New System.Drawing.Size(114, 23) Me.btnDeleteBackup.TabIndex = 7 @@ -611,7 +591,7 @@ Partial Class frmGameManager 'btnSave ' Me.btnSave.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) - Me.btnSave.Location = New System.Drawing.Point(616, 360) + Me.btnSave.Location = New System.Drawing.Point(616, 336) Me.btnSave.Name = "btnSave" Me.btnSave.Size = New System.Drawing.Size(75, 23) Me.btnSave.TabIndex = 9 @@ -631,7 +611,7 @@ Partial Class frmGameManager 'btnCancel ' Me.btnCancel.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) - Me.btnCancel.Location = New System.Drawing.Point(697, 360) + Me.btnCancel.Location = New System.Drawing.Point(697, 336) Me.btnCancel.Name = "btnCancel" Me.btnCancel.Size = New System.Drawing.Size(75, 23) Me.btnCancel.TabIndex = 10 @@ -641,7 +621,7 @@ Partial Class frmGameManager 'chkEnabled ' Me.chkEnabled.AutoSize = True - Me.chkEnabled.Location = New System.Drawing.Point(238, 365) + Me.chkEnabled.Location = New System.Drawing.Point(238, 340) Me.chkEnabled.Name = "chkEnabled" Me.chkEnabled.Size = New System.Drawing.Size(109, 17) Me.chkEnabled.TabIndex = 6 @@ -766,8 +746,6 @@ Partial Class frmGameManager Friend WithEvents txtFileType As System.Windows.Forms.TextBox Friend WithEvents btnSavePathBrowse As System.Windows.Forms.Button Friend WithEvents btnProcessBrowse As System.Windows.Forms.Button - Friend WithEvents lblExclude As System.Windows.Forms.Label - Friend WithEvents lblFileType As System.Windows.Forms.Label Friend WithEvents btnSave As System.Windows.Forms.Button Friend WithEvents btnAppPathBrowse As System.Windows.Forms.Button Friend WithEvents lblGamePath As System.Windows.Forms.Label diff --git a/GBM/Forms/frmGameManager.vb b/GBM/Forms/frmGameManager.vb index 2940b9d..ff8585c 100644 --- a/GBM/Forms/frmGameManager.vb +++ b/GBM/Forms/frmGameManager.vb @@ -365,12 +365,16 @@ Public Class frmGameManager lstGames.ValueMember = "Key" lstGames.DisplayMember = "Value" + lstGames.BeginUpdate() + For Each de As DictionaryEntry In AppData oApp = DirectCast(de.Value, clsGame) oData = New KeyValuePair(Of String, String)(oApp.ID, oApp.Name) lstGames.Items.Add(oData) Next + lstGames.EndUpdate() + IsLoading = False End Sub @@ -386,6 +390,22 @@ Public Class frmGameManager End Sub + Private Sub UpdateBuilderButtonLabel(ByVal sBuilderString As String, ByVal sLabel As String, ByVal btn As Button, ByVal bDirty As Boolean) + Dim iCount As Integer = sBuilderString.Split(":").Length + + If sBuilderString <> String.Empty And iCount > 0 Then + btn.Text = sLabel & " Items... (" & iCount & ")" + Else + btn.Text = sLabel & " Items..." + End If + + If bDirty Then + btn.Font = New Font(FontFamily.GenericSansSerif, 8.25, FontStyle.Bold) + Else + btn.Font = New Font(FontFamily.GenericSansSerif, 8.25, FontStyle.Regular) + End If + End Sub + Private Function GetBuilderRoot() As String Dim sRoot As String = String.Empty @@ -411,6 +431,7 @@ Public Class frmGameManager frm.RootFolder = GetBuilderRoot() frm.ShowDialog() + txtBox.Text = frm.BuilderString End Sub @@ -598,6 +619,10 @@ Public Class frmGameManager chkEnabled.Checked = oApp.Enabled chkMonitorOnly.Checked = oApp.MonitorOnly + 'Update Buttons + UpdateBuilderButtonLabel(oApp.FileType, "In&clude", btnInclude, False) + UpdateBuilderButtonLabel(oApp.ExcludeList, "E&xclude", btnExclude, False) + 'Extra txtAppPath.Text = oApp.ProcessPath txtCompany.Text = oApp.Company @@ -1229,9 +1254,19 @@ Public Class frmGameManager Private Sub btnInclude_Click(sender As Object, e As EventArgs) Handles btnInclude.Click OpenBuilder("Include", txtFileType) + UpdateBuilderButtonLabel(txtFileType.Text, "In&clude", btnInclude, (oCurrentGame.FileType <> txtFileType.Text)) End Sub Private Sub btnExclude_Click(sender As Object, e As EventArgs) Handles btnExclude.Click OpenBuilder("Exclude", txtExclude) + UpdateBuilderButtonLabel(txtExclude.Text, "E&xclude", btnExclude, (oCurrentGame.ExcludeList <> txtExclude.Text)) + End Sub + + Private Sub chkFolderSave_CheckedChanged(sender As Object, e As EventArgs) Handles chkFolderSave.CheckedChanged + If chkFolderSave.Checked Then + btnInclude.Enabled = False + Else + btnInclude.Enabled = True + End If End Sub End Class \ No newline at end of file diff --git a/GBM/Forms/frmIncludeExclude.Designer.vb b/GBM/Forms/frmIncludeExclude.Designer.vb index 676159e..df304ad 100644 --- a/GBM/Forms/frmIncludeExclude.Designer.vb +++ b/GBM/Forms/frmIncludeExclude.Designer.vb @@ -41,6 +41,9 @@ Partial Class frmIncludeExclude 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.cmsItems.SuspendLayout() Me.grpFileOptions.SuspendLayout() Me.SuspendLayout() @@ -50,10 +53,10 @@ Partial Class frmIncludeExclude Me.treFiles.CheckBoxes = True Me.treFiles.ImageIndex = 0 Me.treFiles.ImageList = Me.imgIcons - Me.treFiles.Location = New System.Drawing.Point(12, 38) + Me.treFiles.Location = New System.Drawing.Point(12, 64) Me.treFiles.Name = "treFiles" Me.treFiles.SelectedImageIndex = 0 - Me.treFiles.Size = New System.Drawing.Size(250, 359) + Me.treFiles.Size = New System.Drawing.Size(250, 333) Me.treFiles.TabIndex = 1 ' 'imgIcons @@ -69,8 +72,8 @@ Partial Class frmIncludeExclude Me.btnSave.Location = New System.Drawing.Point(416, 426) Me.btnSave.Name = "btnSave" Me.btnSave.Size = New System.Drawing.Size(75, 23) - Me.btnSave.TabIndex = 6 - Me.btnSave.Text = "Save" + Me.btnSave.TabIndex = 7 + Me.btnSave.Text = "&Save" Me.btnSave.UseVisualStyleBackColor = True ' 'btnCancel @@ -78,13 +81,13 @@ Partial Class frmIncludeExclude Me.btnCancel.Location = New System.Drawing.Point(497, 426) Me.btnCancel.Name = "btnCancel" Me.btnCancel.Size = New System.Drawing.Size(75, 23) - Me.btnCancel.TabIndex = 7 - Me.btnCancel.Text = "Cancel" + Me.btnCancel.TabIndex = 8 + Me.btnCancel.Text = "&Cancel" Me.btnCancel.UseVisualStyleBackColor = True ' 'txtRootFolder ' - Me.txtRootFolder.Location = New System.Drawing.Point(12, 12) + Me.txtRootFolder.Location = New System.Drawing.Point(12, 38) Me.txtRootFolder.Name = "txtRootFolder" Me.txtRootFolder.ReadOnly = True Me.txtRootFolder.Size = New System.Drawing.Size(214, 20) @@ -93,7 +96,7 @@ Partial Class frmIncludeExclude ' 'btnBrowse ' - Me.btnBrowse.Location = New System.Drawing.Point(232, 12) + Me.btnBrowse.Location = New System.Drawing.Point(232, 37) Me.btnBrowse.Name = "btnBrowse" Me.btnBrowse.Size = New System.Drawing.Size(30, 20) Me.btnBrowse.TabIndex = 0 @@ -196,11 +199,35 @@ Partial Class frmIncludeExclude Me.lblItems.Text = "Items" Me.lblItems.TextAlign = System.Drawing.ContentAlignment.MiddleCenter ' + 'btnRawEdit + ' + Me.btnRawEdit.Location = New System.Drawing.Point(335, 426) + Me.btnRawEdit.Name = "btnRawEdit" + Me.btnRawEdit.Size = New System.Drawing.Size(75, 23) + Me.btnRawEdit.TabIndex = 6 + Me.btnRawEdit.Text = "Raw &Edit" + Me.btnRawEdit.UseVisualStyleBackColor = True + ' + 'lblSaveFolder + ' + Me.lblSaveFolder.Location = New System.Drawing.Point(9, 16) + Me.lblSaveFolder.Name = "lblSaveFolder" + Me.lblSaveFolder.Size = New System.Drawing.Size(250, 13) + Me.lblSaveFolder.TabIndex = 15 + Me.lblSaveFolder.Text = "Saved Game Folder" + Me.lblSaveFolder.TextAlign = System.Drawing.ContentAlignment.MiddleCenter + ' + 'ttWarning + ' + Me.ttWarning.ToolTipIcon = System.Windows.Forms.ToolTipIcon.Warning + ' 'frmIncludeExclude ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font Me.ClientSize = New System.Drawing.Size(584, 461) + Me.Controls.Add(Me.lblSaveFolder) + Me.Controls.Add(Me.btnRawEdit) Me.Controls.Add(Me.lblItems) Me.Controls.Add(Me.grpFileOptions) Me.Controls.Add(Me.btnRemove) @@ -242,4 +269,7 @@ Partial Class frmIncludeExclude Friend WithEvents cmsEdit As System.Windows.Forms.ToolStripMenuItem Friend WithEvents cmsRemove As System.Windows.Forms.ToolStripMenuItem Friend WithEvents cmsAdd As System.Windows.Forms.ToolStripMenuItem + Friend WithEvents btnRawEdit As Button + Friend WithEvents lblSaveFolder As Label + Friend WithEvents ttWarning As ToolTip End Class diff --git a/GBM/Forms/frmIncludeExclude.resx b/GBM/Forms/frmIncludeExclude.resx index b26b3df..423d39f 100644 --- a/GBM/Forms/frmIncludeExclude.resx +++ b/GBM/Forms/frmIncludeExclude.resx @@ -125,7 +125,7 @@ AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAAB6 - CQAAAk1TRnQBSQFMAgEBAwEAAZABAAGQAQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo + CQAAAk1TRnQBSQFMAgEBAwEAAaABAAGgAQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo AwABQAMAARADAAEBAQABCAYAAQQYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5 AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA @@ -171,4 +171,7 @@ 118, 17 + + 221, 17 + \ No newline at end of file diff --git a/GBM/Forms/frmIncludeExclude.vb b/GBM/Forms/frmIncludeExclude.vb index 7551d9f..d246558 100644 --- a/GBM/Forms/frmIncludeExclude.vb +++ b/GBM/Forms/frmIncludeExclude.vb @@ -39,43 +39,45 @@ Public Class frmIncludeExclude Dim oChild As TreeNode Dim oPlaceHolder As TreeNode - Try - Cursor.Current = Cursors.WaitCursor - treFiles.BeginUpdate() + If oNode.Nodes.ContainsKey("GBM_Tree_Placeholder") Then + Try + Cursor.Current = Cursors.WaitCursor + treFiles.BeginUpdate() - oNode.Nodes.RemoveByKey("GBM_Tree_Placeholder") + oNode.Nodes.RemoveByKey("GBM_Tree_Placeholder") - sFolders = Directory.GetDirectories(sDirectory) - sFiles = Directory.GetFiles(sDirectory) + sFolders = Directory.GetDirectories(sDirectory) + sFiles = Directory.GetFiles(sDirectory) - If sFolders.Length <> 0 Then - For Each sFolder As String In sFolders - oChild = New TreeNode(sFolder.Replace(sDirectory, String.Empty).TrimStart("\"), 0, 0) - oChild.Name = sFolder - oChild.Tag = 0 - oNode.Nodes.Add(oChild) - oPlaceHolder = New TreeNode("GBM_Tree_Placeholder") - oPlaceHolder.Name = "GBM_Tree_Placeholder" - oChild.Nodes.Add(oPlaceHolder) - Next - End If + If sFolders.Length <> 0 Then + For Each sFolder As String In sFolders + oChild = New TreeNode(sFolder.Replace(sDirectory, String.Empty).TrimStart("\"), 0, 0) + oChild.Name = sFolder + oChild.Tag = 0 + oNode.Nodes.Add(oChild) + oPlaceHolder = New TreeNode("GBM_Tree_Placeholder") + oPlaceHolder.Name = "GBM_Tree_Placeholder" + oChild.Nodes.Add(oPlaceHolder) + Next + End If - If sFiles.Length <> 0 Then - For Each sFile As String In sFiles - oChild = New TreeNode(sFile.Replace(sDirectory, String.Empty).TrimStart("\"), 1, 1) - oChild.Tag = 1 - oNode.Nodes.Add(oChild) - Next - End If + If sFiles.Length <> 0 Then + For Each sFile As String In sFiles + oChild = New TreeNode(sFile.Replace(sDirectory, String.Empty).TrimStart("\"), 1, 1) + oChild.Tag = 1 + oNode.Nodes.Add(oChild) + Next + End If - Catch uaex As UnauthorizedAccessException - 'Do Nothing - Catch ex As Exception - MsgBox("An unexpected error occured while reading the file system: " & vbCrLf & vbCrLf & ex.Message, MsgBoxStyle.Critical, "Game Backup Monitor") - Finally - treFiles.EndUpdate() - Cursor.Current = Cursors.Default - End Try + Catch uaex As UnauthorizedAccessException + 'Do Nothing + Catch ex As Exception + MsgBox("An unexpected error occured while reading the file system: " & vbCrLf & vbCrLf & ex.Message, MsgBoxStyle.Critical, "Game Backup Monitor") + Finally + treFiles.EndUpdate() + Cursor.Current = Cursors.Default + End Try + End If End Sub Private Sub BuildTrunk() @@ -89,6 +91,7 @@ Public Class frmIncludeExclude treFiles.Nodes.Clear() oRootNode.Name = "Root" + oRootNode.Nodes.Add("GBM_Tree_Placeholder", "GBM_Tree_Placeholder") treFiles.Nodes.Add(oRootNode) BuildBranch(txtRootFolder.Text, oRootNode) End Sub @@ -160,38 +163,40 @@ Public Class frmIncludeExclude Next End Sub - Private Sub ParseBuilderString() + Private Sub ParseBuilderString(ByVal sString As String) Dim iType As Integer = 1 Dim oListViewItem As ListViewItem - Dim sItems As String() = BuilderString.Split(":") + Dim sItems As String() = sString.Split(":") + + lstBuilder.BeginUpdate() + lstBuilder.Clear() For Each sItem As String In sItems - If sItem.Contains("*") Then - iType = 2 - Else - If txtRootFolder.Text <> String.Empty Then - If Directory.Exists(txtRootFolder.Text & "\" & sItem) Then - iType = 0 - Else - iType = 1 - End If - End If - End If - - oListViewItem = New ListViewItem(sItem, iType) + oListViewItem = New ListViewItem(sItem) oListViewItem.Name = sItem - lstBuilder.Items.Add(oListViewItem) + IdentifyEntry(oListViewItem, sItem) + If Not lstBuilder.Items.ContainsKey(sItem) Then + lstBuilder.Items.Add(oListViewItem) + End If Next + + lstBuilder.EndUpdate() End Sub Private Sub IdentifyEntry(ByRef oListItem As ListViewItem, ByVal sNewLabel As String) Dim iType As Integer = 1 + Dim sFolderCheck As String If sNewLabel.Contains("*") Then iType = 2 Else If txtRootFolder.Text <> String.Empty Then - If Directory.Exists(txtRootFolder.Text & "\" & sNewLabel) Then + If Path.GetFileName(txtRootFolder.Text) = sNewLabel Then + sFolderCheck = txtRootFolder.Text + Else + sFolderCheck = txtRootFolder.Text & "\" & sNewLabel + End If + If Directory.Exists(sFolderCheck) Then iType = 0 Else iType = 1 @@ -202,7 +207,7 @@ Public Class frmIncludeExclude oListItem.ImageIndex = iType End Sub - Private Sub CreateNewBuilderString() + Private Function CreateNewBuilderString() As String Dim sTempString As String = String.Empty For Each oListViewItem As ListViewItem In lstBuilder.Items @@ -211,7 +216,16 @@ Public Class frmIncludeExclude sTempString = sTempString.TrimEnd(":") - BuilderString = sTempString + Return sTempString + End Function + + Private Sub OpenRawEdit() + Dim sCurrentString As String = CreateNewBuilderString() + Dim sNewString As String + sNewString = InputBox("Entries are semi-colon delimited.", FormName & " Raw Edit", sCurrentString) + If sNewString <> String.Empty Then + ParseBuilderString(sNewString) + End If End Sub Private Sub frmIncludeExclude_Load(sender As Object, e As EventArgs) Handles MyBase.Load @@ -219,13 +233,18 @@ Public Class frmIncludeExclude txtRootFolder.Text = RootFolder optFileTypes.Checked = True lblItems.Text = FormName & " Items" - If BuilderString <> String.Empty Then ParseBuilderString() + grpFileOptions.Text = FormName & " Options" + If BuilderString <> String.Empty Then ParseBuilderString(BuilderString) If txtRootFolder.Text <> String.Empty Then BuildTrunk() End Sub Private Sub frmIncludeExclude_Shown(sender As Object, e As EventArgs) Handles MyBase.Shown treFiles.Select() If Not treFiles.SelectedNode Is Nothing Then treFiles.SelectedNode.Expand() + If txtRootFolder.Text = String.Empty Then + ttWarning.ToolTipTitle = "Notice" + ttWarning.Show("The saved game folder could not be determined or does not exist. Click here to manually set it.", btnBrowse, 10000) + End If End Sub Private Sub btnBrowse_Click(sender As Object, e As EventArgs) Handles btnBrowse.Click @@ -236,7 +255,7 @@ Public Class frmIncludeExclude End Sub Private Sub btnSave_Click(sender As Object, e As EventArgs) Handles btnSave.Click - CreateNewBuilderString() + BuilderString = CreateNewBuilderString() Me.Close() End Sub @@ -289,7 +308,15 @@ Public Class frmIncludeExclude Private Sub lstBuilder_AfterLabelEdit(sender As Object, e As LabelEditEventArgs) Handles lstBuilder.AfterLabelEdit If Not e.Label Is Nothing Then - IdentifyEntry(lstBuilder.Items(e.Item), e.Label) + If lstBuilder.Items.ContainsKey(e.Label) Then + e.CancelEdit = True + Else + IdentifyEntry(lstBuilder.Items(e.Item), e.Label) + End If End If End Sub + + Private Sub btnRawEdit_Click(sender As Object, e As EventArgs) Handles btnRawEdit.Click + OpenRawEdit() + End Sub End Class \ No newline at end of file