📄 jstreenode.vb
字号:
Imports System.Web
Imports System.Text
Imports CsdnV3
Imports CsdnV3.comm
Namespace comm
''' <summary>
''' CSDN导航数的节点
''' </summary>
''' <remarks></remarks>
Public Class jsTreeNode
Inherits TreeNode
Private _childNodesFileName As String
Private _data As String
Private _hasProced As Boolean
Private _hint As String
Private _index As String
Private _jsData As String
Private _text As String
Private _url As String
Public Sub New(ByVal data As String)
Me._hint = ""
Me._index = ""
Me._text = ""
Me._url = ""
Me._data = ""
Me._childNodesFileName = ""
Me.jsData = data
End Sub
Private Function utf8(ByVal utf8code As String) As String
Return HttpUtility.UrlDecode(utf8code, Encoding.UTF8)
End Function
Public ReadOnly Property url() As String
Get
Return Me._url
End Get
End Property
Public ReadOnly Property StrText() As String
Get
Return Me._text
End Get
End Property
Public Property jsData() As String
Get
Return Me._jsData
End Get
Set(ByVal value As String)
Me._jsData = value
Me.init()
End Set
End Property
Public ReadOnly Property StrIndex() As String
Get
Return Me._index
End Get
End Property
Public ReadOnly Property hint() As String
Get
Return Me._hint
End Get
End Property
''' <summary>
''' 当前节点是否被加载完毕了
''' </summary>
''' <value></value>
''' <returns></returns>
''' <remarks></remarks>
Public Property HasProced() As Boolean
Get
Return Me._hasProced
End Get
Set(ByVal value As Boolean)
Me._hasProced = value
End Set
End Property
''' <summary>
''' 数据
''' </summary>
''' <value></value>
''' <returns></returns>
''' <remarks></remarks>
Public ReadOnly Property data() As String
Get
Return Me._data
End Get
End Property
''' <summary>
''' 下级节点的Js文件名
''' </summary>
''' <value></value>
''' <returns></returns>
''' <remarks></remarks>
Public ReadOnly Property childNodesFileName() As String
Get
Return Me._childNodesFileName
End Get
End Property
''' <summary>
''' 解析当前节点的数据
''' </summary>
''' <remarks></remarks>
Private Sub init()
Me._index = RegMatch.Match("tree.nodes\['(?<ID>[\d+_\d+]+)'\]", _jsData, "ID")
Dim data As String = RegMatch.Match("'(?<data>[^\']+)';", Me._jsData, "data")
data = data.Replace(" ", "")
Dim keys As String() = data.Split(";")
'Dim textArray2 As String() = keys
Dim i As Integer = 0
Do While i < keys.Length
Dim Key As String = keys(i)
Dim value As String = Right(Key, Key.Length - Key.IndexOf(":") - 1).Trim
If Key.StartsWith("childNodesFileName") Then
Me._childNodesFileName = Me.utf8(value)
Me.ImageIndex = 1
End If
If Key.StartsWith("data") Then
Me._data = Me.utf8(value)
End If
If Key.StartsWith("text") Then
Me._text = Me.utf8(value)
End If
If Key.StartsWith("url") Then
Me._url = Me.utf8(value)
End If
If Key.StartsWith("hint") Then
Me._hint = Me.utf8(value)
End If
i += 1
Loop
MyBase.Text = Me.StrText
End Sub
End Class
End Namespace
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -