-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathEnumDef.cs
42 lines (37 loc) · 1.1 KB
/
EnumDef.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
using System;
using System.Collections.Generic;
using System.Text;
using System.Xml;
namespace spb2xml
{
[Serializable]
public class EnumDef
{
private List<String> values = new List<string>();
public EnumDef(XmlNode node)
{
foreach (XmlNode son in node.ChildNodes)
{
if (son.Name.Equals("EnumVal"))
{
XmlAttributeCollection attributes = son.Attributes;
XmlAttribute attr;
string valName = null;
attr = attributes["name"];
if (attr != null) valName = attr.Value;
attr = attributes["xml_name"];
if (attr != null) valName = attr.Value;
if (valName != null) values.Add(valName);
}
}
}
public string this[int index]
{
get
{
if (index > values.Count) throw new SPBException("Enum value out of bound");
return values[index];
}
}
}
}