-
Notifications
You must be signed in to change notification settings - Fork 37
/
Copy pathJenkinsNode.cs
62 lines (57 loc) · 1.55 KB
/
JenkinsNode.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
using System.Diagnostics;
using System.Xml.Linq;
using System.Xml.XPath;
using JenkinsNET.Internal;
namespace JenkinsNET.Models
{
public class JenkinsNode
{
/// <summary>
/// Gets the base XML node.
/// </summary>
public XElement Node { get; }
private string name;
private bool nameCached = false;
public string Name
{
get
{
if (nameCached) return name;
var node = Node.XPathSelectElement("./displayName");
name = node?.Value;
nameCached = true;
return name;
}
}
private string description;
private bool descriptionCached = false;
public string Description
{
get
{
if (descriptionCached) return description;
var node = Node.XPathSelectElement("./description");
description = node?.Value;
descriptionCached = true;
return description;
}
}
private bool online;
private bool onlineCached;
public bool Online
{
get
{
if (onlineCached) return online;
var node = Node.XPathSelectElement("./offline");
online = node?.Value == "false";
onlineCached = true;
return online;
}
}
internal JenkinsNode(XElement node)
{
this.Node = node;
}
}
}