public virtual StoreItem Clone() { StoreItem it = new StoreItem(this.title); it.buildTime = buildTime; FactoryResource[] pom = new FactoryResource[this.resources.Count]; this.resources.CopyTo(pom); it.resources = new List <FactoryResource>(pom); return(it); }
public virtual void FromXml(XmlNode node) { this.title = node.SelectSingleNode("Title").InnerText; this.researched = bool.Parse(node.SelectSingleNode("Researched").InnerText); this.canResearch = bool.Parse(node.SelectSingleNode("CanResearch").InnerText); this.type = (ItemType)ItemType.Parse(typeof(ItemType), node.SelectSingleNode("ItemType").InnerText); this.description = node.SelectSingleNode("Description").InnerText; this.buildTime = int.Parse(node.SelectSingleNode("BuildTime").InnerText); this.buildRank = int.Parse(node.SelectSingleNode("BuildRank").InnerText); this.researchRank = int.Parse(node.SelectSingleNode("ResearchRank").InnerText); this.orbitalOnly = bool.Parse(node.SelectSingleNode("OrbitalOnly").InnerText); this.picture = node.SelectSingleNode("Picture").InnerText; XmlNode par; this.textureArea = StructXml.RectangleFromXml(node.SelectSingleNode("TextureArea")); par = node.SelectSingleNode("Resources"); this.resources.Clear(); for (int i = 0; i < par.ChildNodes.Count; i++) { FactoryResource res = new FactoryResource(); res.FromXml(par.ChildNodes[i]); this.resources.Add(res); } if (node.SelectSingleNode("Mass") != null) { this.mass = int.Parse(node.SelectSingleNode("Mass").InnerText); } if (node.SelectSingleNode("ResearchPointsNeeded") != null) { this.researchPointsNeeded = int.Parse(node.SelectSingleNode("ResearchPointsNeeded").InnerText); } }