コード例 #1
0
 private void CopyFieldsFromOther(FunctionInfo other)
 {
     this._scriptBlock = other._scriptBlock;
     this._description = other._description;
     this._options     = other._options;
     this._helpFile    = other._helpFile;
 }
コード例 #2
0
ファイル: FunctionInfo.cs プロジェクト: nickchal/pash
 private void CopyFieldsFromOther(FunctionInfo other)
 {
     this._scriptBlock = other._scriptBlock;
     this._description = other._description;
     this._options = other._options;
     this._helpFile = other._helpFile;
 }
コード例 #3
0
 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;
 }
コード例 #4
0
 public ValidateScriptAttribute(System.Management.Automation.ScriptBlock scriptBlock)
 {
     if (scriptBlock == null)
     {
         throw PSTraceSource.NewArgumentException("scriptBlock");
     }
     this._scriptBlock = scriptBlock;
 }
コード例 #5
0
ファイル: ScriptInfo.cs プロジェクト: modulexcite/pash-1
 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;
 }
コード例 #6
0
 public ValidateScriptAttribute(System.Management.Automation.ScriptBlock scriptBlock)
 {
     if (scriptBlock == null)
     {
         throw PSTraceSource.NewArgumentException("scriptBlock");
     }
     this._scriptBlock = scriptBlock;
 }
コード例 #7
0
 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;
 }
コード例 #8
0
ファイル: FunctionInfo.cs プロジェクト: nickchal/pash
 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;
 }
コード例 #9
0
 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;
 }
コード例 #10
0
ファイル: PSEventJob.cs プロジェクト: nickchal/pash
 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;
 }
コード例 #11
0
 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;
 }
コード例 #12
0
ファイル: LineBreakpoint.cs プロジェクト: modulexcite/pash-1
 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);
 }
コード例 #13
0
 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;
 }
コード例 #14
0
 internal FunctionInfo(string name, System.Management.Automation.ScriptBlock function, ScopedItemOptions options, System.Management.Automation.ExecutionContext context) : this(name, function, options, context, null)
 {
 }
コード例 #15
0
ファイル: FunctionInfo.cs プロジェクト: nickchal/pash
 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;
 }
コード例 #16
0
 internal void Update(System.Management.Automation.ScriptBlock newFunction, bool force, ScopedItemOptions options)
 {
     this.Update(newFunction, force, options, null);
 }
コード例 #17
0
ファイル: LineBreakpoint.cs プロジェクト: modulexcite/pash-1
 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;
 }
コード例 #18
0
 public void AddPowershellScript(P pattern, System.Management.Automation.ScriptBlock script, string processingUnitId)
 {
     AddPowershellScript(pattern, script.ToString(), processingUnitId);
 }