internal static void DumpResources(List <TransferPump> pumps) { // This initiates the Dump process and with realism off, does the dump immediately; with realism on, initiates the real time process. try { if (SMSettings.RealXfers) { // Turn on Pumps for timed process... List <TransferPump> .Enumerator epumps = pumps.GetEnumerator(); while (epumps.MoveNext()) { if (epumps.Current == null) { continue; } TransferPump pump = epumps.Current; pump.PumpRatio = 1; pump.IsPumpOn = true; } epumps.Dispose(); // Add pumps to pump queue SMAddon.SmVessel.TransferPumps.AddRange(pumps); // Start the process. This flag is checked in SMAddon.Update() TransferPump.PumpProcessOn = true; } else { List <TransferPump> .Enumerator epumps = pumps.GetEnumerator(); while (epumps.MoveNext()) { if (epumps.Current == null) { continue; } TransferPump pump = epumps.Current; pump.RunPumpCycle(pump.PumpAmount); } epumps.Dispose(); SMAddon.SmVessel.TransferPumps.Clear(); } } catch (Exception ex) { SmUtils.LogMessage( $" in ProcessController.DumpResources. Error: {ex.Message} \r\n\r\n{ex.StackTrace}", SmUtils.LogType.Error, true); } }
/// <summary> /// This method is called by WindowTransfer.Xferbutton press. /// </summary> /// <param name="xferPumps"></param> internal static void TransferResources(List <TransferPump> xferPumps) { try { if (SMSettings.RealXfers) { List <TransferPump> .Enumerator pumps = xferPumps.GetEnumerator(); while (pumps.MoveNext()) { if (pumps.Current == null) { continue; } TransferPump pump = pumps.Current; pump.IsPumpOn = true; } pumps.Dispose(); // now lets start the pumping process... SMAddon.SmVessel.TransferPumps.AddRange(xferPumps); // Start the process. This flag is checked in SMAddon.Update() TransferPump.PumpProcessOn = true; } else { //Not in Realism mode, so just move the resource... List <TransferPump> .Enumerator pumps = xferPumps.GetEnumerator(); while (pumps.MoveNext()) { if (pumps.Current == null) { continue; } TransferPump pump = pumps.Current; pump.RunPumpCycle(pump.PumpAmount); } pumps.Dispose(); } } catch (Exception ex) { SmUtils.LogMessage( $" in ProcessController.TransferResources. Error: {ex.Message} \r\n\r\n{ex.StackTrace}", SmUtils.LogType.Error, true); } }