public InstructionSet MapInstructions() { var index = 0; var set = new InstructionSet(InstructionsFrom.Console); if (arguments.Length == 0) { return set; } if (arguments[index].ToInstructionType() == InstructionType.None) { set.ExecuteAlias = arguments[index]; index++; } for (; index < arguments.Length; index++) { if (!arguments[index].IsASwitch()) continue; set.Instructions.Add(new Instruction { InstructionsFrom = InstructionsFrom.Console, InstructionType = arguments[index].ToInstructionType(), Arguments = arguments.Skip(index + 1).TakeWhile(x => !x.IsASwitch()), }); } return set; }
public InstructionSet MapInstructions() { var set = new InstructionSet(InstructionsFrom.Configuration) { ExecuteAlias = configuration.DefaultArguments.ExecuteAlias }; configuration.DefaultArguments.ConstructorArguments.Any() .ExecuteIfTrue(() => set.Instructions.Add( new Instruction { InstructionType = InstructionType.Constructor, Arguments = configuration.DefaultArguments.ConstructorArguments, InstructionsFrom = InstructionsFrom.Configuration })); configuration.DefaultArguments.MethodArguments.Any() .ExecuteIfTrue(() => set.Instructions.Add( new Instruction { InstructionType = InstructionType.Method, Arguments = configuration.DefaultArguments.MethodArguments, InstructionsFrom = InstructionsFrom.Configuration })); configuration.IsInGroupMode .ExecuteIfTrue(() => set.Instructions.Add( new Instruction { InstructionType = InstructionType.Group, Arguments = new string[0], InstructionsFrom = InstructionsFrom.Configuration })); configuration.IsTimedMode .ExecuteIfTrue(() => set.Instructions.Add( new Instruction { InstructionType = InstructionType.Timed, Arguments = new string[0], InstructionsFrom = InstructionsFrom.Configuration })); configuration.IsVerbodeMode .ExecuteIfTrue(() => set.Instructions.Add( new Instruction { InstructionType = InstructionType.Verbose, Arguments = new string[0], InstructionsFrom = InstructionsFrom.Configuration })); return set; }