1: /*
2: Copyright (c) 2010 <a href="http://www.gutgames.com">James Craig</a>
3:
4: Permission is hereby granted, free of charge, to any person obtaining a copy
5: of this software and associated documentation files (the "Software"), to deal
6: in the Software without restriction, including without limitation the rights
7: to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8: copies of the Software, and to permit persons to whom the Software is
9: furnished to do so, subject to the following conditions:
10:
11: The above copyright notice and this permission notice shall be included in
12: all copies or substantial portions of the Software.
13:
14: THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15: IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16: FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17: AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18: LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19: OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20: THE SOFTWARE.*/
21:
22: #region Usings
23: using System.Collections.Generic;
24: using System.Text;
25: #endregion
26:
27: namespace Utilities.FileFormats.XMDP
28: {
29: /// <summary>
30: /// Class for holding the individual properties and their
31: /// descriptions.
32: /// </summary>
33: public class Property
34: {
35: #region Constructors
36:
37: /// <summary>
38: /// Constructors
39: /// </summary>
40: public Property()
41: {
42: Properties = new List<Property>();
43: }
44:
45: #endregion
46:
47: #region Properties
48:
49: /// <summary>
50: /// Name of the property
51: /// </summary>
52: public string Name { get; set; }
53:
54: /// <summary>
55: /// Description of the property
56: /// </summary>
57: public string Description { get; set; }
58:
59: /// <summary>
60: /// List of sub properties (only used for rel type when you need to
61: /// define new link types)
62: /// </summary>
63: public List<Property> Properties { get; set; }
64:
65: #endregion
66:
67: #region Overridden Functions
68:
69: public override string ToString()
70: {
71: StringBuilder Builder = new StringBuilder();
72: Builder.Append("<dt id=\"" + Name + "\">" + Name + "</dt>");
73: if (Properties.Count > 0)
74: {
75: Builder.Append("<dd><dl>");
76: foreach (Property Property in Properties)
77: {
78: Builder.Append(Property.ToString());
79: }
80: Builder.Append("</dl></dd>");
81: }
82: else
83: {
84: Builder.Append("<dd>" + Description + "</dd>");
85: }
86: return Builder.ToString();
87: }
88:
89: #endregion
90: }
91: }