using System.Drawing; using System.IO; using System.Windows.Forms; using System.Xml; namespace TeslaConsole.BattleTech; public class BTVehicle { private readonly string mKey; private readonly string mName; private readonly string mImagePath; public string Key => mKey; public string Name => mName; public Image Image { get { if (mImagePath == null) { return null; } return ImageCache.GetImage(Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), mImagePath)); } } internal BTVehicle(XmlNode vehicleNode) { XmlAttribute xmlAttribute = vehicleNode.Attributes["image"]; mKey = vehicleNode.Attributes["key"].InnerText; mName = vehicleNode.Attributes["name"].InnerText; mImagePath = xmlAttribute?.InnerText; } public override string ToString() { return mName; } }