internal static void AddVehicleFamily(string familyName) { if (AllVehicleFamilies.FirstOrDefault(x => x.Name == familyName) == null) { AllVehicleFamilies.Add(new VehicleFamily(familyName)); } }
// Vehicle management internal static Vehicle AddVehicle(string familyName, string newVehicle, double _mass, string _note = "") { var family = AllVehicleFamilies.FirstOrDefault(x => x.Name.Trim().ToLowerInvariant() == familyName.Trim().ToLowerInvariant()); Vehicle v; if (family != null) { v = new Vehicle("", newVehicle, _mass, _note); family.AddVehicle(v); v.SetSubassemblyName(v.GetFullName()); return(v); } return(null); }
internal static bool VehicleAvailable(string familyName, string vehicleName, Vehicle vehicle = null) { var family = AllVehicleFamilies.FirstOrDefault(x => String.Equals(x.Name.Trim(), familyName.Trim(), StringComparison.OrdinalIgnoreCase)); if (GetAllVehicles().Contains(vehicle)) { return(true); } if (family != null) { return(family.AllVehicles.FirstOrDefault(x => String.Equals(x.Name.Trim(), vehicleName.Trim(), StringComparison.OrdinalIgnoreCase)) == null); } return(false); }
internal static VehicleFamily GetVehicleFamily(string familyName) { return(AllVehicleFamilies.FirstOrDefault(x => String.Equals(x.Name.Trim(), familyName.Trim(), StringComparison.OrdinalIgnoreCase))); }
internal static bool FamilyAvailable(string familyName) { return(AllVehicleFamilies.FirstOrDefault(x => String.Equals(x.Name.Trim(), familyName.Trim(), StringComparison.OrdinalIgnoreCase)) == null); }