private void CopyFieldsFromOther(FunctionInfo other) { this._scriptBlock = other._scriptBlock; this._description = other._description; this._options = other._options; this._helpFile = other._helpFile; }
internal void Update(System.Management.Automation.ScriptBlock newFunction, bool force, ScopedItemOptions options, string helpFile) { if (newFunction == null) { throw PSTraceSource.NewArgumentNullException("function"); } if ((this._options & ScopedItemOptions.Constant) != ScopedItemOptions.None) { SessionStateUnauthorizedAccessException exception = new SessionStateUnauthorizedAccessException(base.Name, SessionStateCategory.Function, "FunctionIsConstant", SessionStateStrings.FunctionIsConstant); throw exception; } if (!force && ((this._options & ScopedItemOptions.ReadOnly) != ScopedItemOptions.None)) { SessionStateUnauthorizedAccessException exception2 = new SessionStateUnauthorizedAccessException(base.Name, SessionStateCategory.Function, "FunctionIsReadOnly", SessionStateStrings.FunctionIsReadOnly); throw exception2; } this._scriptBlock = newFunction; base.SetModule(newFunction.Module); this._commandMetadata = null; base._parameterSets = null; base._externalCommandMetadata = null; if (options != ScopedItemOptions.Unspecified) { this.Options = options; } this._helpFile = helpFile; }
public ValidateScriptAttribute(System.Management.Automation.ScriptBlock scriptBlock) { if (scriptBlock == null) { throw PSTraceSource.NewArgumentException("scriptBlock"); } this._scriptBlock = scriptBlock; }
internal ScriptInfo(string name, System.Management.Automation.ScriptBlock script, ExecutionContext context) : base(name, CommandTypes.Script, context) { if (script == null) { throw PSTraceSource.NewArgumentException("script"); } this.ScriptBlock = script; }
internal FunctionInfo(string name, System.Management.Automation.ScriptBlock function, System.Management.Automation.ExecutionContext context, string helpFile) : base(name, CommandTypes.Function, context) { this.verb = string.Empty; this.noun = string.Empty; this._helpFile = string.Empty; if (function == null) { throw PSTraceSource.NewArgumentNullException("function"); } this._scriptBlock = function; CmdletInfo.SplitCmdletName(name, out this.verb, out this.noun); base.SetModule(function.Module); this._helpFile = helpFile; }
public PSEventJob(PSEventManager eventManager, PSEventSubscriber subscriber, System.Management.Automation.ScriptBlock action, string name) : base((action == null) ? null : action.ToString(), name) { if (eventManager == null) { throw new ArgumentNullException("eventManager"); } if (subscriber == null) { throw new ArgumentNullException("subscriber"); } base.UsesResultsCollection = true; this.action = action; this.eventManager = eventManager; this.subscriber = subscriber; }
internal ScriptBlockInvocationEventArgs(System.Management.Automation.ScriptBlock scriptBlock, bool useLocalScope, System.Management.Automation.ScriptBlock.ErrorHandlingBehavior errorHandlingBehavior, object dollarUnder, object input, object scriptThis, Pipe outputPipe, System.Management.Automation.InvocationInfo invocationInfo, params object[] args) { if (scriptBlock == null) { throw PSTraceSource.NewArgumentNullException("scriptBlock"); } this.ScriptBlock = scriptBlock; this.OutputPipe = outputPipe; this.UseLocalScope = useLocalScope; this.ErrorHandlingBehavior = errorHandlingBehavior; this.DollarUnder = dollarUnder; this.Input = input; this.ScriptThis = scriptThis; this.InvocationInfo = invocationInfo; this.Args = args; }
internal bool TrySetBreakpoint(string scriptFile, FunctionContext functionContext) { if (scriptFile.Equals(base.Script, StringComparison.OrdinalIgnoreCase)) { int num; System.Management.Automation.ScriptBlock block = functionContext._scriptBlock; Ast ast = block.Ast; if (!ast.Extent.ContainsLineAndColumn(this.Line, this.Column)) { return(false); } IScriptExtent[] sequencePoints = block.SequencePoints; if ((sequencePoints.Length == 1) && (sequencePoints[0] == block.Ast.Extent)) { return(false); } bool flag = CheckBreakpointInScript.IsInNestedScriptBlock(((IParameterMetadataProvider)ast).Body, this); IScriptExtent extent = FindSequencePoint(functionContext, this.Line, this.Column, out num); if ((extent != null) && (!flag || ((extent.StartLineNumber == this.Line) && (this.Column == 0)))) { this.SetBreakpoint(functionContext, num); return(true); } if (flag) { return(false); } ScriptBlockAst body = ((IParameterMetadataProvider)ast).Body; if ((((body.DynamicParamBlock == null) || body.DynamicParamBlock.Extent.IsAfter(this.Line, this.Column)) && ((body.BeginBlock == null) || body.BeginBlock.Extent.IsAfter(this.Line, this.Column))) && (((body.ProcessBlock == null) || body.ProcessBlock.Extent.IsAfter(this.Line, this.Column)) && ((body.EndBlock == null) || body.EndBlock.Extent.IsAfter(this.Line, this.Column)))) { this.SetBreakpoint(functionContext, 0); return(true); } if ((this.Column == 0) && (FindSequencePoint(functionContext, this.Line + 1, 0, out num) != null)) { this.SetBreakpoint(functionContext, num); return(true); } } return(false); }
internal FunctionInfo(string name, System.Management.Automation.ScriptBlock function, ScopedItemOptions options, System.Management.Automation.ExecutionContext context, string helpFile) : this(name, function, context, helpFile) { this._options = options; }
internal FunctionInfo(string name, System.Management.Automation.ScriptBlock function, ScopedItemOptions options, System.Management.Automation.ExecutionContext context) : this(name, function, options, context, null) { }
internal void Update(System.Management.Automation.ScriptBlock newFunction, bool force, ScopedItemOptions options) { this.Update(newFunction, force, options, null); }
internal LineBreakpoint(string script, int line, int column, System.Management.Automation.ScriptBlock action) : base(script, action) { this.Line = line; this.Column = column; this.SequencePointIndex = -1; }
public void AddPowershellScript(P pattern, System.Management.Automation.ScriptBlock script, string processingUnitId) { AddPowershellScript(pattern, script.ToString(), processingUnitId); }