private static List<ProtocolInstruction> ProtocolWithRepsRecurscion(List<ProtocolInstruction> Instructions, LoopInstruction Repeat, int RepeatIndex) { //this protocol should be called by the one below it to expand out a loop List<ProtocolInstruction> ProtToAppend = new List<ProtocolInstruction>();//this will be returned for (int j = 0; j < Repeat.TimesToRepeat; j++) { for (int i = Repeat.StartInstruction - 1; i < RepeatIndex; i++) { ProtocolInstruction Item = Instructions[i]; if (Item is LoopInstruction) { LoopInstruction NewRepeat = (LoopInstruction)Item; List<ProtocolInstruction> NewListToAdd = ProtocolWithRepsRecurscion(Instructions, NewRepeat, i); ProtToAppend.AddRange(NewListToAdd); } else { ProtToAppend.Add(Item); } } } return ProtToAppend; }
public ListBoxRepeatItem() { RepeatInstruction = new LoopInstruction(); }