public IReadOnlyDictionary <Item, TransferData> GetRouteTotalTransfers(bool skipForOnlyOneVehicle = true) { if (!HasValidData || VehicleSchedule.Vehicle.Route != null) { TaskTransfers totalTransfers = new TaskTransfers(); VehicleRoute route = VehicleSchedule.Vehicle.Route; if (skipForOnlyOneVehicle && route.Vehicles.Count == 1) { return(null); } foreach (Vehicle vehicle in route.Vehicles.ToArray()) { if (vehicle.IsEnabled) { VehicleScheduleData vehicleData = VehicleScheduleDataManager.Current[vehicle]; float?mult; if (vehicleData == null || !vehicleData.Capacity.HasValidData || (mult = vehicleData.ScheduleMonthlyMultiplier) == null) { return(null); } totalTransfers.Add(vehicleData.Capacity.TotalTransfers, mult, vehicleData.ScheduleAvereageDuration.Estimated); } } return(totalTransfers.Transfers); } return(null); }
public IReadOnlyDictionary <Item, TransferData> GetRouteTaskTransfers(RootTask task, bool skipForOnlyOneVehicle = true) { if (task == null) { throw new ArgumentNullException("task"); } if (!HasValidData || VehicleSchedule.Vehicle.Route != null) { TaskTransfers routeTransfers = new TaskTransfers(); VehicleRoute route = VehicleSchedule.Vehicle.Route; if (skipForOnlyOneVehicle && route.Vehicles.Count == 1) { return(null); } int taskIndex = task.GetIndex(); foreach (Vehicle vehicle in route.Vehicles.ToArray()) { if (vehicle.IsEnabled) { VehicleScheduleData vehicleData = VehicleScheduleDataManager.Current[vehicle]; float?mult; if (vehicleData == null || !vehicleData.Capacity.HasValidData || (mult = vehicleData.ScheduleMonthlyMultiplier) == null) { return(null); } IReadOnlyDictionary <Item, TransferData> transfers = vehicleData.Capacity.GetTransfers(vehicle.Schedule.GetTasks()[taskIndex]); if (transfers != null) { routeTransfers.Add(transfers, mult, vehicleData.ScheduleAvereageDuration.Estimated); } else { return(null); } } } return(routeTransfers.Transfers); } return(null); }