diff --git a/Builder/IISMainHandler/build.txt b/Builder/IISMainHandler/build.txt index 6efca19..755ab3c 100644 --- a/Builder/IISMainHandler/build.txt +++ b/Builder/IISMainHandler/build.txt @@ -1 +1 @@ -481 \ No newline at end of file +495 \ No newline at end of file diff --git a/Builder/IISMainHandler/product.wxs b/Builder/IISMainHandler/product.wxs index f7cfb3d..4bdd16b 100644 --- a/Builder/IISMainHandler/product.wxs +++ b/Builder/IISMainHandler/product.wxs @@ -64,6 +64,12 @@ + + + + + + + \ No newline at end of file diff --git a/ThirdParty/BBCode/BBCodeConfiguration.xsd b/ThirdParty/BBCode/BBCodeConfiguration.xsd new file mode 100644 index 0000000..daa6616 --- /dev/null +++ b/ThirdParty/BBCode/BBCodeConfiguration.xsd @@ -0,0 +1,86 @@ + + + + + + BBCode Configuration Schema + Copyright (c) 2009 - PJ on Development. + + + + + + + + + This type is the root of the configuration file. + + + + + + + + + + + + + + + + + + + + + + + + + + + + Describes the list of known BBCode element that requires an specific type. + + + + + + + + + + The type must be assignable to a BBCodeElement. + + + + + + + + + + + + Describes the known BBCode elements. + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ThirdParty/BBCode/Classes/BBCodeAttributeCollection.vb b/ThirdParty/BBCode/Classes/BBCodeAttributeCollection.vb new file mode 100644 index 0000000..cf2d765 --- /dev/null +++ b/ThirdParty/BBCode/Classes/BBCodeAttributeCollection.vb @@ -0,0 +1,183 @@ +'************************************************** +' FILE : BBCodeAttributeDictionary.vb +' AUTHOR : Paulo Santos +' CREATION : 4/29/2009 11:39:24 AM +' COPYRIGHT : Copyright © 2009 +' PJ on Development +' All Rights Reserved. +' +' Description: +' TODO: Add file description +' +' Change log: +' 0.1 4/29/2009 11:39:24 AM +' Paulo Santos +' Created. +'*************************************************** + +''' +''' Represents a collection of Attributes. +''' +Public Class BBCodeAttributeDictionary + Implements IDictionary(Of String, String) + + Dim __dic As IDictionary(Of String, String) + + ''' Initializes an instance of the class. + ''' This is the default constructor for this class. + Public Sub New() + __dic = New Dictionary(Of String, String) + End Sub + + ''' + ''' Removes all items from the . + ''' + Public Sub Clear() Implements System.Collections.Generic.ICollection(Of System.Collections.Generic.KeyValuePair(Of String, String)).Clear + __dic.Clear() + End Sub + + ''' + ''' Copies the elements of the to an System.Array, starting at a particular System.Array index. + ''' + ''' The one-dimensional System.Array that is the destination of the elements copied from . The System.Array must have zero-based indexing. + ''' The zero-based index in array at which copying begins. + ''' + Private Sub CopyTo(ByVal array() As System.Collections.Generic.KeyValuePair(Of String, String), ByVal arrayIndex As Integer) Implements System.Collections.Generic.ICollection(Of System.Collections.Generic.KeyValuePair(Of String, String)).CopyTo + __dic.CopyTo(array, arrayIndex) + End Sub + + ''' + ''' Gets the number of elements contained in the . + ''' + ''' The number of elements contained in the . + Public ReadOnly Property Count() As Integer Implements System.Collections.Generic.ICollection(Of System.Collections.Generic.KeyValuePair(Of String, String)).Count + Get + Return __dic.Count + End Get + End Property + + ''' + ''' Gets a value indicating whether the is read-only. + ''' + ''' true if the is read-only; otherwise, false. + Public ReadOnly Property IsReadOnly() As Boolean Implements System.Collections.Generic.ICollection(Of System.Collections.Generic.KeyValuePair(Of String, String)).IsReadOnly + Get + Return __dic.IsReadOnly + End Get + End Property + + ''' + ''' Adds an element with the provided key and value to the . + ''' + ''' The object to use as the key of the element to add. + ''' The object to use as the value of the element to add. + Public Sub Add(ByVal key As String, ByVal value As String) Implements System.Collections.Generic.IDictionary(Of String, String).Add + __dic.Add(key.ToUpperInvariant(), value) + End Sub + + ''' + ''' Determines whether the contains an element with the specified key. + ''' + ''' The key to locate in the . + ''' True if the contains an element with the key; otherwise, False. + ''' + Public Function ContainsKey(ByVal key As String) As Boolean Implements System.Collections.Generic.IDictionary(Of String, String).ContainsKey + Return __dic.ContainsKey(key.ToUpperInvariant()) + End Function + + ''' + ''' Gets or sets the element with the specified key. + ''' + ''' The key of the element to get or set. + ''' The element with the specified key. + Default Public Property Item(ByVal key As String) As String Implements System.Collections.Generic.IDictionary(Of String, String).Item + Get + Return __dic.Item(key.ToUpperInvariant()) + End Get + Set(ByVal value As String) + __dic.Item(key.ToUpperInvariant()) = value + End Set + End Property + + ''' + ''' Gets an containing the keys of the . + ''' + ''' An containing the keys of the object that implements . + Public ReadOnly Property Keys() As System.Collections.Generic.ICollection(Of String) Implements System.Collections.Generic.IDictionary(Of String, String).Keys + Get + Return __dic.Keys + End Get + End Property + + ''' + ''' Removes the element with the specified key from the . + ''' + ''' The key of the element to remove. + ''' True if the element is successfully removed; otherwise, False. This method also returns False if key was not found in the original . + ''' + Public Function Remove(ByVal key As String) As Boolean Implements System.Collections.Generic.IDictionary(Of String, String).Remove + Return __dic.Remove(key) + End Function + + ''' + ''' Gets the value associated with the specified key. + ''' + ''' The key whose value to get. + ''' When this method returns, the value associated with the specified key, if the key is found; otherwise, the default value for the type of the value parameter. This parameter is passed uninitialized. + ''' True if the object that implements contains an element with the specified key; otherwise, False. + ''' + Public Function TryGetValue(ByVal key As String, ByRef value As String) As Boolean Implements System.Collections.Generic.IDictionary(Of String, String).TryGetValue + Return __dic.TryGetValue(key, value) + End Function + + ''' + ''' Gets an containing the values in the . + ''' + ''' An containing the values in the object that implements . + Public ReadOnly Property Values() As System.Collections.Generic.ICollection(Of String) Implements System.Collections.Generic.IDictionary(Of String, String).Values + Get + Return __dic.Values + End Get + End Property + + ''' + ''' Returns an enumerator that iterates through the collection. + ''' + ''' A System.Collections.Generic.IEnumerator(Of T) that can be used to iterate through the collection. + Public Function GetEnumerator() As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, String)) Implements System.Collections.Generic.IEnumerable(Of System.Collections.Generic.KeyValuePair(Of String, String)).GetEnumerator + Return __dic.GetEnumerator() + End Function + + ''' + ''' Adds an item to the . + ''' + ''' The attribute to be added. + Private Sub Add(ByVal item As System.Collections.Generic.KeyValuePair(Of String, String)) Implements System.Collections.Generic.ICollection(Of System.Collections.Generic.KeyValuePair(Of String, String)).Add + __dic.Add(item.Key.ToUpperInvariant(), item.Value) + End Sub + + ''' + ''' Removes the first occurrence of a specific object from the . + ''' + ''' The object to remove from the . + ''' True if item was successfully removed from the ; otherwise, False. This method also returns False if item is not found in the original . + ''' + Private Function Remove(ByVal item As System.Collections.Generic.KeyValuePair(Of String, String)) As Boolean Implements System.Collections.Generic.ICollection(Of System.Collections.Generic.KeyValuePair(Of String, String)).Remove + Return __dic.Remove(item) + End Function + + ''' + ''' Determines whether the contains a specific value. + ''' + ''' The object to locate in the . + ''' True if item is found in the ; otherwise, False. + ''' + Private Function Contains(ByVal item As System.Collections.Generic.KeyValuePair(Of String, String)) As Boolean Implements System.Collections.Generic.ICollection(Of System.Collections.Generic.KeyValuePair(Of String, String)).Contains + Return __dic.Contains(item) + End Function + + Private Function IEnumerableGetEnumerator() As System.Collections.IEnumerator Implements System.Collections.IEnumerable.GetEnumerator + Return __dic.GetEnumerator() + End Function + +End Class diff --git a/ThirdParty/BBCode/Classes/BBCodeConfiguration.vb b/ThirdParty/BBCode/Classes/BBCodeConfiguration.vb new file mode 100644 index 0000000..28ca5c0 --- /dev/null +++ b/ThirdParty/BBCode/Classes/BBCodeConfiguration.vb @@ -0,0 +1,148 @@ +'************************************************** +' FILE : BBCodeConfiguration.vb +' AUTHOR : Paulo Santos +' CREATION : 4/30/2009 10:57:20 PM +' COPYRIGHT : Copyright © 2009 +' PJ on Development +' All Rights Reserved. +' +' Description: +' TODO: Add file description +' +' Change log: +' 0.1 4/30/2009 10:57:20 PM +' Paulo Santos +' Created. +'*************************************************** + +Imports System.Xml.Serialization + +''' +''' Represents the configuration of the . +''' + _ + _ +Public NotInheritable Class BBCodeConfiguration + Implements IXmlSerializable + + Private Shared ReadOnly __CurrentVersion As New System.Version(1, 0) + + Private __Version As System.Version + Private __Dictionary As BBCodeElementDictionary + Private __ElementTypes As BBCodeElementTypeDictionary + + ''' Initializes an instance of the class. + ''' This is the default constructor for this class. + Friend Sub New() + __Version = New Version(1, 0) + End Sub + + ''' + ''' Gets the version of the configuration file. + ''' + Public Property Version() As System.Version + Get + Return __Version + End Get + Private Set(ByVal value As System.Version) + If (value > __CurrentVersion) Then + Throw New ArgumentException("Unrecognized version.") + End If + __Version = value + End Set + End Property + + ''' + ''' Gets the dictionary configuration. + ''' + _ + Public ReadOnly Property Dictionary() As BBCodeElementDictionary + Get + If (__Dictionary Is Nothing) Then + __Dictionary = New BBCodeElementDictionary() + End If + Return __Dictionary + End Get + End Property + + ''' + ''' Gets the factory configuration. + ''' + _ + Public ReadOnly Property ElementTypes() As BBCodeElementTypeDictionary + Get + If (__ElementTypes Is Nothing) Then + __ElementTypes = New BBCodeElementTypeDictionary() + End If + Return __ElementTypes + End Get + End Property + + ''' This method is reserved and should not be used. When implementing the IXmlSerializable interface, you should return null (Nothing in Visual Basic) from this method, and instead, if specifying a custom schema is required, apply the to the class. + ''' An that describes the XML representation of the object that is produced by the method and consumed by the method. + Public Function GetSchema() As System.Xml.Schema.XmlSchema Implements System.Xml.Serialization.IXmlSerializable.GetSchema + Return Nothing + End Function + + ''' Generates an object from its XML representation. + ''' The stream from which the object is deserialized. + Public Sub ReadXml(ByVal reader As System.Xml.XmlReader) Implements System.Xml.Serialization.IXmlSerializable.ReadXml + + '* + '* Check the name of the element + '* + If (reader.NamespaceURI <> STR_BBCodeSchemaNamespace) OrElse (reader.LocalName <> STR_BBCodeConfigurationXmlElement) Then + Exit Sub + End If + + '* + '* Gets the version of the configuration + '* + Dim versionString = reader.GetAttribute("version") + If (Not String.IsNullOrEmpty(versionString)) Then + Me.Version = New System.Version(versionString) + End If + + '* + '* Move to the first item + '* + reader.Read() + + Dim dictionarySerializer = New XmlSerializer(GetType(BBCodeElementDictionary)) + Dim typesSerializer = New XmlSerializer(GetType(BBCodeElementTypeDictionary)) + + __ElementTypes = Nothing + __Dictionary = Nothing + + If (reader.LocalName = STR_BBCodeElementTypesXmlElement AndAlso reader.NamespaceURI = STR_BBCodeSchemaNamespace) Then + __ElementTypes = typesSerializer.Deserialize(reader) + End If + + If (reader.LocalName = STR_BBCodeDictionaryXmlElement AndAlso reader.NamespaceURI = STR_BBCodeSchemaNamespace) Then + __Dictionary = dictionarySerializer.Deserialize(reader) + End If + + If (__ElementTypes Is Nothing AndAlso reader.LocalName = STR_BBCodeElementTypesXmlElement AndAlso reader.NamespaceURI = STR_BBCodeSchemaNamespace) Then + __ElementTypes = typesSerializer.Deserialize(reader) + End If + + End Sub + + ''' Converts an object into its XML representation. + ''' The stream to which the object is serialized. + Public Sub WriteXml(ByVal writer As System.Xml.XmlWriter) Implements System.Xml.Serialization.IXmlSerializable.WriteXml + + Dim dictionarySerializer = New XmlSerializer(GetType(BBCodeElementDictionary)) + Dim typesSerializer = New XmlSerializer(GetType(BBCodeElementTypeDictionary)) + + If (ElementTypes.Count > 0) Then + typesSerializer.Serialize(writer, ElementTypes) + End If + + If (Dictionary.Count > 0) Then + dictionarySerializer.Serialize(writer, Dictionary) + End If + + End Sub + +End Class diff --git a/ThirdParty/BBCode/Classes/BBCodeDocument.vb b/ThirdParty/BBCode/Classes/BBCodeDocument.vb new file mode 100644 index 0000000..7b2cf31 --- /dev/null +++ b/ThirdParty/BBCode/Classes/BBCodeDocument.vb @@ -0,0 +1,94 @@ +'************************************************** +' FILE : BBCodeDocument.vb +' AUTHOR : Paulo Santos +' CREATION : 4/29/2009 10:21:41 PM +' COPYRIGHT : Copyright © 2009 +' PJ on Development +' All Rights Reserved. +' +' Description: +' TODO: Add file description +' +' Change log: +' 0.1 4/29/2009 10:21:41 PM +' Paulo Santos +' Created. +'*************************************************** + +''' +''' Represents a document writen in BBCode. +''' +Public NotInheritable Class BBCodeDocument + + Private __Text As String + Private __Parser As BBCodeParser + Private __Nodes As BBCodeNodeCollection + + ''' Initializes an instance of the class. + ''' The that created this instance. + Friend Sub New(ByVal parser As BBCodeParser) + __Parser = parser + End Sub + + ''' + ''' Gets the that is responsible for this . + ''' + Friend ReadOnly Property Parser() As BBCodeParser + Get + Return __Parser + End Get + End Property + + ''' + ''' Gets or sets the BBCode of the document. + ''' + Public Property Text() As String + Get + Return __Text + End Get + Set(ByVal value As String) + __Text = value + Nodes.Clear() + Nodes.AddRange(Me.Parser.Parse(value).Nodes) + End Set + End Property + + ''' + ''' Gets the generated ba the BBCode text. + ''' + ''' A that represents the parsed text of the document. + Public ReadOnly Property Nodes() As BBCodeNodeCollection + Get + If (__Nodes Is Nothing) Then + __Nodes = New BBCodeNodeCollection() + End If + Return __Nodes + End Get + End Property + + ''' + ''' Returns the formatted text. + ''' + ''' The formatted text. + Public Function Format() As String + Return Format(New BBCodeHtmlFormatter()) + End Function + + ''' + ''' Returns the formatted text, using the specified . + ''' + ''' An object that implements the interface. + ''' The formatted text. + Public Function Format(ByVal formatter As ITextFormatter) As String + Dim sb As New Text.StringBuilder() + For Each n In Nodes + sb.Append(n.Format(formatter)) + Next + Return sb.ToString() + End Function + + Friend Sub SetText(ByVal text As String) + __Text = text + End Sub + +End Class diff --git a/ThirdParty/BBCode/Classes/BBCodeElement.vb b/ThirdParty/BBCode/Classes/BBCodeElement.vb new file mode 100644 index 0000000..e5f5d7b --- /dev/null +++ b/ThirdParty/BBCode/Classes/BBCodeElement.vb @@ -0,0 +1,259 @@ +'************************************************** +' FILE : BBCodeElement.vb +' AUTHOR : Paulo Santos +' CREATION : 4/29/2009 11:33:36 AM +' COPYRIGHT : Copyright © 2009 +' PJ on Development +' All Rights Reserved. +' +' Description: +' TODO: Add file description +' +' Change log: +' 0.1 4/29/2009 11:33:36 AM +' Paulo Santos +' Created. +'*************************************************** + +Imports System.Globalization +Imports System.Text.RegularExpressions + +''' +''' Represents an BBCode element. +''' +Public Class BBCodeElement + Inherits BBCodeNode + + Private __Name As String + Private __Nodes As BBCodeNodeCollection + Private __Attributes As BBCodeAttributeDictionary + Private __ReplacementFormat As String = String.Empty + Private __RequireClosingTag As TriState = TriState.UseDefault + Private __IsValueFormatted As Boolean + + Private Shared ReadOnly __RxAttribute As New Regex("\{(?[_a-zA-Z0-9].*?)\}") + + ''' Initializes an instance of the class. + ''' This is the default constructor for this class. + Friend Sub New() + End Sub + + ''' Initializes an instance of the class. + ''' The name of the element. + Protected Sub New(ByVal name As String) + __Name = name.ToUpperInvariant() + End Sub + + ''' Initializes an instance of the class. + ''' The parser used to create this element. + Friend Sub New(ByVal parser As BBCodeParser) + MyBase.New(parser) + End Sub + + ''' + ''' Gets the name of the element. + ''' + Public ReadOnly Property Name() As String + Get + Return __Name + End Get + End Property + + ''' + ''' Gets the replacement format for this element. + ''' + ''' The replacement format. + ''' + ''' In order to use the any parameter in the replacement format use the following syntax: {paramName}. + ''' + ''' The parameter names are case insensitive. + ''' + ''' There are two reserved parameter keywords for formatting: DEFAULT and VALUE. + ''' DEFAULT : The text following the first equal sign after the name of the BBCode element. + ''' VALUE: The HTML generated by the BBCode between the start and end element tag. + ''' [url=http://tempuri.org]text[/url] + ''' In the example above the parameter DEFAULT would have the value "http://tempuri.org", while VALUE would be "text". + ''' + ''' To replace [url=http://tempuri.org]text[/url] the with <a href="http://tempuri.org">text</a> the following ReplacementFormat should be used: + ''' + ''' <a href="{default|value}">{value|default}</a> + ''' + ''' The example above, will set the href attribute with either the default value or the text inside the [url] element. The pipe (|) implies in finding the first non-empty attribute. + ''' + Public ReadOnly Property ReplacementFormat() As String + Get + If (String.IsNullOrEmpty(__ReplacementFormat)) Then + If (Me.Parser.Dictionary.ContainsKey(Me.Name)) Then + __ReplacementFormat = Me.Parser.Dictionary(Me.Name).ReplacementFormat + End If + End If + Return __ReplacementFormat + End Get + End Property + + ''' + ''' Gets a value indicating if the element requires a closing tag. + ''' + ''' True if the element requires a closing tag; otherwise False. + Public ReadOnly Property RequireClosingTag() As Boolean + Get + If (__RequireClosingTag = TriState.UseDefault) Then + If (Not String.IsNullOrEmpty(Me.Name) AndAlso Me.Parser.Dictionary.ContainsKey(Me.Name)) Then + __RequireClosingTag = If(Me.Parser.Dictionary(Me.Name).RequireClosingTag, TriState.True, TriState.False) + End If + End If + Return (__RequireClosingTag = TriState.True) + End Get + End Property + + ''' + ''' Gets the list of attributes. + ''' + Public ReadOnly Property Attributes() As BBCodeAttributeDictionary + Get + If (__Attributes Is Nothing) Then + __Attributes = New BBCodeAttributeDictionary + End If + Return __Attributes + End Get + End Property + + ''' + ''' Gets the list of sub nodes. + ''' + Public ReadOnly Property Nodes() As BBCodeNodeCollection + Get + If (__Nodes Is Nothing) Then + __Nodes = New BBCodeNodeCollection(Me) + End If + Return __Nodes + End Get + End Property + + ''' Transforms this instance of into its desired text representation. + ''' An object that implements the interface. + ''' The text formatted by the . + Public Overrides Function Format(ByVal formatter As ITextFormatter) As String + IsValueFormatted = False + Dim sb As New Text.StringBuilder(Me.ReplacementFormat) + Dim attribs = __RxAttribute.Matches(Me.ReplacementFormat) + For Each attrib As Match In attribs + sb.Replace(attrib.Value, GetAttribute(attrib.Groups("name").Value, formatter)) + Next + If Not IsValueFormatted Then + sb.Append(GetAttribute("value", formatter)) + End If + Return sb.ToString() + End Function + + ''' Gets or sets the inner + ''' The BBCode between the start and end tags. + Public NotOverridable Overrides Property InnerBBCode() As String + Get + Dim sb As New System.Text.StringBuilder() + For Each n As BBCodeNode In Nodes + sb.Append(n.OuterBBCode) + Next + Return sb.ToString() + End Get + Set(ByVal value As String) + If Not RequireClosingTag Then + Throw New InvalidOperationException("The InnerBBCode property cannot be set for elements that does not require closing tags.") + End If + Me.Nodes.Clear() + Me.Nodes.AddRange(Me.Parser.Parse(value).Nodes) + End Set + End Property + + ''' Gets or sets the outer + ''' The BBCode of this instance of the . + Public NotOverridable Overrides ReadOnly Property OuterBBCode() As String + Get + Dim sb As New Text.StringBuilder() + sb.Append("[") + sb.Append(Me.Name) + If ((Me.Attributes.Count = 1) AndAlso Me.Attributes.ContainsKey("default")) Then + sb.AppendFormat(CultureInfo.InvariantCulture, "={0}", Quote(Me.Attributes("default"))) + Else + For Each key In Me.Attributes.Keys + sb.AppendFormat(CultureInfo.InvariantCulture, " {0}={1}", key, Quote(Me.Attributes(key))) + Next + End If + If (Me.RequireClosingTag) Then + sb.Append("]") + sb.Append(Me.InnerBBCode) + sb.Append("[/") + sb.Append(Me.Name) + End If + sb.Append("]") + Return sb.ToString() + End Get + End Property + + ''' Gets or sets the plain text of the node. + ''' The plain text between the start and end tags. + Public NotOverridable Overrides Property InnerText() As String + Get + Dim sb As New Text.StringBuilder() + For Each n In Me.Nodes + sb.Append(n.InnerText) + Next + Return sb.ToString() + End Get + Set(ByVal value As String) + If (Not RequireClosingTag) Then + Throw New InvalidOperationException("The InnerText property cannot be set for elements that does not require closing tags.") + End If + + '* + '* Removes all nodex from the element + '* + Me.Nodes.Clear() + If (Not String.IsNullOrEmpty(value)) Then + '* + '* Only append a BBCodeText element if the value is not empty + '* + Me.Nodes.Add(New BBCodeText(value)) + End If + End Set + End Property + + ''' + ''' Sets the element name of this instance. + ''' + ''' The new element name of this instance. + Friend Sub SetName(ByVal name As String) + __Name = name + End Sub + + ''' + ''' Gets a value indicating wheter or not the have been formatted. + ''' + ''' True if the values have been formatted; otherwise False. + Private Property IsValueFormatted() As Boolean + Get + Return __IsValueFormatted + End Get + Set(ByVal value As Boolean) + __IsValueFormatted = value + End Set + End Property + + Private Function GetAttribute(ByVal name As String, ByVal formatter As ITextFormatter) As String + Dim attribs = name.ToUpperInvariant().Split("|".ToCharArray(), StringSplitOptions.RemoveEmptyEntries) + For Each attrib In attribs + If (String.CompareOrdinal(attrib, "VALUE") = 0) Then + IsValueFormatted = True + Dim sb As New Text.StringBuilder() + For Each node In Me.Nodes + sb.Append(node.Format(formatter)) + Next + Return sb.ToString() + ElseIf (Me.Attributes.ContainsKey(attrib)) Then + Return (Me.Attributes.Item(attrib)) + End If + Next + Return String.Empty + End Function + +End Class diff --git a/ThirdParty/BBCode/Classes/BBCodeElementDefinition.vb b/ThirdParty/BBCode/Classes/BBCodeElementDefinition.vb new file mode 100644 index 0000000..ff40404 --- /dev/null +++ b/ThirdParty/BBCode/Classes/BBCodeElementDefinition.vb @@ -0,0 +1,113 @@ +'************************************************** +' FILE : BBCodeElementDefinition.vb +' AUTHOR : Paulo Santos +' CREATION : 4/29/2009 10:52:11 PM +' COPYRIGHT : Copyright © 2009 +' PJ on Development +' All Rights Reserved. +' +' Description: +' TODO: Add file description +' +' Change log: +' 0.1 4/29/2009 10:52:11 PM +' Paulo Santos +' Created. +'*************************************************** + +Imports System.Xml.Serialization + +''' +''' Represents a way of describing an element. +''' +Public Structure BBCodeElementDefinition + + Private __TagName As String + Private __RequireClosingTag As Boolean + Private __ReplacementFormat As String + + ''' + ''' Gets the name of the element. + ''' + _ + Public Property TagName() As String + Get + Return __TagName + End Get + Set(ByVal value As String) + __TagName = value.ToUpperInvariant() + End Set + End Property + + ''' + ''' Gets or sets the replacement format for this element. + ''' + ''' The replacement format. + ''' + ''' In order to use the any parameter in the replacement format use the following syntax: {paramName}. + ''' + ''' The parameter names are case insensitive. + ''' + ''' There are two reserved parameter keywords for formatting: DEFAULT and VALUE. + ''' DEFAULT : The text following the first equal sign after the name of the BBCode element. + ''' VALUE: The HTML generated by the BBCode between the start and end element tag. + ''' [url=http://tempuri.org]text[/url] + ''' In the example above the parameter DEFAULT would have the value "http://tempuri.org", while VALUE would be "text". + ''' + ''' To replace [url=http://tempuri.org]text[/url] the with <a href="http://tempuri.org">text</a> the following ReplacementFormat should be used: + ''' + ''' <a href="{default|value}">{value|default}</a> + ''' + ''' The example above, will set the href attribute with either the default value or the text inside the [url] element. The pipe (|) implies in finding the first non-empty attribute. + ''' + _ + Public Property ReplacementFormat() As String + Get + Return __ReplacementFormat + End Get + Set(ByVal value As String) + __ReplacementFormat = value + End Set + End Property + + ''' + ''' Gets or sets a value indicating if the element requires a closing tag. + ''' + _ + Public Property RequireClosingTag() As Boolean + Get + Return __RequireClosingTag + End Get + Set(ByVal value As Boolean) + __RequireClosingTag = value + End Set + End Property + + ''' Indicates whether this instance and a specified object are equal. + ''' true if and this instance are the same type and represent the same value; otherwise, false. + ''' Another object to compare to. + ''' 2 + Public Overrides Function Equals(ByVal obj As Object) As Boolean + If Not (TypeOf obj Is BBCodeElementDefinition) Then + Return False + End If + Return (Me.TagName = obj.TagName AndAlso Me.ReplacementFormat = obj.ReplacementFormat AndAlso Me.RequireClosingTag = obj.RequireClosingTag) + End Function + + ''' Returns the hash code for this instance. + ''' A 32-bit signed integer that is the hash code for this instance. + ''' 2 + Public Overrides Function GetHashCode() As Integer + Dim hash As Long = Me.TagName.GetHashCode() + Me.ReplacementFormat.GetHashCode() + Me.RequireClosingTag.GetHashCode() + Return hash And Integer.MinValue + End Function + + Public Shared Operator =(ByVal left As BBCodeElementDefinition, ByVal right As BBCodeElementDefinition) As Boolean + Return left.Equals(right) + End Operator + + Public Shared Operator <>(ByVal left As BBCodeElementDefinition, ByVal right As BBCodeElementDefinition) As Boolean + Return Not left = right + End Operator + +End Structure diff --git a/ThirdParty/BBCode/Classes/BBCodeElementDictionary.vb b/ThirdParty/BBCode/Classes/BBCodeElementDictionary.vb new file mode 100644 index 0000000..2222879 --- /dev/null +++ b/ThirdParty/BBCode/Classes/BBCodeElementDictionary.vb @@ -0,0 +1,158 @@ +'************************************************** +' FILE : BBCodeDictionary.vb +' AUTHOR : Paulo Santos +' CREATION : 4/29/2009 4:57:05 PM +' COPYRIGHT : Copyright © 2009 +' PJ on Development +' All Rights Reserved. +' +' Description: +' TODO: Add file description +' +' Change log: +' 0.1 4/29/2009 4:57:05 PM +' Paulo Santos +' Created. +'*************************************************** + +Imports System.Xml.Serialization +Imports System.Runtime.Serialization +Imports System.Diagnostics.CodeAnalysis +Imports System.Globalization + +''' +''' Represents the dictionary of terms. +''' + _ + _ +Public NotInheritable Class BBCodeElementDictionary + Inherits Dictionary(Of String, BBCodeElementDefinition) + Implements IXmlSerializable + Private Const STR_DictionaryItem As String = "tag" + + ''' Initializes an instance of the class. + ''' This is the default constructor for this class. + Friend Sub New() + End Sub + + ''' Initializes a new instance of the class with serialized data. + ''' A object containing the information required to serialize the . + ''' A structure containing the source and destination of the serialized stream associated with the . + Private Sub New(ByVal info As System.Runtime.Serialization.SerializationInfo, ByVal context As System.Runtime.Serialization.StreamingContext) + MyBase.New(info, context) + End Sub + + ''' + ''' Adds the specified key and value to the dictionary. + ''' + ''' The key of the element to add. + ''' The value of the element to add. + Private Shadows Sub Add(ByVal tagName As String, ByVal value As BBCodeElementDefinition) + ValidateTagName(tagName) + MyBase.Add(tagName.ToUpperInvariant(), value) + End Sub + + ''' + ''' Adds a new tag definition to the . + ''' + ''' The name of the tag. + ''' The text that the tag will generate, with placeholders for tag parameters. + Public Shadows Sub Add(ByVal tagName As String, ByVal replacementFormat As String) + Add(tagName, replacementFormat, False) + End Sub + + ''' + ''' Adds a new tag definition to the . + ''' + ''' The name of the tag. + ''' The text that the tag will generate, with placeholders for tag parameters. + ''' A value indicating wether or not the taq requires a closing tag. + Public Shadows Sub Add(ByVal tagName As String, ByVal replacementFormat As String, ByVal requireClosingTag As Boolean) + Add(tagName, New BBCodeElementDefinition() With {.TagName = tagName, _ + .ReplacementFormat = replacementFormat, _ + .RequireClosingTag = requireClosingTag}) + End Sub + + ''' This method is reserved and should not be used. When implementing the IXmlSerializable interface, you should return null (Nothing in Visual Basic) from this method, and instead, if specifying a custom schema is required, apply the to the class. + ''' An that describes the XML representation of the object that is produced by the method and consumed by the method. + Private Function GetSchema() As System.Xml.Schema.XmlSchema Implements System.Xml.Serialization.IXmlSerializable.GetSchema + Return Nothing + End Function + + ''' Generates an object from its XML representation. + ''' The stream from which the object is deserialized. + _ + Private Sub ReadXml(ByVal reader As System.Xml.XmlReader) Implements System.Xml.Serialization.IXmlSerializable.ReadXml + + '* + '* Check the name of the element + '* + If (reader.NamespaceURI <> STR_BBCodeSchemaNamespace) OrElse (reader.LocalName <> STR_BBCodeDictionaryXmlElement) Then + Exit Sub + End If + + '* + '* Move to the first item + '* + reader.Read() + + '* + '* Reads the items + '* + Do While (reader.LocalName = STR_DictionaryItem AndAlso reader.NamespaceURI = STR_BBCodeSchemaNamespace) + Dim definition As New BBCodeElementDefinition + Dim escaped As Boolean + With definition + .TagName = reader.GetAttribute("name") + Boolean.TryParse(reader.GetAttribute("requireClosingTag"), .RequireClosingTag) + Boolean.TryParse(reader.GetAttribute("escaped"), escaped) + If (escaped) Then + .ReplacementFormat = reader.ReadElementContentAsString() + Else + .ReplacementFormat = reader.ReadInnerXml().Replace(" xmlns=""""", "") + End If + End With + Me.Add(definition.TagName, definition) + Loop + + If (reader.NodeType = Xml.XmlNodeType.EndElement) Then + reader.Read() + End If + + End Sub + + ''' Converts an object into its XML representation. + ''' The stream to which the object is serialized. + _ + Private Sub WriteXml(ByVal writer As System.Xml.XmlWriter) Implements System.Xml.Serialization.IXmlSerializable.WriteXml + + Dim doc = New Xml.XmlDocument() + Dim xml = doc.CreateElement(STR_DictionaryItem, STR_BBCodeSchemaNamespace) + For Each it In Me + xml.Attributes.RemoveAll() + + xml.SetAttribute("name", it.Key.ToLower(CultureInfo.InvariantCulture)) + xml.SetAttribute("requireClosingTag", it.Value.RequireClosingTag.ToString()) + + Try + '* + '* Check if the Replacement format is valid XML + '* + xml.InnerXml = it.Value.ReplacementFormat + Catch ex As Xml.XmlException + '* + '* It's not a valid XML, so adds it as a value + '* + xml.SetAttribute("escaped", True) + xml.InnerText = it.Value.ReplacementFormat + End Try + + '* + '* OK, we attemp to write it of + '* + writer.WriteNode(xml.CreateNavigator(), True) + Next + + End Sub + +End Class diff --git a/ThirdParty/BBCode/Classes/BBCodeElementFactory.vb b/ThirdParty/BBCode/Classes/BBCodeElementFactory.vb new file mode 100644 index 0000000..04e1eb1 --- /dev/null +++ b/ThirdParty/BBCode/Classes/BBCodeElementFactory.vb @@ -0,0 +1,101 @@ +'************************************************** +' FILE : BBCodeElementFactory.vb +' AUTHOR : Paulo Santos +' CREATION : 4/30/2009 10:48:21 PM +' COPYRIGHT : Copyright © 2009 +' PJ on Development +' All Rights Reserved. +' +' Description: +' TODO: Add file description +' +' Change log: +' 0.1 4/30/2009 10:48:21 PM +' Paulo Santos +' Created. +'*************************************************** + +''' +''' Creates instances of . +''' +Friend NotInheritable Class BBCodeElementFactory + + Private __Parser As BBCodeParser + + ''' Initializes an instance of the class. + ''' The that will utilize the new instance of the . + Friend Sub New(ByVal parser As BBCodeParser) + __Parser = parser + End Sub + + ''' + ''' Gets the that utilizes this instance of the . + ''' + Public ReadOnly Property Parser() As BBCodeParser + Get + Return __Parser + End Get + End Property + + ''' + ''' Creates a new . + ''' + ''' The name of the element. + ''' The attributes of the element. + ''' A new . + Public Function CreateElement(ByVal name As String, ByVal attributes As BBCodeAttributeDictionary) As BBCodeElement + + Dim el As BBCodeElement + + '* + '* Check if we have a different type to create + '* + If (Parser.ElementTypes.ContainsKey(name.ToUpperInvariant())) Then + '* + '* Gets the type of the element + '* + Dim type = Parser.ElementTypes(name.ToUpperInvariant()) + + '* + '* Check if the type IS BBCodeElement + '* + If (type.Equals(GetType(BBCodeElement))) Then + el = New BBCodeElement() + Else + '* + '* Gets the default constructor + '* + Dim ctor = type.GetConstructor(New Type() {}) + If (ctor Is Nothing) Then + Throw New InvalidOperationException("The type " & type.FullName & " does not have a default constructor.") + End If + + '* + '* Creates the new element. + '* + el = TryCast(ctor.Invoke(New Object() {}), BBCodeElement) + If (el Is Nothing) Then + Throw New InvalidOperationException("The type " & type.FullName & " could not be assingned to BBCodeElement.") + End If + End If + Else + el = New BBCodeElement() + End If + + '* + '* Set the element properties + '* + el.SetName(name) + el.SetParser(Parser) + For Each attr In attributes + el.Attributes.Add(attr.Key, attr.Value) + Next + + '* + '* Returns the created element. + '* + Return el + + End Function + +End Class diff --git a/ThirdParty/BBCode/Classes/BBCodeElementTypeDictionary.vb b/ThirdParty/BBCode/Classes/BBCodeElementTypeDictionary.vb new file mode 100644 index 0000000..d4a5b54 --- /dev/null +++ b/ThirdParty/BBCode/Classes/BBCodeElementTypeDictionary.vb @@ -0,0 +1,104 @@ +'************************************************** +' FILE : BBCodeElementTypes.vb +' AUTHOR : Paulo Santos +' CREATION : 4/30/2009 10:16:36 PM +' COPYRIGHT : Copyright © 2009 +' PJ on Development +' All Rights Reserved. +' +' Description: +' TODO: Add file description +' +' Change log: +' 0.1 4/30/2009 10:16:36 PM +' Paulo Santos +' Created. +'*************************************************** + +Imports System.Xml.Serialization +Imports System.Globalization +Imports System.Diagnostics.CodeAnalysis + +''' +''' Represents a dictionary of types that implements a . +''' + _ + _ +Public NotInheritable Class BBCodeElementTypeDictionary + Inherits Dictionary(Of String, Type) + Implements IXmlSerializable + + Private Const STR_ConfigurationItem As String = "element" + + ''' Initializes an instance of the class. + ''' This is the default constructor for this class. + Friend Sub New() + End Sub + + ''' Initializes a new instance of the class with serialized data. + ''' A object containing the information required to serialize the . + ''' A structure containing the source and destination of the serialized stream associated with the . + Private Sub New(ByVal info As System.Runtime.Serialization.SerializationInfo, ByVal context As System.Runtime.Serialization.StreamingContext) + MyBase.New(info, context) + End Sub + + ''' + ''' Adds the specified key and value to the dictionary. + ''' + ''' The key of the element to add. + ''' The value of the element to add. + Public Shadows Sub Add(ByVal tagName As String, ByVal value As Type) + ValidateTagName(tagName) + ValidateBBCodeElementType(value) + MyBase.Add(tagName.ToUpperInvariant(), value) + End Sub + + ''' This method is reserved and should not be used. When implementing the IXmlSerializable interface, you should return null (Nothing in Visual Basic) from this method, and instead, if specifying a custom schema is required, apply the to the class. + ''' An that describes the XML representation of the object that is produced by the method and consumed by the method. + Public Function GetSchema() As System.Xml.Schema.XmlSchema Implements System.Xml.Serialization.IXmlSerializable.GetSchema + Return Nothing + End Function + + ''' Generates an object from its XML representation. + ''' The stream from which the object is deserialized. + Public Sub ReadXml(ByVal reader As System.Xml.XmlReader) Implements System.Xml.Serialization.IXmlSerializable.ReadXml + + '* + '* Check the name of the element + '* + If (reader.NamespaceURI <> STR_BBCodeSchemaNamespace) OrElse (reader.LocalName <> STR_BBCodeElementTypesXmlElement) Then + Exit Sub + End If + + '* + '* Reads the items + '* + Do While (reader.Read() AndAlso reader.LocalName = STR_ConfigurationItem AndAlso reader.NamespaceURI = STR_BBCodeSchemaNamespace) + Dim name = reader.GetAttribute("name") + Dim type = System.Type.GetType(reader.GetAttribute("type")) + If (type.IsSubclassOf(GetType(BBCodeElement))) Then + Me.Add(name, type) + End If + Loop + + If (reader.NodeType = Xml.XmlNodeType.EndElement) Then + reader.Read() + End If + + End Sub + + ''' Converts an object into its XML representation. + ''' The stream to which the object is serialized. + _ + Public Sub WriteXml(ByVal writer As System.Xml.XmlWriter) Implements System.Xml.Serialization.IXmlSerializable.WriteXml + + For Each it In Me + writer.WriteStartElement(STR_ConfigurationItem, STR_BBCodeSchemaNamespace) + writer.WriteAttributeString("name", it.Key.ToLower(CultureInfo.InvariantCulture)) + writer.WriteAttributeString("type", it.Value.AssemblyQualifiedName) + writer.WriteEndElement() + Next + + End Sub + +End Class diff --git a/ThirdParty/BBCode/Classes/BBCodeHtmlFormatter.vb b/ThirdParty/BBCode/Classes/BBCodeHtmlFormatter.vb new file mode 100644 index 0000000..cda2d30 --- /dev/null +++ b/ThirdParty/BBCode/Classes/BBCodeHtmlFormatter.vb @@ -0,0 +1,37 @@ +'************************************************** +' FILE : BBCodeHtmlGenerator.vb +' AUTHOR : Paulo Santos +' CREATION : 5/2/2009 10:19:43 AM +' COPYRIGHT : Copyright © 2009 +' PJ on Development +' All Rights Reserved. +' +' Description: +' TODO: Add file description +' +' Change log: +' 0.1 5/2/2009 10:19:43 AM +' Paulo Santos +' Created. +'*************************************************** + +''' +''' Represnts an HTML generator for the . +''' +Public NotInheritable Class BBCodeHtmlFormatter + Implements ITextFormatter + + ''' + ''' Generates the desired text from the specified source. + ''' + ''' The source to generate the text. + ''' The text generated by the source. + Public Function GenerateText(ByVal source As String) As String Implements ITextFormatter.Format + Dim sb As New Text.StringBuilder(HtmlEncode(source)) + sb.Replace(vbCrLf, vbLf) + sb.Replace(vbCr, String.Empty) + sb.Replace(vbLf, "
") + Return sb.ToString() + End Function + +End Class diff --git a/ThirdParty/BBCode/Classes/BBCodeNode.vb b/ThirdParty/BBCode/Classes/BBCodeNode.vb new file mode 100644 index 0000000..4a04b93 --- /dev/null +++ b/ThirdParty/BBCode/Classes/BBCodeNode.vb @@ -0,0 +1,101 @@ +'************************************************** +' FILE : BBCodeNode.vb +' AUTHOR : Paulo Santos +' CREATION : 4/29/2009 11:30:13 AM +' COPYRIGHT : Copyright © 2009 +' PJ on Development +' All Rights Reserved. +' +' Description: +' Represents the basic node of an BBCode document +' +' Change log: +' 0.1 4/29/2009 11:30:13 AM +' Paulo Santos +' Created. +'*************************************************** + +''' +''' Represents the basic node of an BBCode document. +''' +Public MustInherit Class BBCodeNode + + Private __Parent As BBCodeNode + Private __Parser As BBCodeParser + + ''' Initializes an instance of the class. + ''' This is the default constructor for this class. + Protected Sub New() + End Sub + + ''' Initializes an instance of the class. + ''' The parser used to create this element. + Protected Sub New(ByVal parser As BBCodeParser) + __Parser = parser + End Sub + + ''' + ''' Gets the parent node. + ''' + Public ReadOnly Property Parent() As BBCodeNode + Get + Return __Parent + End Get + End Property + + ''' + ''' Gets the that create this instance of the . + ''' + Protected Friend ReadOnly Property Parser() As BBCodeParser + Get + Return __Parser + End Get + End Property + + ''' + ''' When implemented in a derived class, transforms this instance of into its desired text representation. + ''' + ''' An object that implements the interface. + ''' The text formatted by the . + Public MustOverride Function Format(ByVal formatter As ITextFormatter) As String + + ''' + ''' When implemented in a derived class, gets or sets the inner BBCode. + ''' + ''' The BBCode between the start and end tags. + Public MustOverride Property InnerBBCode() As String + + ''' + ''' When implemented in a derived class, gets the outer BBCode. + ''' + ''' The BBCode of this instance of the . + Public MustOverride ReadOnly Property OuterBBCode() As String + + ''' + ''' When implemented in a derived class, gets or sets the plain text of the node. + ''' + ''' The plain text between the start and end tags. + Public MustOverride Property InnerText() As String + + ''' + ''' Sets the of this instance. + ''' + ''' The new parser of this instance. + Friend Sub SetParser(ByVal parser As BBCodeParser) + __Parser = parser + End Sub + + ''' + ''' The the parent node of this instance of the . + ''' + ''' The parent node. + Protected Friend Sub SetParent(ByVal parentNode As BBCodeNode) + Dim element = TryCast(parentNode, BBCodeElement) + If (element Is Nothing) OrElse (String.IsNullOrEmpty(element.Name)) Then + __Parent = Nothing + Else + __Parent = element + End If + End Sub + +End Class diff --git a/ThirdParty/BBCode/Classes/BBCodeNodeCollection.vb b/ThirdParty/BBCode/Classes/BBCodeNodeCollection.vb new file mode 100644 index 0000000..7d0130b --- /dev/null +++ b/ThirdParty/BBCode/Classes/BBCodeNodeCollection.vb @@ -0,0 +1,95 @@ +'************************************************** +' FILE : BBCodeNodeCollection.vb +' AUTHOR : Paulo Santos +' CREATION : 4/29/2009 11:31:52 AM +' COPYRIGHT : Copyright © 2009 +' PJ on Development +' All Rights Reserved. +' +' Description: +' TODO: Add file description +' +' Change log: +' 0.1 4/29/2009 11:31:52 AM +' Paulo Santos +' Created. +'*************************************************** + +''' +''' Represents a collection of . +''' +Public Class BBCodeNodeCollection + Inherits ObjectModel.Collection(Of BBCodeNode) + + Private __Owner As BBCodeNode + + ''' Initializes an instance of the class. + ''' This is the default constructor for this class. + Friend Sub New() + End Sub + + ''' Initializes an instance of the class. + ''' The collection owner. + ''' The argument is . + Friend Sub New(ByVal owner As BBCodeNode) + If (owner Is Nothing) Then + Throw New ArgumentNullException("owner") + End If + __Owner = owner + End Sub + + ''' + ''' Gets or sets the owner of the collection. + ''' + Friend ReadOnly Property Owner() As BBCodeNode + Get + Return __Owner + End Get + End Property + + ''' Adds an object to the end of the . + ''' The object to be added to the end of the . + ''' The argument is . + Public Shadows Sub Add(ByVal node As BBCodeNode) + If (node Is Nothing) Then + Throw New ArgumentNullException("node") + End If + node.SetParent(Me.Owner) + MyBase.Add(node) + End Sub + + ''' Adds the elements of the specified collection to the end of the . + ''' The collection whose elements should be added to the end of the . + ''' The argument is . + Public Shadows Sub AddRange(ByVal collection As IEnumerable(Of BBCodeNode)) + If (collection Is Nothing) Then + Throw New ArgumentNullException("collection") + End If + For Each n In collection + Me.Add(n) + Next + End Sub + + ''' + ''' Inserts an element into the at the specified index. + ''' + ''' The zero-based index at which item should be inserted. + ''' The object to insert. + Public Shadows Sub Insert(ByVal index As Integer, ByVal node As BBCodeNode) + node.SetParent(Me.Owner) + MyBase.Insert(index, node) + End Sub + + ''' + ''' Inserts the elements of a collection into the at the specified index. + ''' + ''' The zero-based index at which item should be inserted. + ''' The collection whose elements should be inserted into the . + Public Shadows Sub InsertRange(ByVal index As Integer, ByVal collection As IEnumerable(Of BBCodeNode)) + For Each node In collection + node.SetParent(Me.Owner) + Next + MyBase.Insert(index, collection) + End Sub + +End Class diff --git a/ThirdParty/BBCode/Classes/BBCodeParser.vb b/ThirdParty/BBCode/Classes/BBCodeParser.vb new file mode 100644 index 0000000..5ea6d8a --- /dev/null +++ b/ThirdParty/BBCode/Classes/BBCodeParser.vb @@ -0,0 +1,340 @@ +'************************************************** +' FILE : BBCodeParser.vb +' AUTHOR : Paulo Santos +' CREATION : 4/29/2009 11:03:53 AM +' COPYRIGHT : Copyright © 2009 +' PJ on Development +' All Rights Reserved. +' +' Description: +' TODO: Add file description +' +' Change log: +' 0.1 4/29/2009 11:03:53 AM +' Paulo Santos +' Created. +'*************************************************** + +Imports System.Text.RegularExpressions +Imports System.Diagnostics.CodeAnalysis + +''' +''' The parser of +''' +Public NotInheritable Class BBCodeParser + + Private __Factory As BBCodeElementFactory + Private __Configuration As BBCodeConfiguration + + Private Shared ReadOnly __ConfigSerializer As New System.Xml.Serialization.XmlSerializer(GetType(BBCodeConfiguration)) + Private Shared ReadOnly __Tokenizer As Tokenization.Tokenizer = PrepareTokenizer() + + ''' Initializes an instance of the class. + ''' This is the default constructor for this class. + Public Sub New() + End Sub + + ''' + ''' Gets the dictionary of elements to be replaced by the . + ''' + Public ReadOnly Property Dictionary() As BBCodeElementDictionary + Get + If (__Configuration Is Nothing) Then + __Configuration = New BBCodeConfiguration() + End If + Return __Configuration.Dictionary + End Get + End Property + + ''' + ''' Gets the dictionary of types created by the parser. + ''' + Public ReadOnly Property ElementTypes() As BBCodeElementTypeDictionary + Get + If (__Configuration Is Nothing) Then + __Configuration = New BBCodeConfiguration() + End If + Return __Configuration.ElementTypes + End Get + End Property + +#Region " LoadConfiguration Methods " + + ''' + ''' Loads the configuration from the specified filename. + ''' + ''' The name of the file to read the dictionary from. + Public Sub LoadConfiguration(ByVal fileName As String) + If (String.IsNullOrEmpty(fileName)) Then + Throw New ArgumentNullException("fileName") + End If + Using fileStream As New IO.FileStream(fileName, IO.FileMode.Open) + LoadConfiguration(fileStream) + End Using + End Sub + + ''' + ''' Loads the configuration from the specified . + ''' + ''' A to read the dictionary from. + Public Sub LoadConfiguration(ByVal stream As IO.Stream) + LoadConfiguration(New IO.StreamReader(stream, Text.Encoding.UTF8, True)) + End Sub + + ''' + ''' Loads the configuration from the specified . + ''' + ''' The to read the dictionary from. + Public Sub LoadConfiguration(ByVal reader As IO.TextReader) + Dim dic = __ConfigSerializer.Deserialize(reader) + If (dic IsNot Nothing) Then + __Configuration = dic + End If + End Sub + +#End Region + +#Region " SaveConfiguration Methods " + + ''' + ''' Saves the conficuration to the specified file. + ''' + ''' The name of the file to save the dictionary. + Public Sub SaveConfiguration(ByVal fileName As String) + If (String.IsNullOrEmpty(fileName)) Then + Throw New ArgumentNullException("fileName") + End If + Using fileStream As New IO.FileStream(fileName, IO.FileMode.Create) + SaveConfiguration(fileStream) + End Using + End Sub + + ''' + ''' Saves the conficuration to the specified . + ''' + ''' The to save the dictionary. + Public Sub SaveConfiguration(ByVal stream As IO.Stream) + SaveConfiguration(New IO.StreamWriter(stream, Text.Encoding.UTF8)) + End Sub + + ''' + ''' Saves the conficuration to the specified . + ''' + ''' The to save the dictionary. + Public Sub SaveConfiguration(ByVal writer As IO.TextWriter) + __ConfigSerializer.Serialize(writer, __Configuration) + End Sub + +#End Region + +#Region " Parse Methods " + + ''' + ''' Parses the specified text, returning a collection of . + ''' + ''' The text to be parsed. + ''' A containing the parsed text. + Public Function Parse(ByVal text As String) As BBCodeDocument + Using reader As New IO.StringReader(text) + Return Parse(reader) + End Using + End Function + + ''' + ''' Parses the specified stream, returning a collection of . + ''' + ''' The to be parsed. + ''' A containing the parsed . + Public Function Parse(ByVal stream As IO.Stream) As BBCodeDocument + Return Parse(stream, Text.Encoding.UTF8) + End Function + + ''' + ''' Parses the specified stream, returning a collection of . + ''' + ''' The to be parsed. + ''' The encoding of the stream. + ''' A containing the parsed . + Public Function Parse(ByVal stream As IO.Stream, ByVal encoding As Text.Encoding) As BBCodeDocument + Return Parse(New IO.StreamReader(stream, encoding)) + End Function + + ''' + ''' Parses the specified , returning a collection of . + ''' + ''' The to be parsed. + ''' A containing the parsed . + Public Function Parse(ByVal reader As IO.TextReader) As BBCodeDocument + + Dim doc = New BBCodeDocument(Me) + Dim rootElement As New BBCodeElement(Me) + Dim currentElement As BBCodeElement = rootElement + + Dim tk As Tokenization.Token + Dim sb As New Text.StringBuilder() + Dim sbText As New Text.StringBuilder() + Do While (reader.Peek() <> -1) + Dim line As String = reader.ReadLine() & vbCrLf + sbText.AppendLine(line) + Do + '* + '* Get the next token + '* + tk = Tokenizer.GetToken(line) + If (tk Is Nothing) Then + Exit Do + End If + + Dim tag = New BBCodeTag(tk.Value) + + ParseElement(rootElement, currentElement, tk, sb, tag) + Loop + Loop + + '* + '* Add the text node + '* + If (sb.Length > 0) Then + currentElement.Nodes.Add(New BBCodeText(sb.ToString())) + End If + + '* + '* Add the nodes to the document + '* + doc.Nodes.AddRange(rootElement.Nodes) + + '* + '* Sets the source text + '* + doc.SetText(sbText.ToString()) + + Return doc + + End Function + +#End Region + + ''' + ''' Gets the . + ''' + Private Shared ReadOnly Property Tokenizer() As Tokenization.Tokenizer + Get + Return __Tokenizer + End Get + End Property + + ''' + ''' Gets the . + ''' + Private ReadOnly Property Factory() As BBCodeElementFactory + Get + If (__Factory Is Nothing) Then + __Factory = New BBCodeElementFactory(Me) + End If + Return __Factory + End Get + End Property + + Private Sub ParseElement(ByVal rootElement As BBCodeElement, ByRef currentElement As BBCodeElement, ByVal token As Tokenization.Token, ByVal sb As Text.StringBuilder, ByVal tag As BBCodeTag) + + '* + '* Check the token Type + '* + Select Case token.RuleType + Case 0, -1 + '* + '* Empty tag or char + '* + sb.Append(token.Value) + Case 1 + '* + '* Closing tag + '* + + ParseClosingTag(rootElement, currentElement, token, sb, tag) + Case 2, 3, 4 + '* + '* Value Tag, Parametrized Tag, Generic Tag + '* + ParseTag(currentElement, sb, tag) + End Select + + End Sub + + Private Sub ParseTag(ByRef currentElement As BBCodeElement, ByVal sb As Text.StringBuilder, ByVal tag As BBCodeTag) + + '* + '* Add the text previous to the current element + '* + If (sb.Length > 0) Then + currentElement.Nodes.Add(New BBCodeText(sb.ToString())) + sb.Remove(0, sb.Length) + End If + + '* + '* Add the new element to the list of nodes + '* + Dim el = Factory.CreateElement(tag.Name, tag.Paramters) + currentElement.Nodes.Add(el) + + '* + '* Change the current element, if it requires an closing tag + '* + If (el.RequireClosingTag) Then + currentElement = el + End If + + End Sub + + Private Shared Sub ParseClosingTag(ByVal rootElement As BBCodeElement, ByRef currentElement As BBCodeElement, ByVal token As Tokenization.Token, ByVal sb As Text.StringBuilder, ByVal tag As BBCodeTag) + + '* + '* Check if the closing tag is closing a previously open tag + '* + If currentElement.RequireClosingTag AndAlso (String.CompareOrdinal(currentElement.Name, tag.Name) = 0) Then + '* + '* Add the inner text + '* + If (sb.Length > 0) Then + currentElement.Nodes.Add(New BBCodeText(sb.ToString())) + sb.Remove(0, sb.Length) + End If + + '* + '* Move up a level + '* + currentElement = If(currentElement.Parent, rootElement) + Else + '* + '* Adds to the text + '* + sb.Append(token.Value) + End If + + End Sub + + Private Shared Function PrepareTokenizer() As Tokenization.Tokenizer + Dim tk As New Tokenization.Tokenizer + '* + '* Prepares the BBCode Grammar + '* + With tk + '* + '* Define the grammar macros + '* + AddTokenizerBaseMacros(tk) + + '* + '* Define the grammar rules + '* + .AddRule("EmptyTag", 0, "\[{w}\]") + .AddRule("ClosingTag", 1, "\[/{name}\]") + .AddRule("ValueTag", 2, "\[{param}\]") + .AddRule("ParamsTag", 3, "\[{name}{params}\]") + .AddRule("Tag", 4, "\[[^ \t\r\n\f\]]+?\]") + .AddRule("Char", -1, ".") + End With + Return tk + End Function + +End Class diff --git a/ThirdParty/BBCode/Classes/BBCodeTag.vb b/ThirdParty/BBCode/Classes/BBCodeTag.vb new file mode 100644 index 0000000..baba713 --- /dev/null +++ b/ThirdParty/BBCode/Classes/BBCodeTag.vb @@ -0,0 +1,239 @@ +'************************************************** +' FILE : BBCodeTag.vb +' AUTHOR : Paulo Santos +' CREATION : 4/30/2009 10:14:00 AM +' COPYRIGHT : Copyright © 2009 +' PJ on Development +' All Rights Reserved. +' +' Description: +' TODO: Add file description +' +' Change log: +' 0.1 4/30/2009 10:14:00 AM +' Paulo Santos +' Created. +'*************************************************** + +Imports System.Text.RegularExpressions +Imports System.Diagnostics.CodeAnalysis + +''' +''' Helper class to parse a BBCode tag. +''' +Friend NotInheritable Class BBCodeTag + + Private Shared ReadOnly __Tokenizer As Tokenization.Tokenizer = PrepareTokenizer() + + Private __Text As String + Private __TagName As String + Private __IsClosingTag As Boolean + Private __Params As New BBCodeAttributeDictionary + + ''' Initializes an instance of the class. + ''' The text that defines the tag. + Public Sub New(ByVal text As String) + __Text = text + + '* + '* Read each token to the tag + '* + Dim sb As New Text.StringBuilder() + Dim addParam As Boolean + Dim paramName As String = String.Empty + Do + Dim tk = Tokenizer.GetToken(text) + If (tk Is Nothing) Then + Exit Do + End If + + Select Case tk.RuleType + Case -1 + '* + '* Check if it's a closing tag + '* + If (String.CompareOrdinal(tk.Name, "EndTagStart") = 0) Then + __IsClosingTag = True + End If + Case 0 + '* + '* Whitespace, ignoring + '* + Case 1 + '* + '* Name. it can be the name of the tag, or the name of a parameter + '* + If (String.IsNullOrEmpty(__TagName)) Then + __TagName = tk.Value.ToUpperInvariant() + Else + '* + '* Check if the paramName is already filled + '* + If (Not addParam) Then + paramName = tk.Value + Me.Paramters(paramName) = String.Empty + ElseIf (addParam) Then + '* + '* Add the parameter and it's value + '* + addParam = False + AddParamFromToken(paramName, tk) + End If + End If + Case 2 + '* + '* Finds the equals sign + '* + addParam = True + Case 3 + '* + '* Value: the value of a parameter + '* + If (addParam) Then + addParam = False + AddParamFromToken(paramName, tk) + End If + Case Else + sb.Append(tk.Value) + End Select + Loop + + If (sb.Length > 0 AndAlso String.IsNullOrEmpty(__TagName)) Then + __TagName = sb.ToString() + End If + End Sub + + ''' + ''' Gets the text of the tag. + ''' + _ + Public ReadOnly Property Text() As String + Get + Return __Text + End Get + End Property + + ''' + ''' Gets the name of the tag. + ''' + Public ReadOnly Property Name() As String + Get + Return __TagName + End Get + End Property + + ''' + ''' Indicates wheter or not the tag is an empty tag. + ''' + ''' True if the tag is empty; otherwise False. + _ + Public ReadOnly Property IsEmptyTag() As Boolean + Get + Return String.IsNullOrEmpty(Name) + End Get + End Property + + ''' + ''' Indicates wheter or not the tag is a closing tag. + ''' + ''' True if the tag is a closing tag; otherwise False. + _ + Public ReadOnly Property IsClosingTag() As Boolean + Get + Return __IsClosingTag + End Get + End Property + + ''' + ''' Indicates wheter or not the tag is a value tag. + ''' + ''' True if the tag is a value tag; otherwise False. + _ + Public ReadOnly Property IsValueTag() As Boolean + Get + Return Me.Paramters.Count = 1 AndAlso Me.Paramters.Keys(0) = "default" + End Get + End Property + + ''' + ''' Indicates wheter or not the tag is a parametrized tag. + ''' + ''' True if the tag is a parametrized tag; otherwise False. + _ + Public ReadOnly Property IsParamTag() As Boolean + Get + Return Me.Paramters.Count > 0 + End Get + End Property + + ''' + ''' Indicates wheter or not the tag is a tag. + ''' + ''' True if the tag is a tag; otherwise False. + _ + Public ReadOnly Property IsTag() As Boolean + Get + Return (Not Me.IsEmptyTag) AndAlso (Not Me.IsClosingTag) + End Get + End Property + + ''' + ''' Gets the paramters of the tag. + ''' + Public ReadOnly Property Paramters() As BBCodeAttributeDictionary + Get + Return __Params + End Get + End Property + + ''' + ''' Gets the . + ''' + Private Shared ReadOnly Property Tokenizer() As Tokenization.Tokenizer + Get + Return __Tokenizer + End Get + End Property + + Private Sub AddParamFromToken(ByRef paramName As String, ByVal tk As Tokenization.Token) + + If (String.IsNullOrEmpty(paramName)) Then + Me.Paramters("default") = UnQuote(tk.Value) + Else + Me.Paramters(paramName) = UnQuote(tk.Value) + End If + paramName = String.Empty + + End Sub + + Private Shared Function PrepareTokenizer() As Tokenization.Tokenizer + + Dim tk As New Tokenization.Tokenizer + + '* + '* Prepares the BBCode Grammar + '* + With tk + '* + '* Define the grammar macros + '* + AddTokenizerBaseMacros(tk) + + '* + '* Define the grammar rules + '* + .AddRule("TagStart", -1, "\[") + .AddRule("EndTagStart", -1, "\[/") + .AddRule("TagEnd", -1, "\]") + .AddRule("Space", 0, "{w}") + .AddRule("Name", 1, "{name}") + .AddRule("Equals", 2, "{w}={w}") + .AddRule("Value", 3, "{value}") + .AddRule("Text", 99, ".") + End With + + Return tk + + End Function + +End Class diff --git a/ThirdParty/BBCode/Classes/BBCodeText.vb b/ThirdParty/BBCode/Classes/BBCodeText.vb new file mode 100644 index 0000000..8ebc004 --- /dev/null +++ b/ThirdParty/BBCode/Classes/BBCodeText.vb @@ -0,0 +1,81 @@ +'************************************************** +' FILE : BBCodeText.vb +' AUTHOR : Paulo Santos +' CREATION : 4/29/2009 2:20:10 PM +' COPYRIGHT : Copyright © 2009 +' PJ on Development +' All Rights Reserved. +' +' Description: +' TODO: Add file description +' +' Change log: +' 0.1 4/29/2009 2:20:10 PM +' Paulo Santos +' Created. +'*************************************************** + +''' +''' Represents a simple text in the BBCode. +''' +Public NotInheritable Class BBCodeText + Inherits BBCodeNode + + Private __InnerText As String + + ''' Initializes an instance of the class. + ''' This is the default constructor for this class. + Friend Sub New() + End Sub + + ''' Initializes an instance of the class. + ''' The text of the . + Friend Sub New(ByVal text As String) + Me.InnerText = text + End Sub + + ''' Transforms this instance of into its desired text representation. + ''' An object that implements the interface. + ''' The text formatted by the . + Public Overrides Function Format(ByVal formatter As ITextFormatter) As String + Return formatter.Format(__InnerText) + End Function + + ''' Gets or sets the inner BBCode. + ''' The BBCode between the start and end tags. + Public Overrides Property InnerBBCode() As String + Get + Return Me.InnerText + End Get + Set(ByVal value As String) + Me.InnerText = value + End Set + End Property + + ''' Gets or sets the plain text of the node. + ''' The plain text between the start and end tags. + Public Overrides Property InnerText() As String + Get + Return __InnerText + End Get + Set(ByVal value As String) + __InnerText = value + End Set + End Property + + ''' Gets the outer BBCode. + ''' The BBCode of this instance of the . + Public Overrides ReadOnly Property OuterBBCode() As String + Get + Return Me.InnerText + End Get + End Property + + ''' Returns a that represents the current . + ''' A that represents the current . + ''' 2 + Public Overrides Function ToString() As String + Return Me.InnerText + End Function + +End Class diff --git a/ThirdParty/BBCode/Classes/Exceptions/CircularReferenceException.vb b/ThirdParty/BBCode/Classes/Exceptions/CircularReferenceException.vb new file mode 100644 index 0000000..6beae61 --- /dev/null +++ b/ThirdParty/BBCode/Classes/Exceptions/CircularReferenceException.vb @@ -0,0 +1,107 @@ +'************************************************** +' FILE : CircularReferenceException.vb +' AUTHOR : Paulo Santos +' CREATION : 9/30/2007 12:12:13 AM +' COPYRIGHT : Copyright © 2007 +' PJ on Development +' All Rights Reserved. +' +' Description: +' Represents an error when a macro has a circular reference. +' +' Change log: +' 0.1 9/30/2007 12:12:13 AM +' Paulo Santos +' Created. +'*************************************************** + +Imports System.Runtime.Serialization +Imports System.Security.Permissions + +''' +''' Represents an error when a macro has a circular reference. +''' + _ +Public Class CircularReferenceException + Inherits Exception + + Dim __Path As String + + ''' Initializes an instance of the class. + ''' This is the default constructor for this class. + Public Sub New() + MyBase.New(My.Resources.CircularReferenceException_Message) + End Sub + + ''' Initializes an instance of the class. + ''' The path of the circular reference. + Public Sub New(ByVal circularReferencePath As String) + MyBase.New(My.Resources.CircularReferenceException_Message) + __Path = circularReferencePath.Replace("}{", "} -> {") + End Sub + + ''' Initializes a new instance of the class with a specified error message and a reference to the inner exception that is the cause of this exception. + ''' The path of the circular reference. + ''' The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified. + Public Sub New(ByVal circularReferencePath As String, ByVal innerException As System.Exception) + MyBase.New(My.Resources.CircularReferenceException_Message, innerException) + __Path = circularReferencePath.Replace("}{", "} -> {") + End Sub + + ''' + ''' Initializes an instance of the class. + ''' + ''' The message that describes the error. + ''' The path of the circular reference. + Public Sub New(ByVal message As String, ByVal circularReferencePath As String) + MyBase.New(message) + __Path = circularReferencePath.Replace("}{", "} -> {") + End Sub + + ''' + ''' Initializes an instance of the class. + ''' + ''' The message that describes the error. + ''' The path of the circular reference. + ''' The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified. + Public Sub New(ByVal message As String, ByVal circularReferencePath As String, ByVal innerException As System.Exception) + MyBase.New(message, innerException) + __Path = circularReferencePath.Replace("}{", "} -> {") + End Sub + + ''' Initializes a new instance of the class with serialized data. + ''' The that holds the serialized object data about the exception being thrown. + ''' The that contains contextual information about the source or destination. + ''' The parameter is null. + ''' The class name is null or is zero (0). + Protected Sub New(ByVal info As SerializationInfo, ByVal context As StreamingContext) + MyBase.New(info, context) + __Path = info.GetString("__Path") + End Sub + + ''' + ''' Gets the path of the circular reference. + ''' + ''' The path of the circular reference. + Public ReadOnly Property CircularReferencePath() As String + Get + Return __Path + End Get + End Property + + ''' When overridden in a derived class, sets the with information about the exception. + ''' The that holds the serialized object data about the exception being thrown. + ''' The that contains contextual information about the source or destination. + ''' The parameter is a null reference (Nothing in Visual Basic). + ''' 2 + ''' + ''' + ''' + ''' + _ + Public Overrides Sub GetObjectData(ByVal info As System.Runtime.Serialization.SerializationInfo, ByVal context As System.Runtime.Serialization.StreamingContext) + MyBase.GetObjectData(info, context) + info.AddValue("__Path", __Path, GetType(String)) + End Sub + +End Class diff --git a/ThirdParty/BBCode/Classes/Exceptions/ReferencedMacroNotFoundException.vb b/ThirdParty/BBCode/Classes/Exceptions/ReferencedMacroNotFoundException.vb new file mode 100644 index 0000000..efcff06 --- /dev/null +++ b/ThirdParty/BBCode/Classes/Exceptions/ReferencedMacroNotFoundException.vb @@ -0,0 +1,120 @@ +'************************************************** +' FILE : ReferencedMacroNotFoundException.vb +' AUTHOR : Paulo Santos +' CREATION : 9/29/2007 11:40:10 PM +' COPYRIGHT : Copyright © 2007 +' PJ on Development +' All Rights Reserved. +' +' Description: +' Represents an error when a macro reference +' an unknown macro. +' +' Change log: +' 0.1 9/29/2007 11:40:10 PM +' Paulo Santos +' Created. +'*************************************************** + +Imports System.Globalization +Imports System.Runtime.Serialization +Imports System.Security.Permissions + +''' +''' Represents an error when a referenced macro is not found in the collection. +''' + _ +Public Class ReferencedMacroNotFoundException + Inherits Exception + + Private __ReferencedMacroName As String + +#Region " Constructors " + + ''' + ''' Initializes an instance of the class. + ''' This is the default constructor for this class. + ''' + Public Sub New() + End Sub + + ''' + ''' Initializes an instance of the class. + ''' + ''' The name of the macro not found. + Public Sub New(ByVal referencedMacroName As String) + Me.New(String.Format(CultureInfo.InvariantCulture, My.Resources.ReferencedMacroNotFoundException_Message, referencedMacroName), referencedMacroName) + End Sub + + ''' + ''' Initializes an instance of the class. + ''' + ''' The message that describes the error. + ''' The name of the macro not found. + Public Sub New(ByVal message As String, ByVal referencedMacroName As String) + MyBase.New(message) + __ReferencedMacroName = referencedMacroName + End Sub + + ''' + ''' Initializes an instance of the class. + ''' + ''' The message that describes the error. + ''' The exception that is the cause of the current exception, or a if no inner exception is specified. + Public Sub New(ByVal message As String, ByVal innerException As Exception) + MyBase.New(message, innerException) + End Sub + + ''' + ''' Initializes an instance of the class. + ''' + ''' The message that describes the error. + ''' The name of the macro not found. + ''' The exception that is the cause of the current exception, or a if no inner exception is specified. + Public Sub New(ByVal message As String, ByVal referencedMacroName As String, ByVal innerException As Exception) + Me.New(message, innerException) + __ReferencedMacroName = referencedMacroName + End Sub + + ''' Initializes a new instance of the class with serialized data. + ''' The that holds the serialized object data about the exception being thrown. + ''' The that contains contextual information about the source or destination. + ''' The parameter is null. + ''' The class name is null or is zero (0). + Protected Sub New(ByVal info As SerializationInfo, ByVal context As StreamingContext) + MyBase.New(info, context) + __ReferencedMacroName = info.GetString("__ReferencedMacroName") + End Sub + +#End Region + +#Region " Public Properties " + + ''' + ''' Gets the name of the referenced macro not found in the collection. + ''' + ''' The name of the referenced macro not found in the collection. + Public ReadOnly Property ReferencedMacroName() As String + Get + Return __ReferencedMacroName + End Get + End Property + +#End Region + + ''' When overridden in a derived class, sets the with information about the exception. + ''' The that holds the serialized object data about the exception being thrown. + ''' The that contains contextual information about the source or destination. + ''' The parameter is a null reference (Nothing in Visual Basic). + ''' 2 + ''' + ''' + ''' + ''' + _ + Public Overrides Sub GetObjectData(ByVal info As System.Runtime.Serialization.SerializationInfo, ByVal context As System.Runtime.Serialization.StreamingContext) + MyBase.GetObjectData(info, context) + info.AddValue("__ReferencedMacroName", __ReferencedMacroName, GetType(String)) + End Sub + +End Class diff --git a/ThirdParty/BBCode/Classes/Tokenizer/Macro.vb b/ThirdParty/BBCode/Classes/Tokenizer/Macro.vb new file mode 100644 index 0000000..e81b115 --- /dev/null +++ b/ThirdParty/BBCode/Classes/Tokenizer/Macro.vb @@ -0,0 +1,161 @@ +Imports System.Text +Imports System.Text.RegularExpressions +Imports System.Collections.Generic +Imports System.Globalization +Imports System.Collections.Specialized + +Namespace Tokenization + ''' + ''' Represents a Tokenizer MACRO. + ''' + Public Structure Macro + +#Region " Private Variables " + + Private Const __MacroNamePattern As String = "\{(?[_A-Z].*?)\}" + Private __Name As String + Private __Pattern As String + Private __ExpandedPattern As String + Private __References As StringCollection + Private __CircularReferencePath As String + +#End Region + +#Region " Public Properties " + + ''' + ''' Gets or sets the name of the macro. + ''' + ''' The name of the macro. + ''' The specified name of the macro contains invalid characters. + ''' The argument is . + Public Property Name() As String + Get + Return __Name + End Get + Set(ByVal value As String) + If (String.IsNullOrEmpty(value)) Then + Throw New ArgumentNullException("value") + End If + If ((value.IndexOf("{", StringComparison.Ordinal) <> (-1)) OrElse (value.IndexOf("}", StringComparison.Ordinal) <> (-1))) Then + Throw New ArgumentException(String.Format(CultureInfo.InvariantCulture, My.Resources.Name_ArgumentException_Message, "macro"), "value") + End If + __Name = value + End Set + End Property + + ''' + ''' Gets or sets the pattern of the macro. + ''' + ''' The pattern of the macro. + ''' The argument is . + Public Property Pattern() As String + Get + Return __Pattern + End Get + Set(ByVal value As String) + If (String.IsNullOrEmpty(value)) Then + Throw New ArgumentNullException("value") + End If + + '* + '* Set the references + '* + Dim mc As MatchCollection = Regex.Matches(value, __MacroNamePattern, RegexOptions.IgnoreCase) + Me.References.Clear() + For Each m As Match In mc + Me.References.Add(m.Groups("name").Value) + Next + + '* + '* Set the property + '* + __Pattern = value + End Set + End Property + + ''' + ''' Gets the expanded pattern of the macro. + ''' + ''' The expanded pattern of the macro. + Public ReadOnly Property ExpandedPattern() As String + Get + If (String.IsNullOrEmpty(__ExpandedPattern)) Then + Return __Pattern + End If + Return __ExpandedPattern + End Get + End Property + + ''' + ''' Gets a list of macro names referenced by this macro. + ''' + ''' A list of macro names referenced by this macro. + Public ReadOnly Property References() As StringCollection + Get + If (__References Is Nothing) Then + __References = New StringCollection() + End If + Return __References + End Get + End Property + +#End Region + +#Region " Friend Properties " + + ''' + ''' Gets a value indicating whether this instance is expanded. + ''' + ''' + ''' true if this instance is expanded; otherwise, false. + ''' + Friend ReadOnly Property IsExpanded() As Boolean + Get + Return Not String.IsNullOrEmpty(__ExpandedPattern) + End Get + End Property + +#End Region + +#Region " Friend Methods " + + ''' + ''' Sets the expanded pattern of the macro. + ''' + ''' The pattern of the macro. + Friend Sub SetExpandedPattern(ByVal pattern As String) + __ExpandedPattern = pattern + End Sub + +#End Region + + ''' Indicates whether this instance and a specified object are equal. + ''' true if and this instance are the same type and represent the same value; otherwise, false. + ''' Another object to compare to. + ''' 2 + Public Overrides Function Equals(ByVal obj As Object) As Boolean + If (TypeOf obj Is Macro) Then + Return Me.Name = obj.Name AndAlso Me.Pattern = obj.Pattern + End If + Return False + End Function + + ''' Returns the hash code for this instance. + ''' A 32-bit signed integer that is the hash code for this instance. + ''' 2 + Public Overrides Function GetHashCode() As Integer + Dim hash As Long = Me.Name.GetHashCode() + Me.Pattern.GetHashCode() + Return hash And Integer.MinValue + End Function + + Public Shared Operator =(ByVal left As Macro, ByVal right As Macro) As Boolean + Return left.Equals(right) + End Operator + + Public Shared Operator <>(ByVal left As Macro, ByVal right As Macro) As Boolean + Return Not left = right + End Operator + + End Structure +End Namespace diff --git a/ThirdParty/BBCode/Classes/Tokenizer/MacroCollection.vb b/ThirdParty/BBCode/Classes/Tokenizer/MacroCollection.vb new file mode 100644 index 0000000..78ae778 --- /dev/null +++ b/ThirdParty/BBCode/Classes/Tokenizer/MacroCollection.vb @@ -0,0 +1,37 @@ +'************************************************** +' FILE : MacroCollection.vb +' AUTHOR : Paulo Santos +' CREATION : 4/30/2009 1:07:21 PM +' COPYRIGHT : Copyright © 2009 +' PJ on Development +' All Rights Reserved. +' +' Description: +' TODO: Add file description +' +' Change log: +' 0.1 4/30/2009 1:07:21 PM +' Paulo Santos +' Created. +'*************************************************** + +Imports System.Collections.ObjectModel + +Namespace Tokenization + + ''' + ''' A read-only collection of . + ''' + Public NotInheritable Class MacroCollection + Inherits ReadOnlyCollection(Of Macro) + + ''' Initializes an instance of the class. + ''' The items of the collection. + Friend Sub New(ByVal items As IEnumerable(Of Macro)) + MyBase.New(items) + End Sub + + End Class + +End Namespace + diff --git a/ThirdParty/BBCode/Classes/Tokenizer/Rule.vb b/ThirdParty/BBCode/Classes/Tokenizer/Rule.vb new file mode 100644 index 0000000..d203c0e --- /dev/null +++ b/ThirdParty/BBCode/Classes/Tokenizer/Rule.vb @@ -0,0 +1,201 @@ +Imports System.Text +Imports System.Text.RegularExpressions +Imports System.Collections.Generic +Imports System.Globalization +Imports System.Collections.Specialized + +Namespace Tokenization + ''' + ''' Represents a Tokenizer RULE. + ''' + Public Structure Rule + +#Region " Private Variables " + + Private Const __MacroNamePattern As String = "\{(?[_A-Z].*?)\}" + + Private __Name As String + Private __Type As Integer + Private __Pattern As String + Private __ExpandedPattern As String + Private __References As StringCollection + Private __RegexOptions As Text.RegularExpressions.RegexOptions + Private __Regex As Text.RegularExpressions.Regex + +#End Region + +#Region " Public Properties " + + ''' + ''' Gets or sets the name of the rule. + ''' + ''' The name of the rule. + ''' The specified name of the rule contains invalid characters. + ''' The argument is . + Public Property Name() As String + Get + Return __Name + End Get + Set(ByVal value As String) + If (String.IsNullOrEmpty(value)) Then + Throw New ArgumentNullException("value") + End If + If ((value.IndexOf("{", StringComparison.Ordinal) <> (-1)) OrElse (value.IndexOf("}", StringComparison.Ordinal) <> (-1))) Then + Throw New ArgumentException(String.Format(CultureInfo.InvariantCulture, My.Resources.Name_ArgumentException_Message, "rule", "value")) + End If + __Name = value + End Set + End Property + + ''' + ''' Gets or sets the type of the rule. + ''' + ''' The type of the rule. + ''' + ''' The type of the rule is an implementation-specific value that has no meaning outside such implementation. + ''' + Public Property RuleType() As Integer + Get + Return __Type + End Get + Set(ByVal value As Integer) + __Type = value + End Set + End Property + + ''' + ''' Gets or sets the pattern of the rule. + ''' + ''' The pattern of the rule. + ''' The argument is . + Public Property Pattern() As String + Get + Return __Pattern + End Get + Set(ByVal value As String) + If (String.IsNullOrEmpty(value)) Then + Throw New ArgumentNullException("value") + End If + + '* + '* Set the references + '* + Dim mc As MatchCollection = RegEx.Matches(value, __MacroNamePattern, RegexOptions.IgnoreCase) + Me.References.Clear() + For Each m As Match In mc + Me.References.Add(m.Groups("name").Value) + Next + + '* + '* Set the property + '* + __Pattern = value + End Set + End Property + + ''' + ''' Gets the expanded pattern of the rule. + ''' + ''' The expanded pattern of the rule. + Public ReadOnly Property ExpandedPattern() As String + Get + If (String.IsNullOrEmpty(__ExpandedPattern)) Then + Return __Pattern + End If + Return __ExpandedPattern + End Get + End Property + + ''' + ''' Gets a list of rule names referenced by this rule. + ''' + ''' A list of rule names referenced by this rule. + Public ReadOnly Property References() As StringCollection + Get + If (__References Is Nothing) Then + __References = New StringCollection() + End If + Return __References + End Get + End Property + + ''' + ''' Gets the regular expression used to validate this rule. + ''' + ''' A object used to validate this rule. + Public ReadOnly Property Regex() As Text.RegularExpressions.Regex + Get + If (Not Me.IsExpanded) Then + Return Nothing + End If + If (__Regex Is Nothing) Then + If (Me.ExpandedPattern.StartsWith("^", StringComparison.Ordinal)) Then + __Regex = New Text.RegularExpressions.Regex(Me.ExpandedPattern, __RegexOptions) + Else + __Regex = New Text.RegularExpressions.Regex("^" & Me.ExpandedPattern, __RegexOptions) + End If + End If + Return __Regex + End Get + End Property + +#End Region + +#Region " Friend Properties " + + ''' + ''' Gets a value indicating whether this instance is expanded. + ''' + ''' + ''' true if this instance is expanded; otherwise, false. + ''' + Friend ReadOnly Property IsExpanded() As Boolean + Get + Return Not String.IsNullOrEmpty(__ExpandedPattern) + End Get + End Property + +#End Region + +#Region " Friend Methods " + + ''' + ''' Sets the expanded pattern of the rule. + ''' + ''' The pattern of the rule. + Friend Sub SetExpandedPattern(ByVal pattern As String, ByVal options As Text.RegularExpressions.RegexOptions) + __ExpandedPattern = pattern + __RegexOptions = options And (Not RegexOptions.Compiled) + End Sub + +#End Region + + ''' Indicates whether this instance and a specified object are equal. + ''' true if and this instance are the same type and represent the same value; otherwise, false. + ''' Another object to compare to. + ''' 2 + Public Overrides Function Equals(ByVal obj As Object) As Boolean + If (TypeOf obj Is Rule) Then + Return Me.Name = obj.Name AndAlso Me.Pattern = obj.Pattern + End If + Return False + End Function + + ''' Returns the hash code for this instance. + ''' A 32-bit signed integer that is the hash code for this instance. + ''' 2 + Public Overrides Function GetHashCode() As Integer + Dim hash As Long = Me.Name.GetHashCode() + Me.Pattern.GetHashCode() + Return hash And Integer.MinValue + End Function + + Public Shared Operator =(ByVal left As Rule, ByVal right As Rule) As Boolean + Return left.Equals(right) + End Operator + + Public Shared Operator <>(ByVal left As Rule, ByVal right As Rule) As Boolean + Return Not left = right + End Operator + + End Structure +End Namespace diff --git a/ThirdParty/BBCode/Classes/Tokenizer/RuleCollection.vb b/ThirdParty/BBCode/Classes/Tokenizer/RuleCollection.vb new file mode 100644 index 0000000..df62bc0 --- /dev/null +++ b/ThirdParty/BBCode/Classes/Tokenizer/RuleCollection.vb @@ -0,0 +1,36 @@ +'************************************************** +' FILE : RuleCollection.vb +' AUTHOR : Paulo Santos +' CREATION : 4/30/2009 1:11:18 PM +' COPYRIGHT : Copyright © 2009 +' PJ on Development +' All Rights Reserved. +' +' Description: +' TODO: Add file description +' +' Change log: +' 0.1 4/30/2009 1:11:18 PM +' Paulo Santos +' Created. +'*************************************************** + +Imports System.Collections.ObjectModel + +Namespace Tokenization + + ''' + ''' A read-only collection of . + ''' + Public NotInheritable Class RuleCollection + Inherits ReadOnlyCollection(Of Rule) + + ''' Initializes an instance of the class. + ''' The items of the collection. + Friend Sub New(ByVal items As IEnumerable(Of Rule)) + MyBase.New(items) + End Sub + + End Class + +End Namespace diff --git a/ThirdParty/BBCode/Classes/Tokenizer/Token.vb b/ThirdParty/BBCode/Classes/Tokenizer/Token.vb new file mode 100644 index 0000000..e5c463b --- /dev/null +++ b/ThirdParty/BBCode/Classes/Tokenizer/Token.vb @@ -0,0 +1,76 @@ +Imports System.Text +Imports System.Text.RegularExpressions +Imports System.Collections.Generic + +Namespace Tokenization + ''' + ''' Represents a Tokenized TOKEN. + ''' + Public Class Token + +#Region " Private Variables " + + Private __Name As String + Private __Type As Integer + Private __Value As String + +#End Region + +#Region " Constructors " + + ''' + ''' Initializes an instance of the class. + ''' + ''' The name of the token. + ''' The type of the token. + ''' The literal value of the token. + Friend Sub New(ByVal name, ByVal type, ByVal value) + __Name = name + __Type = type + __Value = value + End Sub + +#End Region + +#Region " Public Properties " + + ''' + ''' Gets the name of the rule that matched the token. + ''' + ''' The name of the rule that matched the token. + ''' + ''' The name of the token is the name of the rule that matched the toklen. + ''' + Public ReadOnly Property Name() As String + Get + Return __Name + End Get + End Property + + ''' + ''' Gets the type of the rule that matched the token. + ''' + ''' The type of the rule. + ''' + ''' The type of the rule is an implementation-specific value that has no meaning outside such implementation. + ''' + Public ReadOnly Property RuleType() As Integer + Get + Return __Type + End Get + End Property + + ''' + ''' Gets the literal value of the token. + ''' + ''' The literal value of the token. + Public ReadOnly Property Value() As String + Get + Return __Value + End Get + End Property + +#End Region + + End Class +End Namespace diff --git a/ThirdParty/BBCode/Classes/Tokenizer/Tokenizer.vb b/ThirdParty/BBCode/Classes/Tokenizer/Tokenizer.vb new file mode 100644 index 0000000..8cd149d --- /dev/null +++ b/ThirdParty/BBCode/Classes/Tokenizer/Tokenizer.vb @@ -0,0 +1,315 @@ +'************************************************** +' FILE : Tokenizer.vb +' AUTHOR : Paulo Santos +' CREATION : 9/29/2007 10:18:09 PM +' COPYRIGHT : Copyright © 2007 +' PJ on Development +' All Rights Reserved. +' +' Description: +' Implements a class that retrieves tokens from an input. +' +' Change log: +' 0.1 9/29/2007 10:18:09 PM +' Paulo Santos +' Created. +'*************************************************** + +Imports System.Text +Imports System.Text.RegularExpressions +Imports System.Collections.Generic +Imports System.Diagnostics.CodeAnalysis + +Namespace Tokenization + + ''' + ''' An utility class to get tokens from an input. + ''' + _ + Public Class Tokenizer + + Private Const __MacroNamePattern As String = "\{(?[_A-Z].*?)\}" + + Private __Macros As New Dictionary(Of String, Macro) + Private __Rules As New Dictionary(Of String, Rule) + Private __Options As RegexOptions + +#Region " Public Properties " + + ''' + ''' Gets a read-only list of the macros of this instance of the class. + ''' + ''' A read-only list of the macros of this instance of the class. + Public ReadOnly Property Macros() As MacroCollection + Get + Return New MacroCollection(__Macros.Values) + End Get + End Property + + ''' + ''' Gets a read-only list of the rules of this instance of the class. + ''' + ''' A read-only list of the rules of this instance of the class. + Public ReadOnly Property Rules() As RuleCollection + Get + Return New RuleCollection(__Rules.Values) + End Get + End Property + + ''' + ''' Gets or sets the regular expression options used to match the rules. + ''' + ''' The regular expression options used to match the rules. + Public Property Options() As RegexOptions + Get + Return __Options + End Get + Set(ByVal value As RegexOptions) + __Options = value + End Set + End Property + +#End Region + +#Region " Public Methods " + + ''' + ''' Adds a new macro to the list. + ''' + ''' The macro to be added. + ''' One or more referenced macros was not found in the collection. + ''' The macro has a circular reference. + Public Sub AddMacro(ByVal macro As Macro) + For Each s As String In macro.References + If (Not __Macros.ContainsKey(s)) Then + Throw New ReferencedMacroNotFoundException(s) + End If + Next + EnsureNoCircularReference(macro) + Expand(macro) + __Macros.Add(macro.Name, macro) + End Sub + + ''' + ''' Adds a new macro to the list. + ''' + ''' The name of the macro to add. + ''' The pattern of the macro to add. + Public Sub AddMacro(ByVal name As String, ByVal pattern As String) + If (String.IsNullOrEmpty(name) OrElse String.IsNullOrEmpty(pattern)) Then + Throw New ArgumentNullException(IIf(String.IsNullOrEmpty(name), "name", "pattern")) + End If + Dim m As New Macro + m.Name = name + m.Pattern = pattern + Me.AddMacro(m) + End Sub + + ''' + ''' Adds a new rule to the list. + ''' + ''' The rule to be added. + ''' One or more referenced macro was not found in the collection. + Public Sub AddRule(ByVal rule As Rule) + For Each s As String In rule.References + If (Not __Macros.ContainsKey(s)) Then + Throw New ReferencedMacroNotFoundException(s) + End If + Next + Expand(rule) + __Rules.Add(rule.Name, rule) + End Sub + + ''' + ''' Adds a new rule to the list. + ''' + ''' The name of the rule to add. + ''' The type of the rule to add. + ''' The pattern of the rule to add. + Public Sub AddRule(ByVal name As String, ByVal type As Integer, ByVal pattern As String) + If (String.IsNullOrEmpty(name) OrElse String.IsNullOrEmpty(pattern)) Then + Throw New ArgumentNullException(IIf(String.IsNullOrEmpty(name), "name", "pattern")) + End If + Dim m As New Rule + m.Name = name + m.RuleType = type + m.Pattern = pattern + Me.AddRule(m) + End Sub + + ''' + ''' Returns a token from the specified text, consuming it. + ''' + ''' The text from which to extract the token. + ''' A token from the specified text if a matching rule is found; otherwise . + ''' + ''' The text is passed by reference and the token is consumed, i.e., + ''' the token will be removed from the specified text. + ''' + ''' If the text is or GetToken also returns . + ''' + _ + Public Function GetToken(ByRef text As String) As Token + + '* + '* Check the passed parameters + '* + If (String.IsNullOrEmpty(text)) Then + Return Nothing + End If + + Dim token As Token + Dim matchedToken As Token = Nothing + + Dim maxLen As Integer = -1 + For Each name As String In __Rules.Keys + Dim r As Rule = __Rules(name) + If (Not r.IsExpanded) Then + Expand(r) + End If + + '* + '* Try to match the rule + '* + Dim match As Match = r.Regex.Match(text) + + '* + '* If the match is a success + '* + If (match.Success) Then + '* + '* Add the token to the match list + '* + token = New Token(r.Name, r.RuleType, match.Value) + + '* + '* Check for the maximum amount of characters consumed + '* + If (maxLen < match.Value.Length) Then + maxLen = match.Value.Length + matchedToken = token + End If + End If + Next + + '* + '* Was any token found? + '* + If (matchedToken IsNot Nothing) Then + '* + '* Consumes the token + '* + text = text.Substring(matchedToken.Value.Length) + End If + + Return matchedToken + + End Function + +#End Region + +#Region " Private Methods " + + ''' + ''' Determines whether the specified macro has circular reference. + ''' + ''' The macro to be tested. + Private Sub EnsureNoCircularReference(ByVal macro As Macro, Optional ByVal path As String = "") + + If (path.IndexOf("{" & macro.Name & "}", StringComparison.OrdinalIgnoreCase) <> (-1)) Then + Throw New CircularReferenceException(path & "{" & macro.Name & "}") + End If + + For Each s As String In macro.References + EnsureNoCircularReference(__Macros.Item(s), path & "{" & macro.Name & "}") + Next + + End Sub + + ''' + ''' Expands all referenced macros in the rule. + ''' + ''' The rule to be expanded. + Private Sub Expand(ByRef rule As Rule) + + '* + '* Resolve literals + '* + Dim iPos As Integer = 0 + Dim sb As New StringBuilder + For Each m As Match In Regex.Matches(rule.Pattern, """([^""]|\\"")*?""") + sb.Append(rule.Pattern.Substring(iPos, m.Index - iPos)) + sb.Append(EscapeRegExpChars(m.Value.Substring(1, m.Value.Length - 2).Replace("\""", """"))) + iPos = m.Index + m.Length + Next + sb.Append(rule.Pattern.Substring(iPos)) + Dim expanded As String = sb.ToString() + + '* + '* Expand macros + '* + For Each s As String In rule.References + Dim m As Macro = __Macros(s) + If (Not m.IsExpanded) Then + Expand(m) + End If + + expanded = expanded.Replace("{" & m.Name & "}", "(" & m.ExpandedPattern & ")") + Next + + rule.SetExpandedPattern(expanded, Me.Options) + + End Sub + + ''' + ''' Expands all referenced macros in the macro. + ''' + ''' The macro to be expanded. + Private Sub Expand(ByRef macro As Macro) + + Dim expanded As String = macro.Pattern + For Each s As String In macro.References + Dim im As Macro = __Macros(s) + If (Not im.IsExpanded) Then + Expand(im) + End If + + expanded = expanded.Replace("{" & im.Name & "}", "(" & im.ExpandedPattern & ")") + Next + + macro.SetExpandedPattern(expanded) + + End Sub + + ''' + ''' Escapes all regular expression special characters. + ''' + ''' The regular expression pattern to be escaped. + ''' A string with all the regular expression special characters escaped. + Private Shared Function EscapeRegExpChars(ByVal text As String) As String + + Dim s As String = text + s = s.Replace("\", "\\") + s = s.Replace("^", "\^") + s = s.Replace("$", "\$") + s = s.Replace("*", "\*") + s = s.Replace("+", "\+") + s = s.Replace("?", "\?") + s = s.Replace("{", "\{") + s = s.Replace("}", "\}") + s = s.Replace(".", "\.") + s = s.Replace("(", "\(") + s = s.Replace(")", "\)") + s = s.Replace("[", "\[") + s = s.Replace("]", "\]") + s = s.Replace("|", "\|") + Return s + + End Function + +#End Region + + End Class + +End Namespace + diff --git a/ThirdParty/BBCode/Interfaces/ITextFormatter.vb b/ThirdParty/BBCode/Interfaces/ITextFormatter.vb new file mode 100644 index 0000000..9ffa907 --- /dev/null +++ b/ThirdParty/BBCode/Interfaces/ITextFormatter.vb @@ -0,0 +1,30 @@ +'************************************************** +' FILE : ITextFormatter.vb +' AUTHOR : Paulo Santos +' CREATION : 5/2/2009 10:22:55 AM +' COPYRIGHT : Copyright © 2009 +' PJ on Development +' All Rights Reserved. +' +' Description: +' TODO: Add file description +' +' Change log: +' 0.1 5/2/2009 10:22:55 AM +' Paulo Santos +' Created. +'*************************************************** + +''' +''' Defines a generic text formatter. +''' +Public Interface ITextFormatter + + ''' + ''' Formats the specified text. + ''' + ''' The text to be formatted. + ''' The formatted text. + Function Format(ByVal source As String) As String + +End Interface diff --git a/ThirdParty/BBCode/Modules/Utils.vb b/ThirdParty/BBCode/Modules/Utils.vb new file mode 100644 index 0000000..4d1c22c --- /dev/null +++ b/ThirdParty/BBCode/Modules/Utils.vb @@ -0,0 +1,411 @@ +'************************************************** +' FILE : Utils.vb +' AUTHOR : Paulo Santos +' CREATION : 4/29/2009 2:14:26 PM +' COPYRIGHT : Copyright © 2009 +' PJ on Development +' All Rights Reserved. +' +' Description: +' TODO: Add file description +' +' Change log: +' 0.1 4/29/2009 2:14:26 PM +' Paulo Santos +' Created. +'*************************************************** + +Imports System.Text.RegularExpressions +Imports System.Diagnostics.CodeAnalysis + +Friend Module Utils + + Public Const STR_BBCodeSchemaNamespace As String = "" '= "http://pjondevelopment.50webs.com/schema/bbcode" + Public Const STR_BBCodeDictionaryXmlElement As String = "Dictionary" + Public Const STR_BBCodeElementTypesXmlElement As String = "ElementTypes" + Public Const STR_BBCodeConfigurationXmlElement As String = "Configuration" + + ''' + ''' Returns the specified text between quotes. + ''' + ''' The text to be placed between quotes. + ''' The text between quotes. + Public Function Quote(ByVal text As String) As String + Return "'" & text.Replace("'", "''") & "'" + End Function + + ''' + ''' Unquotes the specified text. + ''' + ''' The text to be unquoted. + ''' The unquoted text. + Public Function UnQuote(ByVal text As String) As String + Dim rx As New Text.RegularExpressions.Regex("^(?'(?(?:''|[^'])*)')|(?""(?(?:""""|[^""])*)"")$") + Dim m = rx.Match(text) + If (Not m.Success) Then + Return text + End If + If (m.Groups("quote").Success) Then + Return m.Groups("text").Value.Replace("''", "'") + End If + Return m.Groups("text").Value.Replace("""""", """") + End Function + + ''' + ''' Validates the specified tag name. + ''' + ''' The tagname to be validated. + Public Sub ValidateTagName(ByVal tagName As String) + If (String.IsNullOrEmpty(tagName)) Then + Throw New ArgumentNullException("tagName") + End If + If (tagName.IndexOf("=", StringComparison.Ordinal) <> -1) OrElse (tagName.IndexOf("[", StringComparison.Ordinal) <> -1) OrElse (tagName.IndexOf("]", StringComparison.Ordinal) <> -1) Then + Throw New ArgumentException("Invalid tag name. The tag name cannot contain '=' '[' or ']'.", "tagName") + End If + End Sub + + ''' + ''' Validates the specified type to ensure that it is a subclass of . + ''' + ''' The to be validated. + Public Sub ValidateBBCodeElementType(ByVal value As Type) + + '* + '* Validate is nothing + '* + If (value Is Nothing) Then + Throw New ArgumentNullException("value") + End If + + '* + '* Validates the BBCodeElement itself + '* + Dim bbcodeType = GetType(BBCodeElement) + If (value.Equals(bbcodeType)) Then + Exit Sub + End If + + '* + '* Validate subclass + '* + If Not bbcodeType.IsAssignableFrom(value) Then + Throw New InvalidOperationException("The type " & value.FullName & " must be a assingable to BBCodeElement.") + End If + + '* + '* Validate default constructor + '* + If (value.GetConstructor(New Type() {}) Is Nothing) Then + Throw New InvalidOperationException("The type " & value.FullName & " does not provide a public default constructor.") + End If + + End Sub + + ''' + ''' Encodes the specified text as HTML. + ''' + ''' The text to be encoded. + ''' The encoded HTML. + _ + Public Function HtmlEncode(ByVal text As String) As String + Dim sb As New Text.StringBuilder(text) + sb.Replace(ChrW(&H26), "&") + sb.Replace(ChrW(&H22), """) + sb.Replace(ChrW(&H27), "'") + sb.Replace(ChrW(&H3C), "<") + sb.Replace(ChrW(&H3E), ">") + sb.Replace(ChrW(&HA0), " ") + sb.Replace(ChrW(&HA1), "¡") + sb.Replace(ChrW(&HA2), "¢") + sb.Replace(ChrW(&HA3), "£") + sb.Replace(ChrW(&HA4), "¤") + sb.Replace(ChrW(&HA5), "¥") + sb.Replace(ChrW(&HA6), "¦") + sb.Replace(ChrW(&HA7), "§") + sb.Replace(ChrW(&HA8), "¨") + sb.Replace(ChrW(&HA9), "©") + sb.Replace(ChrW(&HAA), "ª") + sb.Replace(ChrW(&HAB), "«") + sb.Replace(ChrW(&HAC), "¬") + sb.Replace(ChrW(&HAD), "­") + sb.Replace(ChrW(&HAE), "®") + sb.Replace(ChrW(&HAF), "¯") + sb.Replace(ChrW(&HB0), "°") + sb.Replace(ChrW(&HB1), "±") + sb.Replace(ChrW(&HB2), "²") + sb.Replace(ChrW(&HB3), "³") + sb.Replace(ChrW(&HB4), "´") + sb.Replace(ChrW(&HB5), "µ") + sb.Replace(ChrW(&HB6), "¶") + sb.Replace(ChrW(&HB7), "·") + sb.Replace(ChrW(&HB8), "¸") + sb.Replace(ChrW(&HB9), "¹") + sb.Replace(ChrW(&HBA), "º") + sb.Replace(ChrW(&HBB), "»") + sb.Replace(ChrW(&HBC), "¼") + sb.Replace(ChrW(&HBD), "½") + sb.Replace(ChrW(&HBE), "¾") + sb.Replace(ChrW(&HBF), "¿") + sb.Replace(ChrW(&HC0), "À") + sb.Replace(ChrW(&HC1), "Á") + sb.Replace(ChrW(&HC2), "Â") + sb.Replace(ChrW(&HC3), "Ã") + sb.Replace(ChrW(&HC4), "Ä") + sb.Replace(ChrW(&HC5), "Å") + sb.Replace(ChrW(&HC6), "Æ") + sb.Replace(ChrW(&HC7), "Ç") + sb.Replace(ChrW(&HC8), "È") + sb.Replace(ChrW(&HC9), "É") + sb.Replace(ChrW(&HCA), "Ê") + sb.Replace(ChrW(&HCB), "Ë") + sb.Replace(ChrW(&HCC), "Ì") + sb.Replace(ChrW(&HCD), "Í") + sb.Replace(ChrW(&HCE), "Î") + sb.Replace(ChrW(&HCF), "Ï") + sb.Replace(ChrW(&HD0), "Ð") + sb.Replace(ChrW(&HD1), "Ñ") + sb.Replace(ChrW(&HD2), "Ò") + sb.Replace(ChrW(&HD3), "Ó") + sb.Replace(ChrW(&HD4), "Ô") + sb.Replace(ChrW(&HD5), "Õ") + sb.Replace(ChrW(&HD6), "Ö") + sb.Replace(ChrW(&HD7), "×") + sb.Replace(ChrW(&HD8), "Ø") + sb.Replace(ChrW(&HD9), "Ù") + sb.Replace(ChrW(&HDA), "Ú") + sb.Replace(ChrW(&HDB), "Û") + sb.Replace(ChrW(&HDC), "Ü") + sb.Replace(ChrW(&HDD), "Ý") + sb.Replace(ChrW(&HDE), "Þ") + sb.Replace(ChrW(&HDF), "ß") + sb.Replace(ChrW(&HE0), "à") + sb.Replace(ChrW(&HE1), "á") + sb.Replace(ChrW(&HE2), "â") + sb.Replace(ChrW(&HE3), "ã") + sb.Replace(ChrW(&HE4), "ä") + sb.Replace(ChrW(&HE5), "å") + sb.Replace(ChrW(&HE6), "æ") + sb.Replace(ChrW(&HE7), "ç") + sb.Replace(ChrW(&HE8), "è") + sb.Replace(ChrW(&HE9), "é") + sb.Replace(ChrW(&HEA), "ê") + sb.Replace(ChrW(&HEB), "ë") + sb.Replace(ChrW(&HEC), "ì") + sb.Replace(ChrW(&HED), "í") + sb.Replace(ChrW(&HEE), "î") + sb.Replace(ChrW(&HEF), "ï") + sb.Replace(ChrW(&HF0), "ð") + sb.Replace(ChrW(&HF1), "ñ") + sb.Replace(ChrW(&HF2), "ò") + sb.Replace(ChrW(&HF3), "ó") + sb.Replace(ChrW(&HF4), "ô") + sb.Replace(ChrW(&HF5), "õ") + sb.Replace(ChrW(&HF6), "ö") + sb.Replace(ChrW(&HF7), "÷") + sb.Replace(ChrW(&HF8), "ø") + sb.Replace(ChrW(&HF9), "ù") + sb.Replace(ChrW(&HFA), "ú") + sb.Replace(ChrW(&HFB), "û") + sb.Replace(ChrW(&HFC), "ü") + sb.Replace(ChrW(&HFD), "ý") + sb.Replace(ChrW(&HFE), "þ") + sb.Replace(ChrW(&HFF), "ÿ") + sb.Replace(ChrW(&H152), "Œ") + sb.Replace(ChrW(&H153), "œ") + sb.Replace(ChrW(&H160), "Š") + sb.Replace(ChrW(&H161), "š") + sb.Replace(ChrW(&H178), "Ÿ") + sb.Replace(ChrW(&H192), "ƒ") + sb.Replace(ChrW(&H2C6), "ˆ") + sb.Replace(ChrW(&H2DC), "˜") + sb.Replace(ChrW(&H391), "Α") + sb.Replace(ChrW(&H392), "Β") + sb.Replace(ChrW(&H393), "Γ") + sb.Replace(ChrW(&H394), "Δ") + sb.Replace(ChrW(&H395), "Ε") + sb.Replace(ChrW(&H396), "Ζ") + sb.Replace(ChrW(&H397), "Η") + sb.Replace(ChrW(&H398), "Θ") + sb.Replace(ChrW(&H399), "Ι") + sb.Replace(ChrW(&H39A), "Κ") + sb.Replace(ChrW(&H39B), "Λ") + sb.Replace(ChrW(&H39C), "Μ") + sb.Replace(ChrW(&H39D), "Ν") + sb.Replace(ChrW(&H39E), "Ξ") + sb.Replace(ChrW(&H39F), "Ο") + sb.Replace(ChrW(&H3A0), "Π") + sb.Replace(ChrW(&H3A1), "Ρ") + sb.Replace(ChrW(&H3A3), "Σ") + sb.Replace(ChrW(&H3A4), "Τ") + sb.Replace(ChrW(&H3A5), "Υ") + sb.Replace(ChrW(&H3A6), "Φ") + sb.Replace(ChrW(&H3A7), "Χ") + sb.Replace(ChrW(&H3A8), "Ψ") + sb.Replace(ChrW(&H3A9), "Ω") + sb.Replace(ChrW(&H3B1), "α") + sb.Replace(ChrW(&H3B2), "β") + sb.Replace(ChrW(&H3B3), "γ") + sb.Replace(ChrW(&H3B4), "δ") + sb.Replace(ChrW(&H3B5), "ε") + sb.Replace(ChrW(&H3B6), "ζ") + sb.Replace(ChrW(&H3B7), "η") + sb.Replace(ChrW(&H3B8), "θ") + sb.Replace(ChrW(&H3B9), "ι") + sb.Replace(ChrW(&H3BA), "κ") + sb.Replace(ChrW(&H3BB), "λ") + sb.Replace(ChrW(&H3BC), "μ") + sb.Replace(ChrW(&H3BD), "ν") + sb.Replace(ChrW(&H3BE), "ξ") + sb.Replace(ChrW(&H3BF), "ο") + sb.Replace(ChrW(&H3C0), "π") + sb.Replace(ChrW(&H3C1), "ρ") + sb.Replace(ChrW(&H3C2), "ς") + sb.Replace(ChrW(&H3C3), "σ") + sb.Replace(ChrW(&H3C4), "τ") + sb.Replace(ChrW(&H3C5), "υ") + sb.Replace(ChrW(&H3C6), "φ") + sb.Replace(ChrW(&H3C7), "χ") + sb.Replace(ChrW(&H3C8), "ψ") + sb.Replace(ChrW(&H3C9), "ω") + sb.Replace(ChrW(&H3D1), "ϑ") + sb.Replace(ChrW(&H3D2), "ϒ") + sb.Replace(ChrW(&H3D6), "ϖ") + sb.Replace(ChrW(&H2002), " ") + sb.Replace(ChrW(&H2003), " ") + sb.Replace(ChrW(&H2009), " ") + sb.Replace(ChrW(&H200C), "‌") + sb.Replace(ChrW(&H200D), "‍") + sb.Replace(ChrW(&H200E), "‎") + sb.Replace(ChrW(&H200F), "‏") + sb.Replace(ChrW(&H2013), "–") + sb.Replace(ChrW(&H2014), "—") + sb.Replace(ChrW(&H2018), "‘") + sb.Replace(ChrW(&H2019), "’") + sb.Replace(ChrW(&H201A), "‚") + sb.Replace(ChrW(&H201C), "“") + sb.Replace(ChrW(&H201D), "”") + sb.Replace(ChrW(&H201E), "„") + sb.Replace(ChrW(&H2020), "†") + sb.Replace(ChrW(&H2021), "‡") + sb.Replace(ChrW(&H2022), "•") + sb.Replace(ChrW(&H2026), "…") + sb.Replace(ChrW(&H2030), "‰") + sb.Replace(ChrW(&H2032), "′") + sb.Replace(ChrW(&H2033), "″") + sb.Replace(ChrW(&H2039), "‹") + sb.Replace(ChrW(&H203A), "›") + sb.Replace(ChrW(&H203E), "‾") + sb.Replace(ChrW(&H2044), "⁄") + sb.Replace(ChrW(&H20AC), "€") + sb.Replace(ChrW(&H2111), "ℑ") + sb.Replace(ChrW(&H2118), "℘") + sb.Replace(ChrW(&H211C), "ℜ") + sb.Replace(ChrW(&H2122), "™") + sb.Replace(ChrW(&H2135), "ℵ") + sb.Replace(ChrW(&H2190), "←") + sb.Replace(ChrW(&H2191), "↑") + sb.Replace(ChrW(&H2192), "→") + sb.Replace(ChrW(&H2193), "↓") + sb.Replace(ChrW(&H2194), "↔") + sb.Replace(ChrW(&H21B5), "↵") + sb.Replace(ChrW(&H21D0), "⇐") + sb.Replace(ChrW(&H21D1), "⇑") + sb.Replace(ChrW(&H21D2), "⇒") + sb.Replace(ChrW(&H21D3), "⇓") + sb.Replace(ChrW(&H21D4), "⇔") + sb.Replace(ChrW(&H2200), "∀") + sb.Replace(ChrW(&H2202), "∂") + sb.Replace(ChrW(&H2203), "∃") + sb.Replace(ChrW(&H2205), "∅") + sb.Replace(ChrW(&H2207), "∇") + sb.Replace(ChrW(&H2208), "∈") + sb.Replace(ChrW(&H2209), "∉") + sb.Replace(ChrW(&H220B), "∋") + sb.Replace(ChrW(&H220F), "∏") + sb.Replace(ChrW(&H2211), "∑") + sb.Replace(ChrW(&H2212), "−") + sb.Replace(ChrW(&H2217), "∗") + sb.Replace(ChrW(&H221A), "√") + sb.Replace(ChrW(&H221D), "∝") + sb.Replace(ChrW(&H221E), "∞") + sb.Replace(ChrW(&H2220), "∠") + sb.Replace(ChrW(&H2227), "∧") + sb.Replace(ChrW(&H2228), "∨") + sb.Replace(ChrW(&H2229), "∩") + sb.Replace(ChrW(&H222A), "∪") + sb.Replace(ChrW(&H222B), "∫") + sb.Replace(ChrW(&H2234), "∴") + sb.Replace(ChrW(&H223C), "∼") + sb.Replace(ChrW(&H2245), "≅") + sb.Replace(ChrW(&H2248), "≈") + sb.Replace(ChrW(&H2260), "≠") + sb.Replace(ChrW(&H2261), "≡") + sb.Replace(ChrW(&H2264), "≤") + sb.Replace(ChrW(&H2265), "≥") + sb.Replace(ChrW(&H2282), "⊂") + sb.Replace(ChrW(&H2283), "⊃") + sb.Replace(ChrW(&H2284), "⊄") + sb.Replace(ChrW(&H2286), "⊆") + sb.Replace(ChrW(&H2287), "⊇") + sb.Replace(ChrW(&H2295), "⊕") + sb.Replace(ChrW(&H2297), "⊗") + sb.Replace(ChrW(&H22A5), "⊥") + sb.Replace(ChrW(&H22C5), "⋅") + sb.Replace(ChrW(&H2308), "⌈") + sb.Replace(ChrW(&H2309), "⌉") + sb.Replace(ChrW(&H230A), "⌊") + sb.Replace(ChrW(&H230B), "⌋") + sb.Replace(ChrW(&H2329), "⟨") + sb.Replace(ChrW(&H232A), "⟩") + sb.Replace(ChrW(&H25CA), "◊") + sb.Replace(ChrW(&H2660), "♠") + sb.Replace(ChrW(&H2663), "♣") + sb.Replace(ChrW(&H2665), "♥") + sb.Replace(ChrW(&H2666), "♦") + sb.Replace(" ", "  ") + Return sb.ToString() + End Function + + Sub AddTokenizerBaseMacros(ByVal tokenizer As Tokenization.Tokenizer) + + '* + '* Prepares the BBCode Grammar + '* + With tokenizer + .Options = RegexOptions.Singleline Or RegexOptions.IgnoreCase + + '* + '* Define the grammar macros + '* + .AddMacro("h", "[0-9a-f]") + .AddMacro("nl", "\n|\r\n|\r|\f") + .AddMacro("space", "[ \t\r\n\f]+") + .AddMacro("s", "[ \t\r\n\f]*") + .AddMacro("w", "{s}?") + .AddMacro("nonascii", "[\u0080-\uffff]") + .AddMacro("unicode", "\\{h}{1,6}(\r\n|[ \t\r\n\f])?") + .AddMacro("escape", "{unicode}|\\[^\r\n\f0-9a-f]") + .AddMacro("nmstart", "[_a-z]|{nonascii}|{escape}") + .AddMacro("nmchar", "[_a-z0-9-]|{nonascii}|{escape}") + .AddMacro("string1", "\""([^\n\r\f\\""]|\\{nl}|{escape})*\""") + .AddMacro("string2", "\'([^\n\r\f\\']|\\{nl}|{escape})*\'") + .AddMacro("invalid1", "\""([^\n\r\f\\""]|\\{nl}|{escape})*") + .AddMacro("invalid2", "\'([^\n\r\f\\']|\\{nl}|{escape})*") + .AddMacro("name", "{nmchar}+") + .AddMacro("num", "[0-9]+|[0-9]*\.[0-9]+") + .AddMacro("string", "{string1}|{string2}") + .AddMacro("invalid", "{invalid1}|{invalid2}") + .AddMacro("url", "(ftp|https?://)" & _ + "(([0-9a-z_!~*'().&=+$%-]+):([0-9a-z_!~*'().&=+$%-]+@))?" & _ + "(([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-z_!~*'()-]+\.)*([0-9a-z][0-9a-z-]{0,61})?[0-9a-z]\.[a-z]{2,6})" & _ + "(:[0-9]{1,4})?" & _ + "((/[0-9a-z_!~*'().;?:@&=+$,%#-]+)+/?|(/?))") + .AddMacro("mail", "(?:mailto:)?[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,4}") + .AddMacro("value", "{string}|{mail}|{url}|{num}|{name}") + .AddMacro("param", "{name}{w}={w}{value}") + .AddMacro("params", "({space}({param}|{name}))+") + + End With + End Sub + +End Module diff --git a/ThirdParty/BBCode/My Project/Application.Designer.vb b/ThirdParty/BBCode/My Project/Application.Designer.vb new file mode 100644 index 0000000..d73a4d8 --- /dev/null +++ b/ThirdParty/BBCode/My Project/Application.Designer.vb @@ -0,0 +1,13 @@ +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' Runtime Version:2.0.50727.3053 +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + diff --git a/ThirdParty/BBCode/My Project/Application.myapp b/ThirdParty/BBCode/My Project/Application.myapp new file mode 100644 index 0000000..0167050 --- /dev/null +++ b/ThirdParty/BBCode/My Project/Application.myapp @@ -0,0 +1,10 @@ + + + false + false + 0 + true + 0 + 1 + true + diff --git a/ThirdParty/BBCode/My Project/AssemblyInfo.vb b/ThirdParty/BBCode/My Project/AssemblyInfo.vb new file mode 100644 index 0000000..06e3154 --- /dev/null +++ b/ThirdParty/BBCode/My Project/AssemblyInfo.vb @@ -0,0 +1,37 @@ +Imports System +Imports System.Reflection +Imports System.Runtime.InteropServices + +' General Information about an assembly is controlled through the following +' set of attributes. Change these attribute values to modify the information +' associated with an assembly. + +' Review the values of the assembly attributes + + + + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Build and Revision Numbers +' by using the '*' as shown below: +' + + + diff --git a/ThirdParty/BBCode/My Project/Resources.Designer.vb b/ThirdParty/BBCode/My Project/Resources.Designer.vb new file mode 100644 index 0000000..acd2bd6 --- /dev/null +++ b/ThirdParty/BBCode/My Project/Resources.Designer.vb @@ -0,0 +1,90 @@ +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' Runtime Version:2.0.50727.3053 +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + +Imports System + +Namespace My.Resources + + 'This class was auto-generated by the StronglyTypedResourceBuilder + 'class via a tool like ResGen or Visual Studio. + 'To add or remove a member, edit your .ResX file then rerun ResGen + 'with the /str option, or rebuild your VS project. + ''' + ''' A strongly-typed resource class, for looking up localized strings, etc. + ''' + _ + Friend Module Resources + + Private resourceMan As Global.System.Resources.ResourceManager + + Private resourceCulture As Global.System.Globalization.CultureInfo + + ''' + ''' Returns the cached ResourceManager instance used by this class. + ''' + _ + Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager + Get + If Object.ReferenceEquals(resourceMan, Nothing) Then + Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("PJonDevelopment.BBCode.Resources", GetType(Resources).Assembly) + resourceMan = temp + End If + Return resourceMan + End Get + End Property + + ''' + ''' Overrides the current thread's CurrentUICulture property for all + ''' resource lookups using this strongly typed resource class. + ''' + _ + Friend Property Culture() As Global.System.Globalization.CultureInfo + Get + Return resourceCulture + End Get + Set + resourceCulture = value + End Set + End Property + + ''' + ''' Looks up a localized string similar to A circular reference was found.. + ''' + Friend ReadOnly Property CircularReferenceException_Message() As String + Get + Return ResourceManager.GetString("CircularReferenceException_Message", resourceCulture) + End Get + End Property + + ''' + ''' Looks up a localized string similar to The name of a {0} cannot have '{' or '}'.. + ''' + Friend ReadOnly Property Name_ArgumentException_Message() As String + Get + Return ResourceManager.GetString("Name_ArgumentException_Message", resourceCulture) + End Get + End Property + + ''' + ''' Looks up a localized string similar to A referenced macro ({0}) was not found in the collection.. + ''' + Friend ReadOnly Property ReferencedMacroNotFoundException_Message() As String + Get + Return ResourceManager.GetString("ReferencedMacroNotFoundException_Message", resourceCulture) + End Get + End Property + End Module +End Namespace diff --git a/ThirdParty/BBCode/My Project/Resources.resx b/ThirdParty/BBCode/My Project/Resources.resx new file mode 100644 index 0000000..50a2cc9 --- /dev/null +++ b/ThirdParty/BBCode/My Project/Resources.resx @@ -0,0 +1,129 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + A circular reference was found. + + + The name of a {0} cannot have '{' or '}'. + + + A referenced macro ({0}) was not found in the collection. + + \ No newline at end of file diff --git a/ThirdParty/BBCode/My Project/Settings.Designer.vb b/ThirdParty/BBCode/My Project/Settings.Designer.vb new file mode 100644 index 0000000..fed5cfc --- /dev/null +++ b/ThirdParty/BBCode/My Project/Settings.Designer.vb @@ -0,0 +1,73 @@ +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' Runtime Version:2.0.50727.3053 +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + + +Namespace My + + _ + Partial Friend NotInheritable Class MySettings + Inherits Global.System.Configuration.ApplicationSettingsBase + + Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings),MySettings) + +#Region "My.Settings Auto-Save Functionality" +#If _MyType = "WindowsForms" Then + Private Shared addedHandler As Boolean + + Private Shared addedHandlerLockObject As New Object + + _ + Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs) + If My.Application.SaveMySettingsOnExit Then + My.Settings.Save() + End If + End Sub +#End If +#End Region + + Public Shared ReadOnly Property [Default]() As MySettings + Get + +#If _MyType = "WindowsForms" Then + If Not addedHandler Then + SyncLock addedHandlerLockObject + If Not addedHandler Then + AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings + addedHandler = True + End If + End SyncLock + End If +#End If + Return defaultInstance + End Get + End Property + End Class +End Namespace + +Namespace My + + _ + Friend Module MySettingsProperty + + _ + Friend ReadOnly Property Settings() As Global.PJonDevelopment.BBCode.My.MySettings + Get + Return Global.PJonDevelopment.BBCode.My.MySettings.Default + End Get + End Property + End Module +End Namespace diff --git a/ThirdParty/BBCode/My Project/Settings.settings b/ThirdParty/BBCode/My Project/Settings.settings new file mode 100644 index 0000000..377f56d --- /dev/null +++ b/ThirdParty/BBCode/My Project/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/ThirdParty/BBCode/PJonDevelopment.Key.snk b/ThirdParty/BBCode/PJonDevelopment.Key.snk new file mode 100644 index 0000000..4db60ef Binary files /dev/null and b/ThirdParty/BBCode/PJonDevelopment.Key.snk differ