示例#1
0
        protected override void ProcessRecord()
        {
            History history = ((LocalRunspace)base.Context.CurrentRunspace).History;

            if (this.InputObject != null)
            {
                foreach (PSObject obj2 in this.InputObject)
                {
                    HistoryInfo historyInfoObject = this.GetHistoryInfoObject(obj2);
                    if (historyInfoObject != null)
                    {
                        long id = history.AddEntry(0L, historyInfoObject.CommandLine, historyInfoObject.ExecutionStatus, historyInfoObject.StartExecutionTime, historyInfoObject.EndExecutionTime, false);
                        if (this.Passthru != 0)
                        {
                            HistoryInfo entry = history.GetEntry(id);
                            base.WriteObject(entry);
                        }
                    }
                }
            }
        }
示例#2
0
 protected override void ProcessRecord()
 {
     using (AddHistoryCommand._trace.TraceMethod())
     {
         History history = ((LocalRunspace)this.Context.CurrentRunspace).History;
         if (this.InputObject == null)
         {
             return;
         }
         foreach (PSObject mshObject in this.InputObject)
         {
             HistoryInfo historyInfoObject = this.GetHistoryInfoObject(mshObject);
             if (historyInfoObject != null)
             {
                 long id = history.AddEntry(0L, historyInfoObject.CommandLine, historyInfoObject.ExecutionStatus, historyInfoObject.StartExecutionTime, historyInfoObject.EndExecutionTime, false);
                 if ((bool)this.Passthru)
                 {
                     this.WriteObject((object)history.GetEntry(id));
                 }
             }
         }
     }
 }