static void InitializeComponent() { Console.Title = "中考查分"; XmlDocument zkcf = new XmlDocument(); zkcf.Load(".\\zkcf.xml"); Console.WriteLine("配置文件已加载。"); main = zkcf.FirstChild; CommonFolder = main.ChildNodes[0].ChildNodes[0].Attributes.GetNamedItem("value").InnerText; foreach (XmlNode si in main.ChildNodes[1]) { StudentPool.Add(si.Attributes.GetNamedItem("Source").InnerText, StudentInfo.Create(si.Attributes.GetNamedItem("Source").InnerText, si.Attributes.GetNamedItem("Name").InnerText, Int64.Parse(si.Attributes.GetNamedItem("Id").InnerText), Int16.Parse(si.Attributes.GetNamedItem("IdLength").InnerText), Int64.Parse(si.Attributes.GetNamedItem("Zw").InnerText), Int16.Parse(si.Attributes.GetNamedItem("ZwLength").InnerText))); } Console.WriteLine("学生池已加载。"); foreach (XmlNode ti in main.ChildNodes[2]) { TestPool.Add(ti.Attributes.GetNamedItem("Source").InnerText, TestInfo.Create(ti.Attributes.GetNamedItem("Source").InnerText, ti.Attributes.GetNamedItem("Name").InnerText, ti.Attributes.GetNamedItem("Url").InnerText, ti.Attributes.GetNamedItem("Pattern").InnerText, ti.Attributes.GetNamedItem("NeedZw").InnerText == "1")); } Console.WriteLine("考试池已加载。"); List <string> Folders = new List <string>(); foreach (string p in TestPool.Keys) { Folders.Add(CommonFolder + "\\" + p); } foreach (string f in Folders) { if (!Directory.Exists(f)) { Directory.CreateDirectory(f); Console.WriteLine("目录" + f + "已创建。"); } } Console.WriteLine("文件夹池已加载。"); Console.WriteLine(); Console.Clear(); }