1 | using System;
|
---|
2 |
|
---|
3 | namespace Netron.Diagramming.Core {
|
---|
4 | /// <summary>
|
---|
5 | /// Abstract base class for the attributes related to serialization
|
---|
6 | /// </summary>
|
---|
7 | public abstract class BaseAttribute : System.Attribute {
|
---|
8 | #region Fields
|
---|
9 | /// <summary>
|
---|
10 | /// the key of the shape, usually a GUID
|
---|
11 | /// </summary>
|
---|
12 | protected string mKey;
|
---|
13 | /// <summary>
|
---|
14 | /// the name of the shape
|
---|
15 | /// </summary>
|
---|
16 | protected string mName;
|
---|
17 | /// <summary>
|
---|
18 | /// a description
|
---|
19 | /// </summary>
|
---|
20 | protected string mDescription = "No description available.";
|
---|
21 | /// <summary>
|
---|
22 | /// whether the shape is only accessible via code or internally
|
---|
23 | /// </summary>
|
---|
24 | protected bool mIsInternal;
|
---|
25 | #endregion
|
---|
26 |
|
---|
27 | #region Properties
|
---|
28 |
|
---|
29 | /// <summary>
|
---|
30 | /// Gets a mDescription of the shape
|
---|
31 | /// </summary>
|
---|
32 | public string Description {
|
---|
33 | get { return mDescription; }
|
---|
34 | }
|
---|
35 | /// <summary>
|
---|
36 | /// Gets the unique identifier of the shape
|
---|
37 | /// </summary>
|
---|
38 | public string Key {
|
---|
39 | get { return mKey; }
|
---|
40 | }
|
---|
41 | /// <summary>
|
---|
42 | /// Gets the shape name
|
---|
43 | /// </summary>
|
---|
44 | public string Name {
|
---|
45 | get { return mName; }
|
---|
46 | }
|
---|
47 | /// <summary>
|
---|
48 | /// Gets whether the entity is available via the interface or false if only via code
|
---|
49 | /// </summary>
|
---|
50 | public bool IsInternal {
|
---|
51 | get { return mIsInternal; }
|
---|
52 | }
|
---|
53 | #endregion
|
---|
54 | }
|
---|
55 | /// <summary>
|
---|
56 | /// Attribute to tag a class as a diagram shape
|
---|
57 | /// </summary>
|
---|
58 | [Serializable, AttributeUsage(AttributeTargets.Class)]
|
---|
59 | public class ShapeAttribute : BaseAttribute {
|
---|
60 | #region Fields
|
---|
61 |
|
---|
62 | /// <summary>
|
---|
63 | /// the cateogry under which it will stay
|
---|
64 | /// </summary>
|
---|
65 | protected string mCategory;
|
---|
66 |
|
---|
67 | #endregion
|
---|
68 |
|
---|
69 | #region Properties
|
---|
70 |
|
---|
71 | /// <summary>
|
---|
72 | /// Gets the category of the shape under which it will reside in a viewer
|
---|
73 | /// </summary>
|
---|
74 | public string Category {
|
---|
75 | get { return mCategory; }
|
---|
76 |
|
---|
77 | }
|
---|
78 | #endregion
|
---|
79 |
|
---|
80 | #region Constructor
|
---|
81 | /// <summary>
|
---|
82 | /// Constructor, marks a class as a shape-class for the Netron graph library
|
---|
83 | /// </summary>
|
---|
84 | /// <param name="mShapeName"></param>
|
---|
85 | /// <param name="mShapeKey"></param>
|
---|
86 | /// <param name="mCategory"></param>
|
---|
87 | /// <param name="reflectionName"></param>
|
---|
88 | public ShapeAttribute(
|
---|
89 | string shapeName,
|
---|
90 | string shapeKey,
|
---|
91 | string category) {
|
---|
92 | this.mName = shapeName;
|
---|
93 | this.mKey = shapeKey;
|
---|
94 | this.mCategory = category;
|
---|
95 | }
|
---|
96 | /// <summary>
|
---|
97 | /// Constructor, marks a class as a shape-class for the Netron graph library
|
---|
98 | /// </summary>
|
---|
99 | /// <param name="mShapeName"></param>
|
---|
100 | /// <param name="mShapeKey"></param>
|
---|
101 | /// <param name="mCategory"></param>
|
---|
102 | /// <param name="reflectionName"></param>
|
---|
103 | /// <param name="mDescription"></param>
|
---|
104 | public ShapeAttribute(
|
---|
105 | string shapeName,
|
---|
106 | string shapeKey,
|
---|
107 | string category,
|
---|
108 | string description) :
|
---|
109 | this(shapeName, shapeKey, category) {
|
---|
110 | this.mDescription = description;
|
---|
111 | }
|
---|
112 | /// <summary>
|
---|
113 | /// Constructor, marks a class as a shape-class for the Netron graph library
|
---|
114 | /// </summary>
|
---|
115 | /// <param name="mShapeName"></param>
|
---|
116 | /// <param name="mShapeKey"></param>
|
---|
117 | /// <param name="mCategory"></param>
|
---|
118 | /// <param name="reflectionName"></param>
|
---|
119 | /// <param name="mDescription"></param>
|
---|
120 | /// <param name="internalUsage"></param>
|
---|
121 | public ShapeAttribute(
|
---|
122 | string shapeName,
|
---|
123 | string shapeKey,
|
---|
124 | string category,
|
---|
125 | string description,
|
---|
126 | bool internalUsage) :
|
---|
127 | this(shapeName, shapeKey, category, description) {
|
---|
128 | this.mIsInternal = internalUsage;
|
---|
129 | }
|
---|
130 | #endregion
|
---|
131 |
|
---|
132 | #region Methods
|
---|
133 |
|
---|
134 |
|
---|
135 | #endregion
|
---|
136 | }
|
---|
137 |
|
---|
138 | /// <summary>
|
---|
139 | /// Attribute to tag a class as a Netron connection
|
---|
140 | /// </summary>
|
---|
141 | [Serializable]
|
---|
142 | public class ConnectionAttribute : BaseAttribute {
|
---|
143 | #region Fields
|
---|
144 |
|
---|
145 |
|
---|
146 | #endregion
|
---|
147 |
|
---|
148 | #region Properties
|
---|
149 |
|
---|
150 |
|
---|
151 | #endregion
|
---|
152 |
|
---|
153 | #region Constructor
|
---|
154 |
|
---|
155 | /// <summary>
|
---|
156 | /// Constructor
|
---|
157 | /// </summary>
|
---|
158 | /// <param name="connectionName"></param>
|
---|
159 | /// <param name="key"></param>
|
---|
160 | /// <param name="reflectionName"></param>
|
---|
161 | public ConnectionAttribute(string connectionName, string key) {
|
---|
162 | this.mKey = key;
|
---|
163 | this.mName = connectionName;
|
---|
164 | }
|
---|
165 |
|
---|
166 | #endregion
|
---|
167 |
|
---|
168 | #region Methods
|
---|
169 |
|
---|
170 |
|
---|
171 | #endregion
|
---|
172 | }
|
---|
173 | }
|
---|