예제 #1
0
        public void RemoveAmmunition(string macro)
        {
            List <ShipAmmunitionItemData> tempList = null;

            try
            {
                tempList = Ammunition.Where(a => a.Ware == macro).ToList();

                if (tempList.Count > 1)
                {
                    throw new Exception("There is more than one ware entry of that type. That can't be right!");
                }
                else if (tempList.Count < 1)
                {
                    throw new Exception("There is no ware entry of that type.");
                }

                ShipAmmunitionItemData temp = tempList.First();
                temp.RemoveNode();
                Ammunition.Remove(temp);
            }
            catch (Exception ex)
            {
                throw new Exception("Unable to remove ware entry", ex);
            }
        }