Esempio n. 1
0
 public SudoExercise(string createrEmail, string playerEmail, string doExercise)
 {
     this.ID = UtilityGuid.Get();
     this.CreaterEmail = createrEmail;
     this.PlayerEmail = playerEmail;
     this.SingleExercise = doExercise;
     int[] solution = SuDoTable.Solve(doExercise);
     StringBuilder sb = new StringBuilder();
     foreach (var item in solution)
     {
         sb.Append(item);
     }
     this.Solution = sb.ToString();
     this.SolveDuration = DateTime.Parse("00:00:00");
     this.SolveTime = 0;
 }
Esempio n. 2
0
        /// <summary>
        /// 根据XmlElement的LocalName获取一组XmlElement中的第一个Element
        /// </summary>
        /// <param name="node">将要查找的父级XmlNode</param>
        /// <param name="name">要查找的Element的LcoalName</param>
        /// <returns></returns>
        static public XmlElement GetElementByName(XmlNode node, string name)
        {
            Debug.Assert(!string.IsNullOrEmpty(name));

            //return (XmlElement)node.SelectSingleNode(string.Format(@"(.//{0})[1]", name));

            XmlNode subnode = node.SelectSingleNode(string.Format(@"(.//{0})[1]", name));

            if (subnode == null)
            {
                XmlElement ele = node.OwnerDocument.CreateElement(name);
                if (name == "ID")
                {
                    ele.InnerText = UtilityGuid.Get();
                }
                node.AppendChild(ele);
                subnode = GetElementByName(node, name);
            }
            return((XmlElement)subnode);
        }