using InABox.Core; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace PRS.Shared.Database_Update_Scripts.Utils; internal static class Utils { public static void ProcessInChunks(IList items, Action> processChunk, int stepBy, Action reportPercentage) { for(int i = 0; i < items.Count; i += 1000) { reportPercentage((double)i / (double)items.Count * 100.0); var mpStages = new List(1000); for(int j = i; j < Math.Min(i + 1000, items.Count); j++) { mpStages.Add(items[j]); } processChunk(mpStages); } } }