private OperationOutput.Episode DoRefill() { var ret = new OperationOutput.Episode(OperationOutput.EpisodeType.REFILL); ret.refillFlow = refillRule.Apply(foreground); ret.refillSlots = new SlotAttribute[foreground.Height, foreground.Width]; foreground.ForeachSlot((x, y, slot) => { if (null == foreground.WrapperRect[y, x]) { background.ClearSlot(x, y); background.FillSlot(x, y); } }); MakeContainerStable(background); background.ForeachSlot((x, y, slot) => { if (slot.slotAttribute.category != SlotAttribute.Category.INSULATOR) { foreground.SetSlot(x, y, slot); } }); background.FlushAsFirmware(); foreground.ForeachSlot((x, y, slot) => { ret.refillSlots[y, x] = slot.slotAttribute; }); return(ret); }