1 #Region "Microsoft.VisualBasic::171f5f20ae2ccad05fe81daa144106f7, Microsoft.VisualBasic.Core\CommandLine\Reflection\Attributes\[Namespace].vb"
2
3     ' Author:
4     
5     '       asuka (amethyst.asuka@gcmodeller.org)
6     '       xie (genetics@smrucc.org)
7     '       xieguigang (xie.guigang@live.com)
8     
9     ' Copyright (c) 2018 GPL3 Licensed
10     
11     
12     ' GNU GENERAL PUBLIC LICENSE (GPL3)
13     
14     
15     ' This program is free software: you can redistribute it and/or modify
16     ' it under the terms of the GNU General Public License as published by
17     ' the Free Software Foundation, either version 3 of the License, or
18     ' (at your option) any later version.
19     
20     ' This program is distributed in the hope that it will be useful,
21     ' but WITHOUT ANY WARRANTY; without even the implied warranty of
22     ' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
23     ' GNU General Public License for more details.
24     
25     ' You should have received a copy of the GNU General Public License
26     ' along with this program. If not, see <http://www.gnu.org/licenses/>.
27
28
29
30     ' /********************************************************************************/
31
32     ' Summaries:
33
34     '     Class [Namespace]
35     
36     '         Properties: [Namespace], AutoExtract, Description, TypeInfo
37     
38     '         Constructor: (+3 OverloadsSub New
39     '         Function: CreateInstance, ToString
40     
41     
42     ' /********************************************************************************/
43
44 #End Region
45
46 Imports System.Reflection
47 Imports System.Text
48 Imports System.Xml.Serialization
49 Imports Microsoft.VisualBasic.ComponentModel.Collection.Generic
50 Imports Microsoft.VisualBasic.Scripting.MetaData
51
52 Namespace CommandLine.Reflection
53
54     ''' <summary>
55     ''' (<see cref="Microsoft.VisualBasic.CommandLine.Interpreter">CommandLine interpreter</see> executation Entry and the ShellScript software packages namespace.)这是一个命令行解释器所使用的执行入口点的集合
56     ''' </summary>
57     ''' <remarks></remarks>
58     <AttributeUsage(AttributeTargets.Class, AllowMultiple:=False, Inherited:=True)>
59     Public Class [Namespace] : Inherits Attribute
60         Implements INamedValue
61
62         ''' <summary>
63         ''' A brief description text about the function of this namespace.(关于本模块之中的描述性的摘要文本)
64         ''' </summary>
65         ''' <value></value>
66         ''' <returns></returns>
67         ''' <remarks></remarks>
68         Public Property Description As String
69
70         ''' <summary>
71         ''' The name value of this namespace module.(本命名空间模块的名称值)
72         ''' </summary>
73         ''' <value></value>
74         ''' <returns></returns>
75         ''' <remarks></remarks>
76         <XmlAttribute>
77         Public Property [Namespace] As String Implements INamedValue.Key
78
79         Dim _TypeAutoExtract As Boolean
80
81         ''' <summary>
82         ''' Readonly
83         ''' </summary>
84         ''' <returns></returns>
85         <XmlIgnore> Public Property AutoExtract As Boolean
86             Get
87                 Return _TypeAutoExtract
88             End Get
89             Protected Set(value As Boolean)
90                 _TypeAutoExtract = value
91             End Set
92         End Property
93
94         ''' <summary>
95         ''' The name value of this namespace module.(本命名空间模块的名称值)
96         ''' </summary>
97         ''' <param name="Namespace">The name value of this namespace module.(本命名空间模块的名称值)</param>
98         ''' <remarks></remarks>
99         Sub New([Namespace] As StringOptional Description As String = "")
100             Me._Namespace = [Namespace]
101             Me._Description = Description
102             Me._TypeAutoExtract = False
103         End Sub
104
105         Protected Sub New()
106         End Sub
107
108         Friend Sub New([Namespace] As String, Description As String, auto As Boolean)
109             Call Me.New([Namespace], Description)
110             Me.AutoExtract = auto
111         End Sub
112
113         ''' <summary>
114         ''' Constant of type information for the reflection
115         ''' </summary>
116         ''' <returns></returns>
117         Public Shared ReadOnly Property TypeInfo As System.Type = GetType([Namespace])
118
119         Public Overrides Function ToString() As String
120             If String.IsNullOrEmpty(Description) Then
121                 Return String.Format("Namespace {0}", [Namespace])
122             Else
123                 Return String.Format("Namespace {0} ({1})", [Namespace], Description)
124             End If
125         End Function
126
127         ''' <summary>
128         ''' 从目标类型之中构造出一个命令行解释器
129         ''' </summary>
130         ''' <param name="Type"></param>
131         ''' <returns></returns>
132         ''' <remarks></remarks>
133         Public Shared Function CreateInstance(Type As Type) As Interpreter
134             Return New Interpreter(Type)
135         End Function
136     End Class
137 End Namespace