Ejemplo n.º 1
0
 public SudoExercise[] SelectExercises(SudoDifficulty difficulty)
 {
     List<SudoExercise> exerciseList = new List<SudoExercise>();
     XmlElement dataelement = this.GetDifficultyElement(difficulty);
     foreach (XmlNode node in dataelement.ChildNodes)
     {
         if (node.NodeType != XmlNodeType.Element)
         {
             break;
         }
         XmlElement ele = (XmlElement)node;
         exerciseList.Add(SudoExercise.Parse(ele));
     }
     return exerciseList.ToArray();
 }
Ejemplo n.º 2
0
        public SudoExercise[] SelectExercises(SudoDifficulty difficulty)
        {
            List <SudoExercise> exerciseList = new List <SudoExercise>();
            XmlElement          dataelement  = this.GetDifficultyElement(difficulty);

            foreach (XmlNode node in dataelement.ChildNodes)
            {
                if (node.NodeType != XmlNodeType.Element)
                {
                    break;
                }
                XmlElement ele = (XmlElement)node;
                exerciseList.Add(SudoExercise.Parse(ele));
            }
            return(exerciseList.ToArray());
        }
Ejemplo n.º 3
0
        public void CreatDoExerciseElement(SudoDifficulty difficulty, SudoExercise exercise)
        {
            XmlDocument rootDoc     = (XmlDocument)(this.BaseXmlNode);
            XmlElement  dataElement = rootDoc.CreateElement("data");

            XmlElement dataChildElement;

            dataChildElement           = rootDoc.CreateElement("ID");
            dataChildElement.InnerText = exercise.ID;
            dataElement.AppendChild(dataChildElement);

            dataChildElement           = rootDoc.CreateElement("Exercise");
            dataChildElement.InnerText = exercise.SingleExercise;
            dataElement.AppendChild(dataChildElement);

            dataChildElement           = rootDoc.CreateElement("Solution");
            dataChildElement.InnerText = exercise.Solution;
            dataElement.AppendChild(dataChildElement);

            dataChildElement           = rootDoc.CreateElement("CreaterEmail");
            dataChildElement.InnerText = exercise.CreaterEmail;
            dataElement.AppendChild(dataChildElement);

            dataChildElement           = rootDoc.CreateElement("PlayerEmail");
            dataChildElement.InnerText = exercise.PlayerEmail;
            dataElement.AppendChild(dataChildElement);

            dataChildElement           = rootDoc.CreateElement("SolveDuration");
            dataChildElement.InnerText = exercise.SolveDuration.ToShortTimeString();
            dataElement.AppendChild(dataChildElement);

            dataChildElement           = rootDoc.CreateElement("SolveTime");
            dataChildElement.InnerText = exercise.SolveTime.ToString();
            dataElement.AppendChild(dataChildElement);

            this.GetDifficultyElement(difficulty).AppendChild(dataElement);
        }
Ejemplo n.º 4
0
        public void CreatDoExerciseElement(SudoDifficulty difficulty, SudoExercise exercise)
        {
            XmlDocument rootDoc = (XmlDocument)(this.BaseXmlNode);
            XmlElement dataElement = rootDoc.CreateElement("data");

            XmlElement dataChildElement;

            dataChildElement = rootDoc.CreateElement("ID");
            dataChildElement.InnerText = exercise.ID;
            dataElement.AppendChild(dataChildElement);

            dataChildElement = rootDoc.CreateElement("Exercise");
            dataChildElement.InnerText = exercise.SingleExercise;
            dataElement.AppendChild(dataChildElement);

            dataChildElement = rootDoc.CreateElement("Solution");
            dataChildElement.InnerText = exercise.Solution;
            dataElement.AppendChild(dataChildElement);

            dataChildElement = rootDoc.CreateElement("CreaterEmail");
            dataChildElement.InnerText = exercise.CreaterEmail;
            dataElement.AppendChild(dataChildElement);

            dataChildElement = rootDoc.CreateElement("PlayerEmail");
            dataChildElement.InnerText = exercise.PlayerEmail;
            dataElement.AppendChild(dataChildElement);

            dataChildElement = rootDoc.CreateElement("SolveDuration");
            dataChildElement.InnerText = exercise.SolveDuration.ToShortTimeString();
            dataElement.AppendChild(dataChildElement);

            dataChildElement = rootDoc.CreateElement("SolveTime");
            dataChildElement.InnerText = exercise.SolveTime.ToString();
            dataElement.AppendChild(dataChildElement);

            this.GetDifficultyElement(difficulty).AppendChild(dataElement);
        }
Ejemplo n.º 5
0
 private XmlElement GetDifficultyElement(SudoDifficulty difficulty)
 {
     return(XmlHelper.GetElementByName(this.DocumentElement.SelectSingleNode("Do"), difficulty.ToString()));
 }
Ejemplo n.º 6
0
 private XmlElement GetDifficultyElement(SudoDifficulty difficulty)
 {
     return XmlHelper.GetElementByName(this.DocumentElement.SelectSingleNode("Do"), difficulty.ToString());
 }