/// <summary> /// Reads storage locations from Json and stores them in the prototype. /// </summary> /// <param name="reader">The JToken.</param> private void ReadJsonStorages(JToken storagesToken) { foreach (JToken storageToken in storagesToken) { ShipStorage storage = new ShipStorage((int)storageToken["X"], (int)storageToken["Y"]); storages.Add(storage); } }
/// <summary> /// Reads storage locations from XML and stores them in the prototype. /// </summary> /// <param name="reader">The XML reader.</param> private void ReadXmlStorages(XmlReader reader) { if (reader.ReadToDescendant("Storage")) { do { int x = int.Parse(reader.GetAttribute("x")); int y = int.Parse(reader.GetAttribute("y")); ShipStorage storage = new ShipStorage(x, y); storages.Add(storage); }while (reader.ReadToNextSibling("Storage")); } }