public static void writeinfo(this HouseStark houseStark, string filename) { XDocument xDocument = new XDocument(); var sodiers = HouseStark.Starks_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 = HouseStark.Starks_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", houseStark, new XElement("HouseWords", HouseStark.Words), new XElement("houseRulers", HouseStark.houseRulers), new XElement("HousesCapitals", HouseStark.housesCapital), new XElement("treasury", HouseStark.Treasury), new XElement("northlord", new XElement("name", HouseStark.NorthLord.Name), new XElement("age", HouseStark.NorthLord.Age), new XElement("house", HouseStark.NorthLord.LordHouse), new XElement("isalive", HouseStark.NorthLord.Isalive), new XElement("profession", HouseStark.NorthLord.profesion)), new XElement("soldiers", sodiers), new XElement("people", people)); xDocument.Add(xElement); xDocument.Save(filename); }
static public void Moneycollector(this HouseStark houseStark) { houseStark += HouseStark.Starks_people; }