First pass of include / exclude builder

This commit is contained in:
Michael J. Seiferling
2015-11-27 17:07:50 -06:00
parent 7e1302714d
commit de5d1e062a
7 changed files with 284 additions and 58 deletions
+1
View File
@@ -96,6 +96,7 @@ Partial Class frmAdvancedImport
Me.Controls.Add(Me.btnImport)
Me.Controls.Add(Me.lstGames)
Me.Controls.Add(Me.lblGames)
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle
Me.MaximizeBox = False
Me.MinimizeBox = False
Me.Name = "frmAdvancedImport"
+21 -9
View File
@@ -27,6 +27,7 @@ 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.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()
@@ -81,7 +82,7 @@ Partial Class frmGameManager
Me.optBackupData = New System.Windows.Forms.RadioButton()
Me.optPendingRestores = New System.Windows.Forms.RadioButton()
Me.optAllGames = New System.Windows.Forms.RadioButton()
Me.btnInclude = New System.Windows.Forms.Button()
Me.btnExclude = New System.Windows.Forms.Button()
Me.grpConfig.SuspendLayout()
Me.grpExtra.SuspendLayout()
CType(Me.pbIcon, System.ComponentModel.ISupportInitialize).BeginInit()
@@ -135,6 +136,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.btnExclude)
Me.grpConfig.Controls.Add(Me.btnInclude)
Me.grpConfig.Controls.Add(Me.txtID)
Me.grpConfig.Controls.Add(Me.lblExclude)
@@ -159,6 +161,15 @@ Partial Class frmGameManager
Me.grpConfig.TabStop = False
Me.grpConfig.Text = "Configuration"
'
'btnInclude
'
Me.btnInclude.Location = New System.Drawing.Point(498, 97)
Me.btnInclude.Name = "btnInclude"
Me.btnInclude.Size = New System.Drawing.Size(30, 20)
Me.btnInclude.TabIndex = 15
Me.btnInclude.Text = "..."
Me.btnInclude.UseVisualStyleBackColor = True
'
'txtID
'
Me.txtID.Enabled = False
@@ -236,7 +247,7 @@ Partial Class frmGameManager
'
Me.txtExclude.Location = New System.Drawing.Point(69, 123)
Me.txtExclude.Name = "txtExclude"
Me.txtExclude.Size = New System.Drawing.Size(459, 20)
Me.txtExclude.Size = New System.Drawing.Size(423, 20)
Me.txtExclude.TabIndex = 12
'
'txtFileType
@@ -683,14 +694,14 @@ Partial Class frmGameManager
Me.optAllGames.Text = "All"
Me.optAllGames.UseVisualStyleBackColor = True
'
'btnInclude
'btnExclude
'
Me.btnInclude.Location = New System.Drawing.Point(498, 97)
Me.btnInclude.Name = "btnInclude"
Me.btnInclude.Size = New System.Drawing.Size(30, 20)
Me.btnInclude.TabIndex = 15
Me.btnInclude.Text = "..."
Me.btnInclude.UseVisualStyleBackColor = True
Me.btnExclude.Location = New System.Drawing.Point(498, 123)
Me.btnExclude.Name = "btnExclude"
Me.btnExclude.Size = New System.Drawing.Size(30, 20)
Me.btnExclude.TabIndex = 16
Me.btnExclude.Text = "..."
Me.btnExclude.UseVisualStyleBackColor = True
'
'frmGameManager
'
@@ -794,4 +805,5 @@ Partial Class frmGameManager
Friend WithEvents lblTags As System.Windows.Forms.Label
Friend WithEvents optTag As System.Windows.Forms.RadioButton
Friend WithEvents btnInclude As System.Windows.Forms.Button
Friend WithEvents btnExclude As System.Windows.Forms.Button
End Class
+19 -6
View File
@@ -386,23 +386,32 @@ Public Class frmGameManager
End Sub
Private Sub OpenIncludeBuilder()
Dim frm As New frmIncludeExclude
frm.FormName = "Include Builder"
Private Function GetBuilderRoot() As String
Dim sRoot As String = String.Empty
If Path.IsPathRooted(txtSavePath.Text) Then
If Directory.Exists(txtSavePath.Text) Then
frm.RootFolder = txtSavePath.Text
sRoot = txtSavePath.Text
End If
Else
If txtAppPath.Text <> String.Empty Then
If Directory.Exists(txtAppPath.Text & "\" & txtSavePath.Text) Then
frm.RootFolder = txtAppPath.Text & "\" & txtSavePath.Text
sRoot = txtAppPath.Text & "\" & txtSavePath.Text
End If
End If
End If
Return sRoot
End Function
Private Sub OpenBuilder(ByVal sFormText As String, ByRef txtBox As TextBox)
Dim frm As New frmIncludeExclude
frm.FormName = sFormText
frm.BuilderString = txtBox.Text
frm.RootFolder = GetBuilderRoot()
frm.ShowDialog()
txtBox.Text = frm.BuilderString
End Sub
Private Function FindRestorePath() As Boolean
@@ -1219,6 +1228,10 @@ Public Class frmGameManager
End Sub
Private Sub btnInclude_Click(sender As Object, e As EventArgs) Handles btnInclude.Click
OpenIncludeBuilder()
OpenBuilder("Include", txtFileType)
End Sub
Private Sub btnExclude_Click(sender As Object, e As EventArgs) Handles btnExclude.Click
OpenBuilder("Exclude", txtExclude)
End Sub
End Class
+64 -7
View File
@@ -26,7 +26,6 @@ Partial Class frmIncludeExclude
Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(frmIncludeExclude))
Me.treFiles = New System.Windows.Forms.TreeView()
Me.imgIcons = New System.Windows.Forms.ImageList(Me.components)
Me.bwLoader = New System.ComponentModel.BackgroundWorker()
Me.btnSave = New System.Windows.Forms.Button()
Me.btnCancel = New System.Windows.Forms.Button()
Me.txtRootFolder = New System.Windows.Forms.TextBox()
@@ -34,16 +33,22 @@ Partial Class frmIncludeExclude
Me.lstBuilder = New System.Windows.Forms.ListView()
Me.btnRemove = New System.Windows.Forms.Button()
Me.btnAdd = New System.Windows.Forms.Button()
Me.grpFileOptions = New System.Windows.Forms.GroupBox()
Me.optIndividualFiles = New System.Windows.Forms.RadioButton()
Me.optFileTypes = New System.Windows.Forms.RadioButton()
Me.lblItems = New System.Windows.Forms.Label()
Me.grpFileOptions.SuspendLayout()
Me.SuspendLayout()
'
'treFiles
'
Me.treFiles.CheckBoxes = True
Me.treFiles.ImageIndex = 0
Me.treFiles.ImageList = Me.imgIcons
Me.treFiles.Location = New System.Drawing.Point(12, 38)
Me.treFiles.Name = "treFiles"
Me.treFiles.SelectedImageIndex = 0
Me.treFiles.Size = New System.Drawing.Size(230, 359)
Me.treFiles.Size = New System.Drawing.Size(250, 359)
Me.treFiles.TabIndex = 0
'
'imgIcons
@@ -52,6 +57,7 @@ Partial Class frmIncludeExclude
Me.imgIcons.TransparentColor = System.Drawing.Color.Transparent
Me.imgIcons.Images.SetKeyName(0, "folder.ico")
Me.imgIcons.Images.SetKeyName(1, "file.ico")
Me.imgIcons.Images.SetKeyName(2, "type.ico")
'
'btnSave
'
@@ -81,7 +87,7 @@ Partial Class frmIncludeExclude
'
'btnBrowse
'
Me.btnBrowse.Location = New System.Drawing.Point(212, 11)
Me.btnBrowse.Location = New System.Drawing.Point(212, 12)
Me.btnBrowse.Name = "btnBrowse"
Me.btnBrowse.Size = New System.Drawing.Size(30, 20)
Me.btnBrowse.TabIndex = 9
@@ -90,11 +96,13 @@ Partial Class frmIncludeExclude
'
'lstBuilder
'
Me.lstBuilder.Location = New System.Drawing.Point(342, 38)
Me.lstBuilder.Location = New System.Drawing.Point(322, 38)
Me.lstBuilder.Name = "lstBuilder"
Me.lstBuilder.Size = New System.Drawing.Size(230, 359)
Me.lstBuilder.Size = New System.Drawing.Size(250, 359)
Me.lstBuilder.SmallImageList = Me.imgIcons
Me.lstBuilder.TabIndex = 10
Me.lstBuilder.UseCompatibleStateImageBehavior = False
Me.lstBuilder.View = System.Windows.Forms.View.List
'
'btnRemove
'
@@ -114,11 +122,55 @@ Partial Class frmIncludeExclude
Me.btnAdd.Text = "> >"
Me.btnAdd.UseVisualStyleBackColor = True
'
'grpFileOptions
'
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 = 13
Me.grpFileOptions.TabStop = False
Me.grpFileOptions.Text = "File Options"
'
'optIndividualFiles
'
Me.optIndividualFiles.AutoSize = True
Me.optIndividualFiles.Location = New System.Drawing.Point(85, 19)
Me.optIndividualFiles.Name = "optIndividualFiles"
Me.optIndividualFiles.Size = New System.Drawing.Size(94, 17)
Me.optIndividualFiles.TabIndex = 14
Me.optIndividualFiles.TabStop = True
Me.optIndividualFiles.Text = "Individual Files"
Me.optIndividualFiles.UseVisualStyleBackColor = True
'
'optFileTypes
'
Me.optFileTypes.AutoSize = True
Me.optFileTypes.Location = New System.Drawing.Point(6, 19)
Me.optFileTypes.Name = "optFileTypes"
Me.optFileTypes.Size = New System.Drawing.Size(73, 17)
Me.optFileTypes.TabIndex = 15
Me.optFileTypes.TabStop = True
Me.optFileTypes.Text = "File Types"
Me.optFileTypes.UseVisualStyleBackColor = True
'
'lblItems
'
Me.lblItems.AutoSize = True
Me.lblItems.Location = New System.Drawing.Point(319, 16)
Me.lblItems.Name = "lblItems"
Me.lblItems.Size = New System.Drawing.Size(32, 13)
Me.lblItems.TabIndex = 14
Me.lblItems.Text = "Items"
'
'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.lblItems)
Me.Controls.Add(Me.grpFileOptions)
Me.Controls.Add(Me.btnRemove)
Me.Controls.Add(Me.btnAdd)
Me.Controls.Add(Me.lstBuilder)
@@ -133,14 +185,15 @@ Partial Class frmIncludeExclude
Me.Name = "frmIncludeExclude"
Me.ShowIcon = False
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
Me.Text = "Include Exclude Builder"
Me.Text = "Include / Exclude Builder"
Me.grpFileOptions.ResumeLayout(False)
Me.grpFileOptions.PerformLayout()
Me.ResumeLayout(False)
Me.PerformLayout()
End Sub
Friend WithEvents treFiles As System.Windows.Forms.TreeView
Friend WithEvents imgIcons As System.Windows.Forms.ImageList
Friend WithEvents bwLoader As System.ComponentModel.BackgroundWorker
Friend WithEvents btnSave As System.Windows.Forms.Button
Friend WithEvents btnCancel As System.Windows.Forms.Button
Friend WithEvents txtRootFolder As System.Windows.Forms.TextBox
@@ -148,4 +201,8 @@ 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 optFileTypes As System.Windows.Forms.RadioButton
Friend WithEvents optIndividualFiles As System.Windows.Forms.RadioButton
Friend WithEvents lblItems As System.Windows.Forms.Label
End Class
+15 -14
View File
@@ -124,8 +124,8 @@
<value>
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAAB2
CAAAAk1TRnQBSQFMAgEBAgEAATABAAEwAQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAAB6
CQAAAk1TRnQBSQFMAgEBAwEAAUgBAAFIAQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
AwABQAMAARADAAEBAQABCAYAAQQYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA
AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5
AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA
@@ -153,18 +153,19 @@
AcwBAAH/AZkB/wEAAf8BzAIAAf8BzAEzAQAB/wHMAWYBAAH/AcwBmQEAAf8CzAEAAf8BzAH/AQAC/wEz
AQABzAH/AWYBAAL/AZkBAAL/AcwBAAJmAf8BAAFmAf8BZgEAAWYC/wEAAf8CZgEAAf8BZgH/AQAC/wFm
AQABIQEAAaUBAANfAQADdwEAA4YBAAOWAQADywEAA7IBAAPXAQAD3QEAA+MBAAPqAQAD8QEAA/gBAAHw
AfsB/wEAAaQCoAEAA4ADAAH/AgAB/wMAAv8BAAH/AwAB/wEAAf8BAAL/AgAD/xMACf82AAH0CQcB/yUA
AfIMuwHyAgAB8wm8AfQD/yIAAbsMswEJAgAB8wLyAfEJBwH0IgABCQyzAQkCAAHzAvIB8QnwAfMiAAEJ
DLMBCQIAAfMM8gHzIgABCQy6AQkCAALzC/IB8yIAAfAMugHwAgAD8wryAfMiAAHwDNsB8AIABPMB8gnz
IgABGQzcARkCAATzAfIJ8yIAAfEMCQHxAgAO8yIAAfAH3AW6AfACAAHzAvQH8wHyAe8BvAH0IgABGQG7
BO8BCQH/CAAB9AnzAe8B9wHxIwAB8wHwBBkB8gkAA/8B9AHzBPQBBwG8Af83AAH/BPMC8joABf8mAAFC
AU0BPgcAAT4DAAEoAwABQAMAARADAAEBAQABAQUAAYAXAAP/AQAC/wHAAR8EAAL/AYABDwQAAYABAQGA
AQEEAAGAAQEBgAEBBAABgAEBAYABAQQAAYABAQGAAQEEAAGAAQEBgAEBBAABgAEBAYABAQQAAYABAQGA
AQEEAAGAAQEBgAEBBAABgAEBAYABAQQAAYABAQGAAQEEAAGAAX8BgAEDBAABgAH/AYABBwQAAv8B8AEf
BAAC/wH4AT8EAAs=
AfsB/wEAAaQCoAEAA4ADAAH/AgAB/wMAAv8BAAH/AwAB/wEAAf8BAAL/AgAD/xMACf82AAH0CQcB/wsA
Af8ZAAHyDLsB8gIAAfMJvAH0A/8IAAH/AbMBuwH/FgABuwyzAQkCAAHzAvIB8QkHAfQHAAH/A7MBugH/
FQABCQyzAQkCAAHzAvIB8QnwAfMGAAH/ArQB8QG8AbQBCQH/FAABCQyzAQkCAAHzDPIB8wUAAf8CtALy
AfEBvAG0AbsB/xMAAQkMugEJAgAC8wvyAfMEAAH/AbQBugHzA/IB8QG8AbQBuxMAAfAMugHwAgAD8wry
AfMDAAH/AroD8wPyAfEBugG0EwAB8AzbAfACAATzAfIJ8wIAAf8CugbzAfICugL/EgABGQzcARkCAATz
AfIJ8wIAAfQCugEJBfMCuwH/FAAB8QwJAfECAA7zAgAB9AG6AdsB3AEJA/MBCQG7Af8VAAHwB9wFugHw
AgAB8wL0B/MB8gHvAbwB9AIAAfQB3AHzAf8B3AEJAfICCQH/FgABGQG7BO8BCQH/CAAB9AnzAe8B9wHx
AwAB9AHcARkB8wPcAQkB/xcAAfMB8AQZAfIJAAP/AfQB8wT0AQcBvAH/BAAB9AIJAdwB4QIJAf8rAAH/
BPMC8gYAAf8F9AH/LQAF/yYAAUIBTQE+BwABPgMAASgDAAFAAwABEAMAAQEBAAEBBQABgBcAA/8BAAL/
AcABHwL/AgAC/wGAAQ8B/gH/AgABgAEBAYABAQH+AR8CAAGAAQEBgAEBAfwBDwIAAYABAQGAAQEB+AEH
AgABgAEBAYABAQHwAQMCAAGAAQEBgAEBAeABAwIAAYABAQGAAQEBwAEDAgABgAEBAYABAQGAAQECAAGA
AQEBgAEBAYABBwIAAYABAQGAAQEBgAEPAgABgAEBAYABAQGAAR8CAAGAAX8BgAEDAYABPwIAAYAB/wGA
AQcBgAF/AgAC/wHwAR8BgAH/AgAC/wH4AT8C/wIACw==
</value>
</data>
<metadata name="bwLoader.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>118, 17</value>
</metadata>
</root>
+162 -20
View File
@@ -3,7 +3,17 @@
Public Class frmIncludeExclude
Dim sFormName As String = "Include Exclude"
Dim sRootFolder As String = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)
Dim sRootFolder As String = String.Empty
Dim sBuilderString As String
Public Property BuilderString As String
Get
Return sBuilderString
End Get
Set(value As String)
sBuilderString = value
End Set
End Property
Public Property FormName As String
Get
@@ -19,51 +29,79 @@ Public Class frmIncludeExclude
Return sRootFolder
End Get
Set(value As String)
sRootFolder = value
sRootFolder = value.TrimEnd("\")
End Set
End Property
Private Sub BuildTreeNodes(ByVal sDirectory As String, ByVal oNode As TreeNode)
Private Sub BuildBranch(ByVal sDirectory As String, ByVal oNode As TreeNode, ByVal bIsDriveRoot As Boolean)
Dim sFolders As String()
Dim sFiles As String()
Dim oChild As TreeNode
Dim oPlaceHolder As TreeNode
Try
Cursor.Current = Cursors.WaitCursor
treFiles.BeginUpdate()
oNode.Nodes.RemoveByKey("GBM_Tree_Placeholder")
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), 0, 0)
oChild.Name = sFolder
If bIsDriveRoot Then
oChild = New TreeNode(sFolder.Replace(sDirectory, String.Empty), 0, 0)
Else
oChild = New TreeNode(sFolder.Replace(sDirectory & "\", String.Empty), 0, 0)
End If
oChild.Name = sFolder
oChild.Tag = 0
oNode.Nodes.Add(oChild)
BuildTreeNodes(sFolder, 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), 1, 1)
If bIsDriveRoot Then
oChild = New TreeNode(sFile.Replace(sDirectory, String.Empty), 1, 1)
Else
oChild = New TreeNode(sFile.Replace(sDirectory & "\", String.Empty), 1, 1)
End If
oChild.Tag = 1
oNode.Nodes.Add(oChild)
Next
End If
Catch uaex As UnauthorizedAccessException
'Do Nothing
Catch ex As Exception
MsgBox("An unexcepted 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 Sub
Private Sub BuildTree()
Cursor.Current = Cursors.WaitCursor
treFiles.BeginUpdate()
Private Sub BuildTrunk()
treFiles.Nodes.Clear()
Dim oRootNode As TreeNode
oRootNode = New TreeNode(Path.GetFileName(txtRootFolder.Text), 0, 0)
Dim bIsDriveRoot As Boolean
If Path.GetPathRoot(txtRootFolder.Text) = txtRootFolder.Text Then
oRootNode = New TreeNode(txtRootFolder.Text, 0, 0)
bIsDriveRoot = True
Else
oRootNode = New TreeNode(Path.GetFileName(txtRootFolder.Text), 0, 0)
bIsDriveRoot = False
End If
oRootNode.Name = "Root"
treFiles.Nodes.Add(oRootNode)
BuildTreeNodes(txtRootFolder.Text, oRootNode)
treFiles.EndUpdate()
Cursor.Current = Cursors.Default
BuildBranch(txtRootFolder.Text, oRootNode, bIsDriveRoot)
End Sub
Private Sub RootPathBrowse()
@@ -77,30 +115,121 @@ Public Class frmIncludeExclude
End If
End If
sNewPath = mgrCommon.OpenFolderBrowser("Choose the location of the save folder:", sDefaultFolder, False)
sNewPath = mgrCommon.OpenFolderBrowser("Choose the location of the saved game folder:", sDefaultFolder, False)
If sNewPath <> String.Empty Then txtRootFolder.Text = sNewPath
End Sub
Private Sub GetAllCheckedNodes(ByVal oRootNode As TreeNodeCollection, ByRef oNodeList As List(Of TreeNode))
For Each oNode As TreeNode In oRootNode
If oNode.Checked Then
oNode.Checked = False
oNodeList.Add(oNode)
End If
If oNode.Nodes.Count > 0 Then
GetAllCheckedNodes(oNode.Nodes, oNodeList)
End If
Next
End Sub
Private Sub AddItem()
Dim oCheckedNodes As New List(Of TreeNode)
Dim oListViewItem As ListViewItem
Dim sItem As String
GetAllCheckedNodes(treFiles.Nodes, oCheckedNodes)
lstBuilder.BeginUpdate()
For Each oNode In oCheckedNodes
sItem = oNode.Text
If oNode.Tag = 1 And optFileTypes.Checked Then
sItem = Path.GetExtension(oNode.Text)
If sItem <> String.Empty Then
sItem = "*" & sItem
oListViewItem = New ListViewItem(sItem, 2)
oListViewItem.Name = sItem
Else
sItem = oNode.Text
oListViewItem = New ListViewItem(sItem, 1)
oListViewItem.Name = sItem
End If
Else
oListViewItem = New ListViewItem(sItem, CInt(oNode.Tag))
oListViewItem.Name = sItem
End If
If Not lstBuilder.Items.ContainsKey(sItem) Then
lstBuilder.Items.Add(oListViewItem)
End If
Next
lstBuilder.EndUpdate()
End Sub
Private Sub RemoveItem()
For Each oListViewItem As ListViewItem In lstBuilder.SelectedItems
oListViewItem.Remove()
Next
End Sub
Private Sub ParseBuilderString()
Dim iType As Integer = 1
Dim oListViewItem As ListViewItem
Dim sItems As String() = BuilderString.Split(":")
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.Name = sItem
lstBuilder.Items.Add(oListViewItem)
Next
End Sub
Private Sub CreateNewBuilderString()
Dim sTempString As String = String.Empty
For Each oListViewItem As ListViewItem In lstBuilder.Items
sTempString &= oListViewItem.Text & ":"
Next
sTempString = sTempString.TrimEnd(":")
BuilderString = sTempString
End Sub
Private Sub frmIncludeExclude_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Me.Text = FormName
Me.Text = FormName & " Builder"
txtRootFolder.Text = RootFolder
BuildTree()
optFileTypes.Checked = True
lblItems.Text = FormName & " Items"
If BuilderString <> String.Empty Then ParseBuilderString()
If txtRootFolder.Text <> String.Empty Then BuildTrunk()
End Sub
Private Sub frmIncludeExclude_Shown(sender As Object, e As EventArgs) Handles MyBase.Shown
treFiles.Select()
treFiles.SelectedNode.Expand()
If Not treFiles.SelectedNode Is Nothing Then treFiles.SelectedNode.Expand()
End Sub
Private Sub btnBrowse_Click(sender As Object, e As EventArgs) Handles btnBrowse.Click
RootPathBrowse()
BuildTree()
If txtRootFolder.Text <> String.Empty Then BuildTrunk()
treFiles.Select()
treFiles.SelectedNode.Expand()
If Not treFiles.SelectedNode Is Nothing Then treFiles.SelectedNode.Expand()
End Sub
Private Sub btnSave_Click(sender As Object, e As EventArgs) Handles btnSave.Click
CreateNewBuilderString()
Me.Close()
End Sub
@@ -108,4 +237,17 @@ Public Class frmIncludeExclude
Me.Close()
End Sub
Private Sub treFiles_BeforeExpand(sender As Object, e As TreeViewCancelEventArgs) Handles treFiles.BeforeExpand
If Not e.Node.Name = "Root" Then
BuildBranch(e.Node.Name, e.Node, False)
End If
End Sub
Private Sub btnAdd_Click(sender As Object, e As EventArgs) Handles btnAdd.Click
AddItem()
End Sub
Private Sub btnRemove_Click(sender As Object, e As EventArgs) Handles btnRemove.Click
RemoveItem()
End Sub
End Class
+2 -2
View File
@@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
' by using the '*' as shown below:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("0.94.*")>
<Assembly: AssemblyFileVersion("0.94.0.0")>
<Assembly: AssemblyVersion("0.95.*")>
<Assembly: AssemblyFileVersion("0.95.0.0")>