示例#1
0
 private Array ApplyFormatting(object o)
 {
     if (this.command == null)
     {
         this.command = new CommandWrapper();
         this.command.Initialize(this.OuterCmdlet().Context, "format-default", typeof(FormatDefaultCommand));
     }
     return this.command.Process(o);
 }
示例#2
0
 private void Dispose(bool isDisposing)
 {
     if (!this.alreadyDisposed)
     {
         this.alreadyDisposed = true;
         if (isDisposing && (this.commandWrapper != null))
         {
             this.commandWrapper.Dispose();
             this.commandWrapper = null;
         }
     }
 }
示例#3
0
 protected override void BeginProcessing()
 {
     this.commandWrapper = new CommandWrapper();
     if (string.Equals(base.ParameterSetName, "File", StringComparison.OrdinalIgnoreCase))
     {
         this.commandWrapper.Initialize(base.Context, "out-file", typeof(OutFileCommand));
         this.commandWrapper.AddNamedParameter("filepath", this.fileName);
         this.commandWrapper.AddNamedParameter("append", this.append);
     }
     else if (string.Equals(base.ParameterSetName, "LiteralFile", StringComparison.OrdinalIgnoreCase))
     {
         this.commandWrapper.Initialize(base.Context, "out-file", typeof(OutFileCommand));
         this.commandWrapper.AddNamedParameter("LiteralPath", this.fileName);
         this.commandWrapper.AddNamedParameter("append", this.append);
     }
     else
     {
         this.commandWrapper.Initialize(base.Context, "set-variable", typeof(SetVariableCommand));
         this.commandWrapper.AddNamedParameter("name", this.variable);
     }
 }
示例#4
0
 /// <summary>
 /// 
 /// </summary>
 protected override void BeginProcessing()
 {
     _commandWrapper = new CommandWrapper();
     if (String.Equals(ParameterSetName, "File", StringComparison.OrdinalIgnoreCase))
     {
         _commandWrapper.Initialize(Context, "out-file", typeof(OutFileCommand));
         _commandWrapper.AddNamedParameter("filepath", _fileName);
         _commandWrapper.AddNamedParameter("append", _append);
     }
     else if (String.Equals(ParameterSetName, "LiteralFile", StringComparison.OrdinalIgnoreCase))
     {
         _commandWrapper.Initialize(Context, "out-file", typeof(OutFileCommand));
         _commandWrapper.AddNamedParameter("LiteralPath", _fileName);
         _commandWrapper.AddNamedParameter("append", _append);
     }
     else
     {
         // variable parameter set
         _commandWrapper.Initialize(Context, "set-variable", typeof(SetVariableCommand));
         _commandWrapper.AddNamedParameter("name", _variable);
         // Can't use set-var's passthru because it writes the var object to the pipeline, we want just
         // the values to be written
     }
 }
示例#5
0
 protected override void InternalDispose()
 {
     base.InternalDispose();
     if (this.command != null)
     {
         this.command.Dispose();
         this.command = null;
     }
 }
示例#6
0
 public void Dispose()
 {
     if (this.command != null)
     {
         this.command.Dispose();
         this.command = null;
     }
 }
示例#7
0
            /// <summary>
            /// just dispose of the inner command wrapper
            /// </summary>
            public void Dispose()
            {
                if (this.command == null)
                    return;

                this.command.Dispose();
                this.command = null;
            }