opensim-development – Blame information for rev 1

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 eva 1 #region BSD License
2 /*
3 Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com)
4  
5 Redistribution and use in source and binary forms, with or without modification, are permitted
6 provided that the following conditions are met:
7  
8 * Redistributions of source code must retain the above copyright notice, this list of conditions
9 and the following disclaimer.
10 * Redistributions in binary form must reproduce the above copyright notice, this list of conditions
11 and the following disclaimer in the documentation and/or other materials provided with the
12 distribution.
13 * The name of the author may not be used to endorse or promote products derived from this software
14 without specific prior written permission.
15  
16 THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
17 BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21 OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
22 IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 */
24 #endregion
25  
26 using System;
27 using System.Xml;
28  
29 using Prebuild.Core.Attributes;
30 using Prebuild.Core.Interfaces;
31 using Prebuild.Core.Utilities;
32  
33 namespace Prebuild.Core.Nodes
34 {
35 /// <summary>
36 ///
37 /// </summary>
38 [DataNode("Reference")]
39 public class ReferenceNode : DataNode, IComparable
40 {
41 #region Fields
42  
43 private string m_Name = "unknown";
44 private string m_Path;
45 private string m_LocalCopy;
46 private string m_Version;
47  
48 #endregion
49  
50 #region Properties
51  
52 /// <summary>
53 /// Gets the name.
54 /// </summary>
55 /// <value>The name.</value>
56 public string Name
57 {
58 get
59 {
60 return m_Name;
61 }
62 }
63  
64 /// <summary>
65 /// Gets the path.
66 /// </summary>
67 /// <value>The path.</value>
68 public string Path
69 {
70 get
71 {
72 return m_Path;
73 }
74 }
75  
76 /// <summary>
77 /// Gets a value indicating whether [local copy specified].
78 /// </summary>
79 /// <value><c>true</c> if [local copy specified]; otherwise, <c>false</c>.</value>
80 public bool LocalCopySpecified
81 {
82 get
83 {
84 return ( m_LocalCopy != null && m_LocalCopy.Length == 0);
85 }
86 }
87  
88 /// <summary>
89 /// Gets a value indicating whether [local copy].
90 /// </summary>
91 /// <value><c>true</c> if [local copy]; otherwise, <c>false</c>.</value>
92 public bool LocalCopy
93 {
94 get
95 {
96 if( m_LocalCopy == null)
97 {
98 return false;
99 }
100 return bool.Parse(m_LocalCopy);
101 }
102 }
103  
104 /// <summary>
105 /// Gets the version.
106 /// </summary>
107 /// <value>The version.</value>
108 public string Version
109 {
110 get
111 {
112 return m_Version;
113 }
114 }
115  
116 #endregion
117  
118 #region Public Methods
119  
120 /// <summary>
121 /// Parses the specified node.
122 /// </summary>
123 /// <param name="node">The node.</param>
124 public override void Parse(XmlNode node)
125 {
126 m_Name = Helper.AttributeValue(node, "name", m_Name);
127 m_Path = Helper.AttributeValue(node, "path", m_Path);
128 m_LocalCopy = Helper.AttributeValue(node, "localCopy", m_LocalCopy);
129 m_Version = Helper.AttributeValue(node, "version", m_Version);
130 }
131  
132 #endregion
133  
134 #region IComparable Members
135  
136 public int CompareTo(object obj)
137 {
138 ReferenceNode that = (ReferenceNode)obj;
139 return this.m_Name.CompareTo(that.m_Name);
140 }
141  
142 #endregion
143 }
144 }