Skip to content
Permalink
Browse files

Made the categories configurable and added space for comments.

  • Loading branch information...
IAmCoder committed Dec 18, 2014
1 parent ec830cb commit 0eb5cce6da15832c6d653307d9730cbffb607a96
@@ -6,7 +6,6 @@ Public Class CategoriesListControl

Private m_strPath As String = DataDirectory.GetFolderPath() + "\Lightened Dream\"
Private m_strFileName As String
Public Categories As String

Public Event CategorySelected(ByVal Category As String)

@@ -18,18 +17,19 @@ Public Class CategoriesListControl
objSeries.Points.Clear()
objSeries("PieDrawingStyle") = "SoftEdge"
lstCategories.Items.Clear()
For Each strCategory As String In Categories.Split(",")
Dim intCount As Integer = Directory.GetFiles(m_strPath + "Categories\" + strCategory, "*.ld3").Length

Dim lstItem As New ListViewItem(strCategory)
lstItem.SubItems.Add(intCount)
lstCategories.Items.Add(lstItem)
For Each categoryPath As String In Directory.GetDirectories(m_strPath + "Categories")
Dim intCount As Integer = Directory.GetFiles(categoryPath, "*.ld3", SearchOption.AllDirectories).Length

If intCount > 0 Then
Dim intPoint As Integer = objSeries.Points.AddY(intCount)
objSeries.Points(intPoint).Label = strCategory
End If
Next
Dim lstItem As New ListViewItem(New FileInfo(categoryPath).Name)
lstItem.SubItems.Add(intCount)
lstCategories.Items.Add(lstItem)

If intCount > 0 Then
Dim intPoint As Integer = objSeries.Points.AddY(intCount)
objSeries.Points(intPoint).Label = New FileInfo(categoryPath).Name
End If
Next

Catch ex As Exception
MessageBox.Show(ex.Message, "LightenedDream.Categories.LoadCategory()", MessageBoxButtons.OK, MessageBoxIcon.Error)

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -7,6 +7,7 @@ Public Class CategoryListControl
Private m_strPath As String = DataDirectory.GetFolderPath() + "\Lightened Dream\"
Private m_strFileName As String
Public Category As String
Public CategoryFile As String

Public Event CategorySelected(ByVal Entry As String)

@@ -18,21 +19,15 @@ Public Class CategoryListControl
txtName.Visible = True
txtName.Text = Category

For Each strCategory As String In "Characters,Locations,Objects,Actions,Themes,Emotions".Split(",")
If Category.ToLower = strCategory.ToLower Then
lblT.Visible = False
txtName.Visible = False
Exit For
End If
Next

Dim objSeries As Series = graph.Series("DreamSeries")
objSeries.Points.Clear()
objSeries("PieDrawingStyle") = "SoftEdge"
lstCategories.Items.Clear()
lblTitle.Text = "Categories - " + Category

For Each strCatgeoryFile As String In Directory.GetFiles(m_strPath + "Categories\" + Category, "*.ld3")
Dim hasData As Boolean = False

For Each strCatgeoryFile As String In Directory.GetFiles(CategoryFile, "*.ld3")
Dim xmlDoc As New Xml.XmlDocument
xmlDoc.Load(strCatgeoryFile)

@@ -44,17 +39,23 @@ Public Class CategoryListControl

If intCount > 0 Then
Dim intPoint As Integer = objSeries.Points.AddY(intCount)
objSeries.Points(intPoint).Label = lstItem.Text
objSeries.Points(intPoint).Label = lstItem.Text
hasData = True
End If
Next
Next

graph.Visible = hasData

Catch ex As Exception
MessageBox.Show(ex.Message, "LightenedDream.Categories.LoadCategory()", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End Sub

Public Sub Save()
If txtName.Text <> Category Then
Directory.Move(m_strPath & "Categories\" & Category, m_strPath & "Categories\" & txtName.Text)
Directory.Move(CategoryFile, New DirectoryInfo(CategoryFile).Parent.FullName + "\" & txtName.Text)
CategoryFile = New DirectoryInfo(CategoryFile).Parent.FullName + "\" & txtName.Text
Category = txtName.Text
End If
End Sub

@@ -12,7 +12,7 @@ Imports System.Runtime.InteropServices
<Assembly: AssemblyDescription("")>
<Assembly: AssemblyCompany("lucidcode")>
<Assembly: AssemblyProduct("Categories")>
<Assembly: AssemblyCopyright("Copyright © lucidcode 2013")>
<Assembly: AssemblyCopyright("Copyright © lucidcode 2013 - 2014")>
<Assembly: AssemblyTrademark("")>

<Assembly: ComVisible(False)>
@@ -30,5 +30,5 @@ Imports System.Runtime.InteropServices
' You can specify all the values or you can default the Build and Revision Numbers
' by using the '*' as shown below:

<Assembly: AssemblyVersion("3.2.9")>
<Assembly: AssemblyFileVersion("3.2.9.0")>
<Assembly: AssemblyVersion("3.3.3")>
<Assembly: AssemblyFileVersion("3.3.3.0")>
@@ -38,7 +38,7 @@ Public Class ViewControl
xmlDoc.Load(FileName)
m_strCategory = Category
lblType.Text = m_strCategory
lblTitle.Text = "Categories - " + Category + "s - " + xmlDoc.DocumentElement.SelectSingleNode("Name").InnerText
lblTitle.Text = "Categories - " + Category + " - " + xmlDoc.DocumentElement.SelectSingleNode("Name").InnerText
txtName.Text = xmlDoc.DocumentElement.SelectSingleNode("Name").InnerText
txtDescription.Text = xmlDoc.DocumentElement.SelectSingleNode("Description").InnerText
lblTitle.Tag = xmlDoc.DocumentElement.SelectSingleNode("Name").InnerText
@@ -124,15 +124,15 @@ Public Class ViewControl
Public Sub Save()
Changed = False
If txtName.Text <> lblTitle.Tag Then
Dim newFileName = m_strPath + "Categories\" + m_strCategory + "s\" + txtName.Text + ".ld3"
Dim newFileName = New FileInfo(FileName).Directory.FullName + "\" + txtName.Text + ".ld3"
File.Move(FileName, newFileName)
FileName = m_strPath + "Categories\" + m_strCategory + "s\" + txtName.Text + ".ld3"
FileName = newFileName
End If

Dim objWorkerClass As New WorkerClass()
objWorkerClass.Name = txtName.Text.ToLower
objWorkerClass.Name = txtName.Text
objWorkerClass.Description = txtDescription.Text
objWorkerClass.Keywords = txtKeywords.Text.ToLower
objWorkerClass.Keywords = txtKeywords.Text
objWorkerClass.FileName = FileName
AddHandler objWorkerClass.RandomWord, AddressOf RandomWordLocal

@@ -183,10 +183,10 @@ Public Class ViewControl

Dim strNamesXml = ""
Dim arrKeywords As New List(Of String)
arrKeywords.Add(Name)
arrKeywords.Add(Name.ToLower)
For Each strKeyWord As String In Keywords.Split(", ")
If strKeyWord <> "" Then
arrKeywords.Add(strKeyWord)
arrKeywords.Add(strKeyWord.ToLower)
strXml += "<Name>" + strKeyWord.TrimStart(" ") + "</Name>"
End If
Next
@@ -332,7 +332,7 @@ Public Class ViewControl
End Sub

Private Sub txtName_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtName.TextChanged
lblTitle.Text = "Categories - " + m_strCategory + "s - " + txtName.Text
lblTitle.Text = "Categories - " + m_strCategory + " - " + txtName.Text
Changed = True
End Sub

@@ -13,7 +13,6 @@ Public Class CompareDreamsControl
Public OnlyCategories As Boolean = False

Private m_strPath As String = DataDirectory.GetFolderPath() + "\Lightened Dream\"
Private m_strCategories As String = "Characters,Locations,Objects,Actions,Themes,Emotions"
Private m_boolSearching As Boolean = False

Private m_arrDreams As New List(Of Dream)
@@ -106,12 +105,10 @@ Public Class CompareDreamsControl
m_arrIgnore.Add(xmlNode.InnerText.ToLower)
Next

For Each strCategory As String In m_strCategories.Split(",")
For Each strCatgeoryFile As String In Directory.GetFiles(m_strPath + "Categories\" + strCategory, "*.ld3")
Dim strName As String = New FileInfo(strCatgeoryFile).Name.Replace(".ld3", "")
m_arrCategories.Add(strName.ToLower)
Next
Next
' Load each Category
For Each strCategory As String In Directory.GetDirectories(m_strPath + "Categories")
LoadCategoryFolder(strCategory)
Next

Dim arrDreamFiles As String() = Directory.GetFiles(m_strPath & "Dreams\", "*.ld3", SearchOption.AllDirectories)
For Each strDreamFile As String In arrDreamFiles
@@ -139,6 +136,24 @@ Public Class CompareDreamsControl

End Sub

Private Sub LoadCategoryFolder(ByVal categoryPath As String)
For Each strCatgeoryFile As String In Directory.GetFiles(categoryPath, "*.ld3")
Dim strName As String = New FileInfo(strCatgeoryFile).Name.Replace(".ld3", "")

m_arrCategories.Add(strName.ToLower)

Dim xmlDocCategory As New XmlDocument
xmlDocCategory.Load(strCatgeoryFile)
For Each xmlWord As XmlNode In xmlDocCategory.DocumentElement.SelectNodes("Names/Name")
m_arrCategories.Add(xmlWord.InnerText.ToLower)
Next
Next

For Each subCategory As String In Directory.GetDirectories(categoryPath)
LoadCategoryFolder(subCategory)
Next
End Sub

Private Sub tmrDreamSigns_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tmrDreamSigns.Tick
tmrDreamSigns.Enabled = False

Oops, something went wrong.

0 comments on commit 0eb5cce

Please sign in to comment.
You can’t perform that action at this time.