public bool PipelineContainsBlockingCmdletToNextPrtgCmdletOrEnd() { var commands = GetPipelineCommands(); var myIndex = commands.IndexOf(cmdlet); for (var i = myIndex + 1; i < commands.Count; i++) { if (commands[i] is PrtgCmdlet) { return(false); } if (SelectObjectDescriptor.IsSelectObjectCommand(commands[i])) { var selectObject = (PSCmdlet)commands[i]; var boundParameters = selectObject.MyInvocation.BoundParameters; if (boundParameters.ContainsKey("Last")) { return(true); } if (boundParameters.ContainsKey("SkipLast")) { return(true); } } } return(false); }
public SelectObjectManager(ReflectionCacheManager manager, PSCmdlet cmdlet, Direction direction) { var cmds = manager.GetPipelineCommands(); var myIndex = cmds.IndexOf(cmdlet); if (direction == Direction.Upstream) { for (int i = myIndex - 1; i >= 0; i--) { if (SelectObjectDescriptor.IsSelectObjectCommand(cmds[i])) { Commands.Add(new SelectObjectDescriptor((PSCmdlet)cmds[i])); } else { if (i == myIndex - 1 && cmds[i] is WhereObjectCommand) { continue; } break; } } } else { for (int i = myIndex + 1; i < cmds.Count; i++) { if (SelectObjectDescriptor.IsSelectObjectCommand(cmds[i])) { Commands.Add(new SelectObjectDescriptor((PSCmdlet)cmds[i])); } else { if (i == myIndex + 1 && cmds[i] is WhereObjectCommand) { continue; } break; } } } }
public PrtgOperationCmdlet TryGetFirstOperationCmdletAfterSelectObject() { var commands = GetPipelineCommands(); var myIndex = commands.IndexOf(cmdlet); for (int i = myIndex; i >= 1; i--) { if (SelectObjectDescriptor.IsSelectObjectCommand(commands[i - 1])) { if (commands[i] is PrtgOperationCmdlet) { return(commands[i] as PrtgOperationCmdlet); } return(null); } } return(null); }