opensim – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | eva | 1 | using System; |
2 | using System.Collections.Generic; |
||
3 | using System.Text; |
||
4 | using System.Xml; |
||
5 | |||
6 | using Prebuild.Core.Attributes; |
||
7 | using Prebuild.Core.Interfaces; |
||
8 | using Prebuild.Core.Utilities; |
||
9 | |||
10 | namespace Prebuild.Core.Nodes |
||
11 | { |
||
12 | [DataNode("DatabaseProject")] |
||
13 | public class DatabaseProjectNode : DataNode |
||
14 | { |
||
15 | string name; |
||
16 | string path; |
||
17 | string fullpath; |
||
18 | Guid guid = Guid.NewGuid(); |
||
19 | readonly List<AuthorNode> authors = new List<AuthorNode>(); |
||
20 | readonly List<DatabaseReferenceNode> references = new List<DatabaseReferenceNode>(); |
||
21 | |||
22 | public Guid Guid |
||
23 | { |
||
24 | get { return guid; } |
||
25 | } |
||
26 | |||
27 | public string Name |
||
28 | { |
||
29 | get { return name; } |
||
30 | } |
||
31 | |||
32 | public string Path |
||
33 | { |
||
34 | get { return path; } |
||
35 | } |
||
36 | |||
37 | public string FullPath |
||
38 | { |
||
39 | get { return fullpath; } |
||
40 | } |
||
41 | |||
42 | public IEnumerable<DatabaseReferenceNode> References |
||
43 | { |
||
44 | get { return references; } |
||
45 | } |
||
46 | |||
47 | public override void Parse(XmlNode node) |
||
48 | { |
||
49 | name = Helper.AttributeValue(node, "name", name); |
||
50 | path = Helper.AttributeValue(node, "path", name); |
||
51 | |||
52 | try |
||
53 | { |
||
54 | fullpath = Helper.ResolvePath(path); |
||
55 | } |
||
56 | catch |
||
57 | { |
||
58 | throw new WarningException("Could not resolve Solution path: {0}", path); |
||
59 | } |
||
60 | |||
61 | Kernel.Instance.CurrentWorkingDirectory.Push(); |
||
62 | |||
63 | try |
||
64 | { |
||
65 | Helper.SetCurrentDir(fullpath); |
||
66 | |||
67 | if (node == null) |
||
68 | { |
||
69 | throw new ArgumentNullException("node"); |
||
70 | } |
||
71 | |||
72 | foreach (XmlNode child in node.ChildNodes) |
||
73 | { |
||
74 | IDataNode dataNode = Kernel.Instance.ParseNode(child, this); |
||
75 | |||
76 | if (dataNode == null) |
||
77 | continue; |
||
78 | |||
79 | if (dataNode is AuthorNode) |
||
80 | authors.Add((AuthorNode)dataNode); |
||
81 | else if (dataNode is DatabaseReferenceNode) |
||
82 | references.Add((DatabaseReferenceNode)dataNode); |
||
83 | } |
||
84 | } |
||
85 | finally |
||
86 | { |
||
87 | Kernel.Instance.CurrentWorkingDirectory.Pop(); |
||
88 | } |
||
89 | |||
90 | base.Parse(node); |
||
91 | } |
||
92 | } |
||
93 | } |