FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
STNodeEditor/ST.Library.UI/NodeEditor/STNodeAttribute.cs at main · DebugST/STNodeEditor · GitHub
DebugST
/
STNodeEditor
Public
Notifications
You must be signed in to change notification settings
Fork
249
Star
886
Code
Issues
22
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
STNodeEditor
/
ST.Library.UI
/
NodeEditor
/
STNodeAttribute.cs
Copy path
More file actions
More file actions
Latest commit
History
History
History
121 lines (112 loc) · 4.27 KB
Breadcrumbs
STNodeEditor
/
ST.Library.UI
/
NodeEditor
/
STNodeAttribute.cs
Copy path
File metadata and controls
121 lines (112 loc) · 4.27 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
using
System
;
using
System
.
Collections
.
Generic
;
using
System
.
Linq
;
using
System
.
Text
;
using
System
.
Reflection
;
using
System
.
Text
.
RegularExpressions
;
namespace
ST
.
Library
.
UI
.
NodeEditor
{
/// <summary>
/// STNode节点特性
/// 用于描述STNode开发者信息 以及部分行为
/// </summary>
public
class
STNodeAttribute
:
Attribute
{
private
string
_Path
;
/// <summary>
/// 获取STNode节点期望在树形控件的路径
/// </summary>
public
string
Path
{
get
{
return
_Path
;
}
}
private
string
_Author
;
/// <summary>
/// 获取STNode节点的作者名称
/// </summary>
public
string
Author
{
get
{
return
_Author
;
}
}
private
string
_Mail
;
/// <summary>
/// 获取STNode节点的作者邮箱
/// </summary>
public
string
Mail
{
get
{
return
_Mail
;
}
}
private
string
_Link
;
/// <summary>
/// 获取STNode节点的作者链接
/// </summary>
public
string
Link
{
get
{
return
_Link
;
}
}
private
string
_Description
;
/// <summary>
/// 获取STNode节点的描述信息
/// </summary>
public
string
Description
{
get
{
return
_Description
;
}
}
private
static
char
[
]
m_ch_splitter
=
new
char
[
]
{
'/'
,
'
\\
'
}
;
private
static
Regex
m_reg
=
new
Regex
(
@"^https?://"
,
RegexOptions
.
IgnoreCase
)
;
/// <summary>
/// 构造一个STNode特性
/// </summary>
/// <param name="strPath">期望路径</param>
public
STNodeAttribute
(
string
strPath
)
:
this
(
strPath
,
null
,
null
,
null
,
null
)
{
}
/// <summary>
/// 构造一个STNode特性
/// </summary>
/// <param name="strPath">期望路径</param>
/// <param name="strDescription">描述信息</param>
public
STNodeAttribute
(
string
strPath
,
string
strDescription
)
:
this
(
strPath
,
null
,
null
,
null
,
strDescription
)
{
}
/// <summary>
/// 构造一个STNode特性
/// </summary>
/// <param name="strPath">期望路径</param>
/// <param name="strAuthor">STNode作者名称</param>
/// <param name="strMail">STNode作者邮箱</param>
/// <param name="strLink">STNode作者链接</param>
/// <param name="strDescription">STNode节点描述信息</param>
public
STNodeAttribute
(
string
strPath
,
string
strAuthor
,
string
strMail
,
string
strLink
,
string
strDescription
)
{
if
(
!
string
.
IsNullOrEmpty
(
strPath
)
)
strPath
=
strPath
.
Trim
(
)
.
Trim
(
m_ch_splitter
)
.
Trim
(
)
;
this
.
_Path
=
strPath
;
this
.
_Author
=
strAuthor
;
this
.
_Mail
=
strMail
;
this
.
_Description
=
strDescription
;
if
(
string
.
IsNullOrEmpty
(
strLink
)
||
strLink
.
Trim
(
)
==
string
.
Empty
)
return
;
strLink
=
strLink
.
Trim
(
)
;
if
(
m_reg
.
IsMatch
(
strLink
)
)
this
.
_Link
=
strLink
;
else
this
.
_Link
=
"http://"
+
strLink
;
}
private
static
Dictionary
<
Type
,
MethodInfo
>
m_dic
=
new
Dictionary
<
Type
,
MethodInfo
>
(
)
;
/// <summary>
/// 获取类型的帮助函数
/// </summary>
/// <param name="stNodeType">节点类型</param>
/// <returns>函数信息</returns>
public
static
MethodInfo
GetHelpMethod
(
Type
stNodeType
)
{
if
(
m_dic
.
ContainsKey
(
stNodeType
)
)
return
m_dic
[
stNodeType
]
;
var
mi
=
stNodeType
.
GetMethod
(
"ShowHelpInfo"
)
;
if
(
mi
==
null
)
return
null
;
if
(
!
mi
.
IsStatic
)
return
null
;
var
ps
=
mi
.
GetParameters
(
)
;
if
(
ps
.
Length
!=
1
)
return
null
;
if
(
ps
[
0
]
.
ParameterType
!=
typeof
(
string
)
)
return
null
;
m_dic
.
Add
(
stNodeType
,
mi
)
;
return
mi
;
}
/// <summary>
/// 执行对应节点类型的帮助函数
/// </summary>
/// <param name="stNodeType">节点类型</param>
public
static
void
ShowHelp
(
Type
stNodeType
)
{
var
mi
=
STNodeAttribute
.
GetHelpMethod
(
stNodeType
)
;
if
(
mi
==
null
)
return
;
mi
.
Invoke
(
null
,
new
object
[
]
{
stNodeType
.
Module
.
FullyQualifiedName
}
)
;
}
}
}
Back
|
FazBrowse Home
|
New Git URL