| 1 |
#Region "Microsoft.VisualBasic::2d59ebd95f37f0df7d1cbc8d957319a0, Microsoft.VisualBasic.Core\ApplicationServices\VBDev\XmlDoc\ProjectType.vb"
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
|
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
#End Region
|
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
|
| 53 |
|
| 54 |
Imports System.Runtime.CompilerServices
|
| 55 |
Imports System.Xml
|
| 56 |
Imports Microsoft.VisualBasic.ApplicationServices.Development.XmlDoc.Serialization
|
| 57 |
Imports Microsoft.VisualBasic.Text
|
| 58 |
Imports Microsoft.VisualBasic.Linq
|
| 59 |
|
| 60 |
Namespace ApplicationServices.Development.XmlDoc.Assembly
|
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
|
| 65 |
|
| 66 |
|
| 67 |
|
| 68 |
Public Class ProjectType
|
| 69 |
|
| 70 |
Protected projectNamespace As ProjectNamespace
|
| 71 |
|
| 72 |
Protected fields As Dictionary(Of String, ProjectMember)
|
| 73 |
Protected events As Dictionary(Of String, ProjectMember)
|
| 74 |
|
| 75 |
|
| 76 |
|
| 77 |
|
| 78 |
Protected Friend properties As Dictionary(Of String, List(Of ProjectMember))
|
| 79 |
|
| 80 |
|
| 81 |
|
| 82 |
Protected Friend methods As Dictionary(Of String, List(Of ProjectMember))
|
| 83 |
|
| 84 |
Public ReadOnly Property [Namespace]() As ProjectNamespace
|
| 85 |
<MethodImpl(MethodImplOptions.AggressiveInlining)>
|
| 86 |
Get
|
| 87 |
Return Me.projectNamespace
|
| 88 |
End Get
|
| 89 |
End Property
|
| 90 |
|
| 91 |
Public Property Name As String
|
| 92 |
Public Property Summary As String
|
| 93 |
Public Property Remarks As String
|
| 94 |
|
| 95 |
Friend Sub New()
|
| 96 |
properties = New Dictionary(Of String, List(Of ProjectMember))
|
| 97 |
methods = New Dictionary(Of String, List(Of ProjectMember))
|
| 98 |
End Sub
|
| 99 |
|
| 100 |
Public Sub New(projectNamespace As ProjectNamespace)
|
| 101 |
Me.projectNamespace = projectNamespace
|
| 102 |
|
| 103 |
Me.fields = New Dictionary(Of String, ProjectMember)()
|
| 104 |
Me.properties = New Dictionary(Of String, List(Of ProjectMember))()
|
| 105 |
Me.methods = New Dictionary(Of String, List(Of ProjectMember))()
|
| 106 |
Me.events = New Dictionary(Of String, ProjectMember)
|
| 107 |
End Sub
|
| 108 |
|
| 109 |
Protected Sub New(type As ProjectType)
|
| 110 |
projectNamespace = type.projectNamespace
|
| 111 |
events = type.events
|
| 112 |
fields = type.fields
|
| 113 |
properties = type.properties
|
| 114 |
methods = type.methods
|
| 115 |
Name = type.Name
|
| 116 |
Summary = type.Summary
|
| 117 |
Remarks = type.Remarks
|
| 118 |
End Sub
|
| 119 |
|
| 120 |
Friend Sub New(t1 As ProjectType, t2 As ProjectType)
|
| 121 |
projectNamespace = t1.projectNamespace
|
| 122 |
fields = (t1.fields.Values.AsList + t2.fields.Values).GroupBy(Function(f) f.Name.ToLower).ToDictionary(Function(g) g.Key, Function(g) g.Sum(Me))
|
| 123 |
events = (t1.events.Values.AsList + t2.events.Values).GroupBy(Function(f) f.Name.ToLower).ToDictionary(Function(g) g.Key, Function(g) g.Sum(Me))
|
| 124 |
properties = (t1.properties.Values.AsList + t2.properties.Values).IteratesALL.GroupBy(Function(f) f.Name.ToLower).ToDictionary(Function(g) g.Key, Function(g) g.ToList)
|
| 125 |
methods = (t1.methods.Values.AsList + t2.methods.Values).IteratesALL.GroupBy(Function(f) f.Name.ToLower).ToDictionary(Function(g) g.Key, Function(g) g.ToList)
|
| 126 |
End Sub
|
| 127 |
|
| 128 |
Public Overrides Function ToString() As String
|
| 129 |
Return Name
|
| 130 |
End Function
|
| 131 |
|
| 132 |
<MethodImpl(MethodImplOptions.AggressiveInlining)>
|
| 133 |
Public Function GetMethods(methodName As String) As List(Of ProjectMember)
|
| 134 |
Return getInternal(methods, methodName.ToLower)
|
| 135 |
End Function
|
| 136 |
|
| 137 |
Public Function EnsureMethod(methodName As String) As ProjectMember
|
| 138 |
Dim pmlist As List(Of ProjectMember) = Me.GetMethods(methodName)
|
| 139 |
Dim pm As New ProjectMember(Me) With {
|
| 140 |
.Name = methodName
|
| 141 |
}
|
| 142 |
|
| 143 |
Call pmlist.Add(pm)
|
| 144 |
|
| 145 |
Return pm
|
| 146 |
End Function
|
| 147 |
|
| 148 |
Private Shared Function getInternal(ByRef table As Dictionary(Of String, List(Of ProjectMember)), name$) As List(Of ProjectMember)
|
| 149 |
If table.ContainsKey(name) Then
|
| 150 |
Return table(name)
|
| 151 |
Else
|
| 152 |
Dim list As New List(Of ProjectMember)
|
| 153 |
table.Add(name, list)
|
| 154 |
Return list
|
| 155 |
End If
|
| 156 |
End Function
|
| 157 |
|
| 158 |
<MethodImpl(MethodImplOptions.AggressiveInlining)>
|
| 159 |
Public Function GetProperties(propertyName As String) As List(Of ProjectMember)
|
| 160 |
Return getInternal(properties, propertyName.ToLower)
|
| 161 |
End Function
|
| 162 |
|
| 163 |
Public Function EnsureProperty(propertyName As String) As ProjectMember
|
| 164 |
Dim pmlist As List(Of ProjectMember) = Me.GetProperties(propertyName)
|
| 165 |
Dim pm As New ProjectMember(Me) With {
|
| 166 |
.Name = propertyName
|
| 167 |
}
|
| 168 |
|
| 169 |
Call pmlist.Add(pm)
|
| 170 |
|
| 171 |
Return pm
|
| 172 |
End Function
|
| 173 |
|
| 174 |
Public Function GetField(fieldName As String) As ProjectMember
|
| 175 |
If Me.fields.ContainsKey(fieldName.ToLower()) Then
|
| 176 |
Return Me.fields(fieldName.ToLower())
|
| 177 |
End If
|
| 178 |
|
| 179 |
Return Nothing
|
| 180 |
End Function
|
| 181 |
|
| 182 |
Public Function EnsureField(fieldName As String) As ProjectMember
|
| 183 |
Dim pm As ProjectMember = Me.GetField(fieldName)
|
| 184 |
|
| 185 |
If pm Is Nothing Then
|
| 186 |
pm = New ProjectMember(Me) With {
|
| 187 |
.Name = fieldName
|
| 188 |
}
|
| 189 |
|
| 190 |
Me.fields.Add(fieldName.ToLower(), pm)
|
| 191 |
End If
|
| 192 |
|
| 193 |
Return pm
|
| 194 |
End Function
|
| 195 |
|
| 196 |
Public Function GetEvent(eventName As String) As ProjectMember
|
| 197 |
If Me.events.ContainsKey(eventName.ToLower()) Then
|
| 198 |
Return Me.events(eventName.ToLower())
|
| 199 |
End If
|
| 200 |
|
| 201 |
Return Nothing
|
| 202 |
End Function
|
| 203 |
|
| 204 |
Public Function EnsureEvent(eventName As String) As ProjectMember
|
| 205 |
Dim pm As ProjectMember = Me.GetField(eventName)
|
| 206 |
|
| 207 |
If pm Is Nothing Then
|
| 208 |
pm = New ProjectMember(Me) With {
|
| 209 |
.Name = eventName
|
| 210 |
}
|
| 211 |
|
| 212 |
Me.fields.Add(eventName.ToLower(), pm)
|
| 213 |
End If
|
| 214 |
|
| 215 |
Return pm
|
| 216 |
End Function
|
| 217 |
|
| 218 |
Public Sub LoadFromNode(xn As XmlNode)
|
| 219 |
Dim summaryNode As XmlNode = xn.SelectSingleNode("summary")
|
| 220 |
|
| 221 |
If summaryNode IsNot Nothing Then
|
| 222 |
Me.Summary = summaryNode.InnerText.Trim(ASCII.CR, ASCII.LF, " ")
|
| 223 |
End If
|
| 224 |
|
| 225 |
summaryNode = xn.SelectSingleNode("remarks")
|
| 226 |
|
| 227 |
If Not summaryNode Is Nothing Then
|
| 228 |
Remarks = summaryNode.InnerText.Trim(ASCII.CR, ASCII.LF, " ")
|
| 229 |
End If
|
| 230 |
End Sub
|
| 231 |
End Class
|
| 232 |
End Namespace
|