35 {
37
38 List<AttributeInfo> list = new List<AttributeInfo>();
39 if (filename != null && File.Exists(filename))
40 {
41 using (StreamReader sr = new StreamReader(filename))
42 {
43 for (int i = 0; !sr.EndOfStream; i++)
44 {
45 AttributeInfo attr = new AttributeInfo
46 {
47 _name = sr.ReadLine(),
48 _description = ""
49 };
50 string temp = sr.ReadLine();
51 while (temp != null && !temp.Equals("\t/EndDescription"))
52 {
53 attr._description += temp;
54 attr._description += '\n';
55 temp = sr.ReadLine();
56 }
57
58 if (temp == null)
59 {
60 return;
61 }
62
63 if (attr._description.EndsWith("\n"))
64 {
65 attr._description = attr._description.Substring(0, attr._description.Length - 1);
66 }
67
68 string num = sr.ReadLine();
69 try
70 {
71 attr._type = int.Parse(num);
72 }
73 catch (FormatException ex)
74 {
75 throw new FormatException(
76 "Invalid type \"" + num + "\" in " + Path.GetFileName(filename) + ".", ex);
77 }
78
79 if (attr._description == "")
80 {
81 attr._description = "No Description Available.";
82 }
83
84 list.Add(attr);
85 sr.ReadLine();
86 index++;
87 }
88 }
89 }
90
91 Array = list.ToArray();
92 }