Example #1
0
        public static void writeinfo(this HouseCerwyn houseCerwyn, string filename)
        {
            XDocument xDocument = new XDocument();
            var       sodiers   = HouseCerwyn.Cerwyns_soldiers.Select(soldier => new XElement("name", soldier.Name, new XElement("profession", soldier.Profesion),
                                                                                              new XElement("Age", soldier.age), new XElement("money", soldier.money), new XElement("Gender", soldier.Gender), new XElement("eyescolor", soldier.Eyescolor),
                                                                                              new XElement("Isalive", soldier.Isalive), new XElement("Health", soldier.Health),
                                                                                              new XElement("fight", new XAttribute("Fightskills", soldier.FightSkills), new XAttribute("Durability", soldier.Durability), new XAttribute("Quickness", soldier.Quickness)))).ToList();

            var people = HouseCerwyn.Cerwyns_people.Select(soldier => new XElement("name", soldier.Name, new XElement("profession", soldier.Profesion),
                                                                                   new XElement("Age", soldier.age), new XElement("money", soldier.money), new XElement("Gender", soldier.Gender), new XElement("eyescolor", soldier.Eyescolor),
                                                                                   new XElement("Isalive", soldier.Isalive), new XElement("Health", soldier.Health))).ToList();

            XElement xElement = new XElement("HouseBolton", houseCerwyn, new XElement("HouseWords", HouseCerwyn.Words),
                                             new XElement("houseRulers", HouseCerwyn.houseRulers), new XElement("HousesCapitals", HouseCerwyn.housesCapital), new XElement("treasury", HouseCerwyn.Treasury),
                                             new XElement("northlord", new XElement("name", HouseCerwyn.NorthLord.Name), new XElement("age", HouseCerwyn.NorthLord.Age),
                                                          new XElement("house", HouseCerwyn.NorthLord.LordHouse), new XElement("isalive", HouseCerwyn.NorthLord.Isalive), new XElement("profession", HouseCerwyn.NorthLord.profesion)),
                                             new XElement("soldiers", sodiers), new XElement("people", people));

            xDocument.Add(xElement);
            xDocument.Save(filename);
        }
 static public void Moneycollector(this HouseCerwyn houseCerwyn)
 {
     houseCerwyn += HouseCerwyn.Cerwyns_people;
 }