public void load(string configFile) { // Console.WriteLine(now() + ": Reading configuration from " + configFile); XmlTextReader reader = new XmlTextReader(configFile); while (reader.Read()) { switch (reader.NodeType) { case XmlNodeType.Element: { switch (reader.Name) { case "General": { DROPDIR = reader.GetAttribute("DROPDIR"); REGRESSIONDIR = reader.GetAttribute("REGRESSIONDIR"); TIMEOUT = Convert.ToDouble(reader.GetAttribute("TIMEOUT")); MEMOUT = Convert.ToUInt32(reader.GetAttribute("MEMOUT")); } break; case "Developer": { Developers.Add(reader.GetAttribute("name")); break; } case "Directory": { DirTypePair np = new DirTypePair(); np.dir = reader.GetAttribute("name"); np.type = reader.GetAttribute("type"); if (np.type == "") np.type = "smt2"; Directories.Add(np); break; } case "ExcludeDirectory": { ExcludeDirectories.Add(reader.GetAttribute("name")); break; } case "TestConfig": { TestConfiguration t = new TestConfiguration(); t.Read(reader); if (!testConfigs.ContainsKey(t.type)) testConfigs.Add(t.type, new List<TestConfiguration>()); testConfigs[t.type].Add(t); break; } default: /* nothing */ break; } break; } default: /* nothing */ break; } } }
public void load(string configFile) { // Console.WriteLine(now() + ": Reading configuration from " + configFile); XmlTextReader reader = new XmlTextReader(configFile); while (reader.Read()) { switch (reader.NodeType) { case XmlNodeType.Element: { switch (reader.Name) { case "General": { DROPDIR = reader.GetAttribute("DROPDIR"); REGRESSIONDIR = reader.GetAttribute("REGRESSIONDIR"); TIMEOUT = Convert.ToDouble(reader.GetAttribute("TIMEOUT")); MEMOUT = Convert.ToUInt32(reader.GetAttribute("MEMOUT")); } break; case "Developer": { Developers.Add(reader.GetAttribute("name")); break; } case "Directory": { DirTypePair np = new DirTypePair(); np.dir = reader.GetAttribute("name"); np.type = reader.GetAttribute("type"); if (np.type == "") { np.type = "smt2"; } Directories.Add(np); break; } case "ExcludeDirectory": { ExcludeDirectories.Add(reader.GetAttribute("name")); break; } case "TestConfig": { TestConfiguration t = new TestConfiguration(); t.Read(reader); if (!testConfigs.ContainsKey(t.type)) { testConfigs.Add(t.type, new List <TestConfiguration>()); } testConfigs[t.type].Add(t); break; } default: /* nothing */ break; } break; } default: /* nothing */ break; } } }