コード例 #1
0
        protected SubjResult.SubjResultList ParseSubjXmlResults(string xmlresults, Submission sub)
        {
            SubjResult.SubjResultList ress = new SubjResult.SubjResultList();
            XPathNavigator            xnav = new XmlWizard().GetXPathNavigator(xmlresults);
            FileSystem fs   = new FileSystem(m_ident);
            CFile      zone = fs.GetFile(sub.LocationID);

            xnav.MoveToFirstChild(); xnav.MoveToFirstChild();
            XPathNavigator comments = xnav.Clone();

            while (comments.MoveToNext())
            {
                SubjResult     res     = new SubjResult();
                XPathNavigator comment = comments.Clone();
                comment.MoveToFirstChild();

                string subjtype = comment.Value; comment.MoveToNext();
                switch (subjtype)
                {
                case "Warning":
                    res.SubjType = Rubric.WARNING;
                    break;

                case "Error":
                    res.SubjType = Rubric.ERROR;
                    break;

                case "Good":
                    res.SubjType = Rubric.GOOD;
                    break;
                }
                ;

                res.Points  = Convert.ToDouble(comment.Value); comment.MoveToNext();
                res.Comment = comment.Value; comment.MoveToNext();

                string filename = comment.Value; comment.MoveToNext();
                if (filename.StartsWith(@".\"))
                {
                    filename = filename.Substring(2, filename.Length - 2);
                }
                CFile file = fs.GetFile(Path.Combine(zone.FullPath, filename));
                if (file != null)
                {
                    res.FileID = file.ID;
                    res.Line   = Convert.ToInt32(comment.Value);
                    ress.Add(res);
                }
            }

            return(ress);
        }