Ejemplo n.º 1
0
        /// <summary>
        /// Load <see cref="Intel">Intel</see> from an xml node.
        /// </summary>
        public void LoadFromXmlNode(XmlNode xmlnode)
        {
            while (xmlnode != null)
            {
                try
                {
                    switch (xmlnode.Name.ToLower())
                    {
                    case "root":
                        xmlnode = xmlnode.FirstChild;
                        continue;

                    case "intel":
                        xmlnode = xmlnode.FirstChild;
                        continue;

                    case "empiredata":
                        EmpireState = new EmpireData(xmlnode);
                        break;

                    case "message":
                        Message message = new Message(xmlnode);
                        Messages.Add(message);
                        break;

                    case "scorerecord":
                        ScoreRecord newScore = new ScoreRecord(xmlnode);
                        AllScores.Add(newScore);
                        break;

                    case "minefield":
                        Minefield minefield = new Minefield(xmlnode);
                        AllMinefields.Add(minefield.Key, minefield);
                        break;

                    default: break;
                    }
                }
                catch (Exception e)
                {
                    Report.FatalError(e.Message + "\n Details: \n" + e);
                }

                xmlnode = xmlnode.NextSibling;
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Provide a sort by rank function.
        /// </summary>
        /// <param name="rightHandSide"></param>
        public int CompareTo(object rightHandSide)
        {
            ScoreRecord rhs = (ScoreRecord)rightHandSide;

            return(rhs.Score.CompareTo(this.Score));
        }