private void ProExportBtn_Click(object sender, EventArgs e)
        {
            FolderBrowserDialog path = new FolderBrowserDialog();

            if (path.ShowDialog() == DialogResult.OK)
            {
                // MessageBox.Show(path.SelectedPath);
                SerializableDictionary <int, StructureOfProblem> problems = ProblemList.GetAll();
                XmlOperator xmlOperator = new XmlOperator();

                xmlOperator.XMLSerialized(path.SelectedPath + "//Problem.xml", problems);
            }
        }
        public void XmlwriteTest()
        {
            XmlOperator        xmlOperator = new XmlOperator();
            StructureOfProblem p           = new StructureOfProblem();

            p.QuestionDescription = "testing";
            p.QuestionName        = "test";
            p.ProblemID           = 1;
            SerializableDictionary <int, StructureOfProblem> problemlist = new SerializableDictionary <int, StructureOfProblem>();

            problemlist.Add(p.ProblemID, p);
            xmlOperator.XMLSerialized("Problem//Problem.xml", problemlist);
            Directory.Exists("Problem//Problem.xml");
        }
        private void export_status_Click_1(object sender, EventArgs e)
        {
            SerializableDictionary <int, StructureOfProblem> problems    = ProblemList.GetAll();
            SerializableDictionary <int, StructureOfProblem> problemlist = new SerializableDictionary <int, StructureOfProblem>();
            XmlOperator xmlOperator = new XmlOperator();

            foreach (int key in problems.Keys)
            {
                StructureOfProblem p = new StructureOfProblem();
                p.AcceptsRate  = ProblemList.GetProblem(key).AcceptsRate;
                p.QuestionName = ProblemList.GetProblem(key).QuestionName;
                p.ProblemID    = ProblemList.GetProblem(key).ProblemID;
                problemlist.Add(p.ProblemID, p);
            }
            xmlOperator.XMLSerialized("Problem//ProblemStatus.xml", problemlist);
            //MessageBox.Show("导出成功");
        }
        public void XMLSerializedTest()
        {
            if (Directory.Exists("User//"))
            {
                DirectoryInfo di = new DirectoryInfo("User//");
                di.Delete(true);
            }

            User user = new User();

            user.Name = "卓裕轩";
            //user.StudentId = 2016052355;
            user.Jwxtpassword = "******";
            user.Major        = "软件工程";
            XmlOperator p = new XmlOperator();

            p.XMLSerialized(user);
            Assert.IsTrue(File.Exists("User//User.xml"));
        }
        public void readXMLTest()
        {
            if (Directory.Exists("User//"))
            {
                DirectoryInfo di = new DirectoryInfo("User//");
                di.Delete(true);
            }
                
            User user = new User();

            user.Name = "卓裕轩";
            //user.StudentId = 2016052355;
            user.Jwxtpassword = "******";
            user.Major        = "软件工程";
            XmlOperator p = new XmlOperator();

            p.XMLSerialized(user);
            User resUser = p.readXML("");

            Assert.AreEqual(user.Name, resUser.Name);
            Assert.AreEqual(user.Jwxtpassword, resUser.Jwxtpassword);
            Assert.AreEqual(user.Major, resUser.Major);
        }
        private void ExportStatusBtn_Click(object sender, EventArgs e)
        {
            FolderBrowserDialog path = new FolderBrowserDialog();

            if (path.ShowDialog() == DialogResult.OK)
            {
                // MessageBox.Show(path.SelectedPath);
                SerializableDictionary <int, StructureOfProblem> problemsStatus = new SerializableDictionary <int, StructureOfProblem>();
                foreach (int key in problems.Keys)
                {
                    StructureOfProblem problem = new StructureOfProblem();
                    problem.ProblemID = ProblemList.GetProblem(key).ProblemID;
                    if (this.Main_TreeView.SelectedNode.Text == ProblemList.GetProblem(key).QuestionName)
                    {
                        problem.Problemcode = this.problemcode.Text;
                    }
                    problem.QuestionName = ProblemList.GetProblem(key).QuestionName;
                    problem.AcceptsRate  = ProblemList.GetProblem(key).AcceptsRate;
                    problemsStatus.Add(problem.ProblemID, problem);
                }
                XmlOperator xmlOperator = new XmlOperator();
                xmlOperator.XMLSerialized(path.SelectedPath + "//ProblemStatus.xml", problemsStatus);
            }
        }