public void WriteVerbose(PSCmdletBase cmdlet, object obj) { if (UnitTestMode) { UnitTestOutput.CheckInitialized(); UnitTestOutput.StartAddingOutput(); } string cmdletName = "? : "; string objectString = string.Empty; try { objectString = obj.ToString(); } catch {} if (null != cmdlet) { try { cmdletName = CmdletSignature(cmdlet); cmdlet.WriteVerbose(cmdletName + objectString); } catch { cmdlet.WriteVerbose(cmdletName + "failed"); } } else { cmdlet.WriteVerbose(cmdletName + objectString); } }
public void WriteTrace(PSCmdletBase cmdlet, object obj) { if (EnableTrace) { Console.WriteLine(obj); } }
protected string CmdletSignature(PSCmdletBase cmdlet) { string result = CmdletName(cmdlet); result += ": "; return(result); }
public virtual void WriteObject(PSCmdletBase cmdlet, string outputObject) { if (UnitTestMode) { UnitTestOutput.CheckInitialized(); UnitTestOutput.StartAddingOutput(); } writeSingleObject(cmdlet, outputObject); }
public void WriteObject(PSCmdletBase cmdlet, object outputObject) { if (UnitTestMode) { UnitTestOutput.CheckInitialized(); UnitTestOutput.StartAddingOutput(); } // cmdlet.WriteVerbose(cmdlet, "outputting the object"); writeSingleObject(cmdlet, outputObject); }
public virtual void WriteObject(PSCmdletBase cmdlet, Hashtable outputObjectCollection) { BeforeWriteCollection(cmdlet, outputObjectCollection); if (UnitTestMode) { UnitTestOutput.CheckInitialized(); UnitTestOutput.StartAddingOutput(); } writeSingleObject(cmdlet, outputObjectCollection); AfterWriteCollection(cmdlet, outputObjectCollection); }
void writeSingleError(PSCmdletBase cmdlet, ErrorRecord errorRecord, bool terminating) { // if (CheckSingleObject(cmdlet, outputObject)) { // cmdlet.WriteVerbose(cmdlet, "the output object is not null"); // WriteObjectMethod020Highlight(cmdlet, outputObject); // // WriteObjectMethod030RunScriptBlocks(cmdlet, outputObject); // // WriteObjectMethod040SetTestResult(cmdlet, outputObject); // // WriteObjectMethod045OnSuccessScreenshot(cmdlet, outputObject); // // WriteObjectMethod050OnSuccessDelay(cmdlet, outputObject); // TODO // single error //BeforeWriteSingleObject(cmdlet, outputObject); //WriteSingleObject(cmdlet, outputObject); try { if (UnitTestMode) { UnitTestOutput.Add(errorRecord); } else { // WriteObjectMethod060OutputResult(cmdlet, outputObject); WriteSingleError(cmdlet, errorRecord, terminating); } } catch {} //WriteObjectMethod060OutputResult(cmdlet, outputObject); // TODO // single error //AfterWriteSingleObject(cmdlet, outputObject); // WriteObjectMethod070Report(cmdlet, outputObject); //WriteObjectMethod080ReportFailure(); // } else { // // } }
public virtual void WriteObject(PSCmdletBase cmdlet, IList outputObjectCollection) { BeforeWriteCollection(cmdlet, outputObjectCollection); if (UnitTestMode) { UnitTestOutput.CheckInitialized(); UnitTestOutput.StartAddingOutput(); } foreach (object item in outputObjectCollection) { writeSingleObject(cmdlet, item); } AfterWriteCollection(cmdlet, outputObjectCollection); }
public virtual void WriteObject(PSCmdletBase cmdlet, object[] outputObjectCollection) { BeforeWriteCollection(cmdlet, outputObjectCollection); if (UnitTestMode) { UnitTestOutput.CheckInitialized(); UnitTestOutput.StartAddingOutput(); } for (int i = 0; i < outputObjectCollection.Length; i++) { writeSingleObject(cmdlet, outputObjectCollection[i]); } AfterWriteCollection(cmdlet, outputObjectCollection); }
void writeSingleObject(PSCmdletBase cmdlet, object outputObject) { if (CheckSingleObject(cmdlet, outputObject)) { cmdlet.WriteVerbose(cmdlet, "the output object is not null"); // WriteObjectMethod020Highlight(cmdlet, outputObject); // // WriteObjectMethod030RunScriptBlocks(cmdlet, outputObject); // // WriteObjectMethod040SetTestResult(cmdlet, outputObject); // // WriteObjectMethod045OnSuccessScreenshot(cmdlet, outputObject); // // WriteObjectMethod050OnSuccessDelay(cmdlet, outputObject); BeforeWriteSingleObject(cmdlet, outputObject); //WriteSingleObject(cmdlet, outputObject); try { if (UnitTestMode) { UnitTestOutput.Add(outputObject); } else { // WriteObjectMethod060OutputResult(cmdlet, outputObject); WriteSingleObject(cmdlet, outputObject); } } catch {} //WriteObjectMethod060OutputResult(cmdlet, outputObject); AfterWriteSingleObject(cmdlet, outputObject); // WriteObjectMethod070Report(cmdlet, outputObject); //WriteObjectMethod080ReportFailure(); } else { } }
public virtual void WriteObject(PSCmdletBase cmdlet, ICollection outputObjectCollection) { BeforeWriteCollection(cmdlet, outputObjectCollection); if (UnitTestMode) { UnitTestOutput.CheckInitialized(); UnitTestOutput.StartAddingOutput(); } foreach (var outputObject in outputObjectCollection) { // this.WriteVerbose(this, "something to output!!!!!!!!!!1"); //WriteObject(cmdlet, outputObject); writeSingleObject(cmdlet, outputObject); } AfterWriteCollection(cmdlet, outputObjectCollection); }
public virtual void WriteObject(PSCmdletBase cmdlet, IEnumerable outputObjectCollection) { BeforeWriteCollection(cmdlet, outputObjectCollection); if (UnitTestMode) { UnitTestOutput.CheckInitialized(); UnitTestOutput.StartAddingOutput(); } IEnumerator en = outputObjectCollection.GetEnumerator(); while (en.MoveNext()) { writeSingleObject(cmdlet, en.Current); } AfterWriteCollection(cmdlet, outputObjectCollection); }
public virtual void WriteObject(PSCmdletBase cmdlet, ArrayList outputObjectCollection) { BeforeWriteCollection(cmdlet, outputObjectCollection); if (UnitTestMode) { UnitTestOutput.CheckInitialized(); //UnitTestOutput.Add(outputObjectCollection); UnitTestOutput.StartAddingOutput(); } for (int i = 0; i < outputObjectCollection.Count; i++) { WriteObject(cmdlet, outputObjectCollection[i]); } AfterWriteCollection(cmdlet, outputObjectCollection); }
protected override void WriteSingleObject(PSCmdletBase cmdlet, object outputObject) { //WriteVerbose(this, " TAMS"); try { base.WriteObject(outputObject); if (Preferences.AutoLog) { string reportString = CmdletSignature(((CommonCmdletBase)cmdlet)); reportString += outputObject.ToString(); this.WriteLog(LogLevels.Info, reportString); } } catch {} }
protected override void WriteSingleObject(PSCmdletBase cmdlet, object outputObject) { //WriteVerbose(this, " ExampleCustomTestReport"); try { base.WriteObject(outputObject); // if (Preferences.AutoLog) { // // string reportString = // CmdletSignature(((CommonCmdletBase)cmdlet)); // // reportString += // // // this.WriteLog(LogLevels.Info, reportString); // } } catch {} }
// temporary public void WriteVerbose(PSCmdletBase cmdlet, string text) { // 20140314 return; // 20121117 //if (!this.UnitTestMode) { if (!UnitTestMode) { try { string cmdletName = "? : "; if (null != cmdlet) { try { cmdletName = CmdletSignature(cmdlet); cmdlet.WriteVerbose(cmdletName + text); } catch { cmdlet.WriteVerbose(cmdletName + "failed"); } } else { try { cmdlet.WriteVerbose(cmdletName + text); } catch {} } // WriteLog(reportString); // 20130430 WriteLog(LogLevels.Trace, text); } catch (Exception) { // ?? } } }
public virtual void WriteObject(PSCmdletBase cmdlet, List <object> outputObjectCollection) { BeforeWriteCollection(cmdlet, outputObjectCollection); if (UnitTestMode) { UnitTestOutput.CheckInitialized(); UnitTestOutput.StartAddingOutput(); } // 20121117 //for (int i = 0; i < outputObjectCollection.Count; i++) { foreach (var item in outputObjectCollection) { writeSingleObject(cmdlet, item); } //} AfterWriteCollection(cmdlet, outputObjectCollection); }
public void WriteError(PSCmdletBase cmdlet, string message, string errorId, ErrorCategory category, bool terminating) { if (UnitTestMode) { UnitTestOutput.CheckInitialized(); UnitTestOutput.StartAddingOutput(); } var err = new ErrorRecord( new Exception(message), errorId, category, null); err.ErrorDetails = new ErrorDetails(message); //WriteError(cmdlet, err, terminating); writeSingleError(cmdlet, err, terminating); }
//protected string CmdletName(PSCmdletBase cmdlet) public string CmdletName(PSCmdletBase cmdlet) { string result = String.Empty; if (null == cmdlet) { return(result); } result = cmdlet.GetType().Name; if (result.Contains("Uia")) { result = result.Replace("Uia", "-Uia"); } else if (result.Contains("Tmx")) { result = result.Replace("Tmx", "-Tmx"); } else if (result.Contains("ESXi")) { result = result.Replace("ESXi", "-ESXi"); } else if (result.Contains("TAMS")) { result = result.Replace("TAMS", "-TAMS"); } else if (result.Contains("Dt")) { result = result.Replace("Dt", "-Dt"); } else if (result.Contains("Tu")) { result = result.Replace("Tu", "-Tu"); } else if (result.Contains("Se")) { result = result.Replace("Se", "-Se"); } result = result.Replace("Command", ""); return(result); }
//protected abstract void BeforeWriteError(PSCmdletBase cmdlet, ErrorRecord errorRecord); //protected abstract void WriteErrorObject(PSCmdletBase cmdlet, ErrorRecord errorRecord); //protected abstract void AfterWriteError(PSCmdletBase cmdlet, ErrorRecord errorRecord); public void WriteError(PSCmdletBase cmdlet, ErrorRecord errorRecord, bool terminating) { // run error script blocks WriteErrorMethod010RunScriptBlocks(cmdlet);; // add test result detail // close test result WriteErrorMethod020SetTestResult(cmdlet, errorRecord); // set the Turbo timeout WriteErrorMethod030ChangeTimeoutSettings(cmdlet, terminating); // write to the Error list WriteErrorMethod040AddErrorToErrorList(cmdlet, errorRecord); // on error screenshot WriteErrorMethod045OnErrorScreenshot(cmdlet); // on error sleep WriteErrorMethod050OnErrorDelay(cmdlet); //BeforeWriteError(cmdlet, errorRecord); // output the error //WriteErrorObject(cmdlet, errorRecord); WriteErrorMethod060OutputError(cmdlet, errorRecord, terminating); //AfterWriteError(cmdlet, errorRecord); // ? ? ? ? WriteErrorMethod070Report(cmdlet); //, outputObject); }
protected abstract void WriteErrorMethod050OnErrorDelay(PSCmdletBase cmdlet);
protected override void WriteErrorMethod010RunScriptBlocks(PSCmdletBase cmdlet) { this.WriteVerbose(this, " Data"); }
protected override void WriteErrorMethod060OutputError(PSCmdletBase cmdlet, ErrorRecord errorRecord, bool terminating) { if (terminating) { //this.WriteVerbose(this, "terminating error !!!"); try { // 20130430 // 20140317 // turning off the logger // WriteLog(LogLevels.Fatal, errorRecord); ThrowTerminatingError(errorRecord); } catch {} } else { //this.WriteVerbose(this, "regular error !!!"); try { // 20130430 WriteLog(LogLevels.Error, errorRecord); WriteError(errorRecord); } catch {} } }
protected override void WriteSingleObject(PSCmdletBase cmdlet, object outputObject) { //WriteVerbose(this, " TMX"); try { // 20140314 // base.WriteObject(outputObject); WriteObject(outputObject); } catch {} }
protected override void WriteErrorMethod070Report(PSCmdletBase cmdlet) { throw new NotImplementedException(); }
protected override void WriteErrorMethod050OnErrorDelay(PSCmdletBase cmdlet) { throw new NotImplementedException(); }
protected abstract void WriteErrorMethod030ChangeTimeoutSettings(PSCmdletBase cmdlet, bool terminating);
protected abstract void WriteErrorMethod010RunScriptBlocks(PSCmdletBase cmdlet);
protected abstract void WriteErrorMethod040AddErrorToErrorList(PSCmdletBase cmdlet, ErrorRecord errorRecord);
protected abstract void WriteErrorMethod070Report(PSCmdletBase cmdlet);
protected abstract void WriteErrorMethod060OutputError(PSCmdletBase cmdlet, ErrorRecord errorRecord, bool terminating);
protected override void WriteErrorMethod060OutputError(PSCmdletBase cmdlet, ErrorRecord errorRecord, bool terminating) { if (terminating) { this.WriteVerbose(this, "terminating error !!!"); try { ThrowTerminatingError(errorRecord); } catch {} } else { this.WriteVerbose(this, "regular error !!!"); try { WriteError(errorRecord); } catch {} } }
protected override void WriteSingleObject(PSCmdletBase cmdlet, object outputObject) { try { base.WriteObject(outputObject); } catch {} }
protected abstract void WriteSingleError(PSCmdletBase cmdlet, ErrorRecord errorRecord, bool terminating);
protected override void WriteErrorMethod045OnErrorScreenshot(PSCmdletBase cmdlet) { throw new NotImplementedException(); }
protected override void AfterWriteCollection(PSCmdletBase cmdlet, ArrayList outputObjectCollection) { }
protected override void WriteErrorMethod060OutputError(PSCmdletBase cmdlet, ErrorRecord errorRecord, bool terminating) { throw new NotImplementedException(); }
protected override void AfterWriteSingleObject(PSCmdletBase cmdlet, object outputObject) { }
/// <summary> /// Retrieves such element's properties as AutomationId, Name, Class(Name) and Value /// </summary> /// <param name="cmdlet">cmdlet to report</param> /// <param name="element">The element properties taken from</param> /// <param name="propertyName">The name of property</param> /// <param name="pattern">an object of the ValuePattern type</param> /// <param name="hasName">an object has Name</param> /// <returns></returns> internal static string GetElementPropertyString( this IUiElement element, PSCmdletBase cmdlet, string propertyName, IValuePattern pattern, ref bool hasName) { string tempString = string.Empty; try { switch (propertyName) { case "Name": if (!string.IsNullOrEmpty(element.GetCurrent().Name)) { tempString = element.GetCurrent().Name; hasName = true; } break; case "AutomationId": if (!string.IsNullOrEmpty(element.GetCurrent().AutomationId)) { tempString = element.GetCurrent().AutomationId; } break; case "Class": if (!string.IsNullOrEmpty(element.GetCurrent().ClassName)) { tempString = element.GetCurrent().ClassName; } break; case "Value": try { if (!string.IsNullOrEmpty(pattern.Current.Value)) { tempString = pattern.Current.Value; hasName = true; } } catch {} break; case "Win32": if (0 < element.GetCurrent().NativeWindowHandle) { tempString = "."; } break; default: break; } } catch { switch (propertyName) { case "Name": if (!string.IsNullOrEmpty(element.GetCached().Name)) { tempString = element.GetCached().Name; hasName = true; } break; case "AutomationId": if (!string.IsNullOrEmpty(element.GetCached().AutomationId)) { tempString = element.GetCached().AutomationId; } break; case "Class": if (!string.IsNullOrEmpty(element.GetCached().ClassName)) { tempString = element.GetCached().ClassName; } break; case "Value": try { if (!string.IsNullOrEmpty(pattern.Cached.Value)) { tempString = pattern.Cached.Value; hasName = true; } } catch {} break; case "Win32": if (0 < element.GetCached().NativeWindowHandle) { tempString = "."; } break; default: break; } } if (string.IsNullOrEmpty(tempString)) { return string.Empty; } else { if ("Win32" == propertyName) { tempString = " -" + propertyName; } else { tempString = " -" + propertyName + " '" + tempString + "'"; } return tempString; } }
protected override void BeforeWriteCollection(PSCmdletBase cmdlet, IList outputObjectCollection) { }
// 20131113 protected override void WriteSingleError(PSCmdletBase cmdlet, ErrorRecord errorRecord, bool terminating) { WriteErrorMethod010RunScriptBlocks(cmdlet); WriteErrorMethod020SetTestResult(cmdlet, errorRecord); WriteErrorMethod030ChangeTimeoutSettings(cmdlet, terminating); WriteErrorMethod040AddErrorToErrorList(cmdlet, errorRecord); WriteErrorMethod045OnErrorScreenshot(cmdlet); WriteErrorMethod050OnErrorDelay(cmdlet); WriteErrorMethod060OutputError(cmdlet, errorRecord, terminating); WriteErrorMethod070Report(cmdlet); }
protected override void WriteErrorMethod030ChangeTimeoutSettings(PSCmdletBase cmdlet, bool terminating) { this.WriteVerbose(this, " Data"); }
protected override bool CheckSingleObject(PSCmdletBase cmdlet, object outputObject) { return true; }
protected override void WriteErrorMethod045OnErrorScreenshot(PSCmdletBase cmdlet) { WriteVerbose(this, "WriteErrorMethod045OnErrorScreenshot Data"); }
protected override void WriteErrorMethod020SetTestResult(PSCmdletBase cmdlet, ErrorRecord errorRecord) { this.WriteVerbose(this, " Data"); }
protected abstract void WriteErrorMethod045OnErrorScreenshot(PSCmdletBase cmdlet);
protected override void WriteErrorMethod040AddErrorToErrorList(PSCmdletBase cmdlet, ErrorRecord errorRecord) { this.WriteVerbose(this, " Data"); }
protected override void WriteErrorMethod020SetTestResult(PSCmdletBase cmdlet, ErrorRecord errorRecord) { throw new NotImplementedException(); }
protected override void WriteErrorMethod050OnErrorDelay(PSCmdletBase cmdlet) { this.WriteVerbose(this, " Data"); }
protected override void WriteErrorMethod030ChangeTimeoutSettings(PSCmdletBase cmdlet, bool terminating) { throw new NotImplementedException(); }
protected override void WriteErrorMethod070Report(PSCmdletBase cmdlet) { this.WriteVerbose(this, " Data"); }
protected override void WriteErrorMethod040AddErrorToErrorList(PSCmdletBase cmdlet, ErrorRecord errorRecord) { throw new NotImplementedException(); }
protected override void AfterWriteCollection(PSCmdletBase cmdlet, object[] outputObjectCollection) { }
protected abstract void WriteErrorMethod020SetTestResult(PSCmdletBase cmdlet, ErrorRecord errorRecord);
protected override void AfterWriteCollection(PSCmdletBase cmdlet, Hashtable outputObjectCollection) { }
// 20150915 //protected string ConvertHashtableToString(Hashtable hashtable) //{ // string result = string.Empty; // if (null == hashtable || 0 == hashtable.Count) { // return result; // } // result += "@{"; // foreach (var key in hashtable.Keys) // result += key + "=" + hashtable[key] + ";"; // result += "}"; // return result; //} // 20150915 //protected string ConvertHashtablesArrayToString(Hashtable[] hashtables) //{ // string result = string.Empty; // if (null == hashtables || 0 == hashtables.Length) { // return result; // } // foreach (Hashtable hashtable in hashtables) { // result += ","; // // 20150915 // // result += ConvertHashtableToString(hashtable); // result += hashtable.ConvertToString(); // } // result = result.Substring(1); // return result; //} #endregion utilities // // 20130318 // //protected System.Collections.Generic.Dictionary<string, string> ConvertHashtableToDictionary( // protected System.Collections.Generic.Dictionary<string, object> ConvertHashtableToDictionary( // Hashtable hashtable) // { // // 20130318 // //System.Collections.Generic.Dictionary<string, string> dict = // // new System.Collections.Generic.Dictionary<string, string>(); // System.Collections.Generic.Dictionary<string, object> dict = // new System.Collections.Generic.Dictionary<string, object>(); // // this.WriteVerbose(this, hashtable.Keys.Count.ToString()); // // foreach (string key1 in hashtable.Keys) { // // string keyUpper = key1.ToUpper(); // // this.WriteVerbose(this, "found key: " + keyUpper); // // // 20130318 // //dict.Add(keyUpper, hashtable[key1].ToString()); // // 20130506 // //dict.Add(keyUpper, hashtable[key1]); // var rawData = hashtable[key1]; // dict.Add(keyUpper, rawData); // // this.WriteVerbose( // this, // "added to the dictionary: " + // keyUpper + // " = " + // dict[keyUpper].ToString()); // } // //// foreach (string key2 in hashtable.Keys.Cast<string>().ToList().Any<string>(k => dict.Add(k.ToUpper(), hashtable[k.ToUpper()]))) { //// //// } // // return dict; // } protected internal void runTwoScriptBlockCollections( ScriptBlock[] scriptblocksSet1, ScriptBlock[] scriptblocksSet2, PSCmdletBase cmdlet, object[] parameters) { cmdlet.WriteVerbose(cmdlet, "preparing scriptblocks"); var scriptblocks = new List <ScriptBlock>(); try { if (scriptblocksSet1 != null && scriptblocksSet1.Length > 0) { foreach (var sb in scriptblocksSet1) { scriptblocks.Add(sb); } } if (scriptblocksSet2 != null && scriptblocksSet2.Length > 0) { foreach (var sb in scriptblocksSet2) { scriptblocks.Add(sb); } } // if (null == scriptblocks || 0 == scriptblocks.Count) { // // cmdlet.WriteVerbose(cmdlet, "there is no any StopAction scriptblock"); // // //throw new Exception("There are no StopAction scriptblocks, define at least one"); // cmdlet.WriteError( // cmdlet, // "There are no StopAction scriptblocks, define at least one", // "NoStopActionScriptblocks", // ErrorCategory.InvalidArgument, // true); // } // cmdlet.WriteVerbose(cmdlet, "scriptblocks were prepared"); } catch (Exception eScriptblocksPreparation) { // cmdlet.WriteVerbose(cmdlet, "Scriptblocks are not going to be run"); // // cmdlet.WriteVerbose(cmdlet, eScriptblocksPreparation.Message); cmdlet.WriteError( cmdlet, eScriptblocksPreparation.Message, "ScriptblocksNotPrepared", ErrorCategory.InvalidOperation, true); } //runScriptBlocks(scriptblocks, cmdlet, false); try { // cmdlet.WriteVerbose(cmdlet, "running scriptblocks"); //runScriptBlocks(scriptblocks, cmdlet, false, parameters); if (null != scriptblocks && 0 < scriptblocks.Count) { runScriptBlocks(scriptblocks, cmdlet, false, parameters); } // cmdlet.WriteVerbose(cmdlet, "Scriptblocks finished successfully"); } catch (Exception eScriptBlocks) { // cmdlet.WriteVerbose(cmdlet, "Scriptblocks failed"); // // cmdlet.WriteVerbose(cmdlet, eScriptBlocks.Message); cmdlet.WriteError( cmdlet, eScriptBlocks.Message, "ScriptblocksFailed", ErrorCategory.InvalidResult, true); } }
protected override void BeforeWriteCollection(PSCmdletBase cmdlet, System.Collections.Generic.List<object> outputObjectCollection) { }
public void runScriptBlocks( List <ScriptBlock> scriptblocks, PSCmdletBase cmdlet, bool eventHandlers, object[] parameters) { try { if (scriptblocks != null && scriptblocks.Count > 0) { // cmdlet.WriteVerbose(cmdlet, "there are " + scriptblocks.Count + " scriptblock(s) to run"); foreach (var sb in scriptblocks) { if (sb != null) { try { if (eventHandlers) { // cmdlet.WriteVerbose(cmdlet, "run event handler"); var runner = new runScriptBlock(runSBEvent); runner(sb, cmdlet.EventSource, cmdlet.EventArgs); } else { // cmdlet.WriteVerbose(cmdlet, "run action with parameters"); //runScriptBlock runner = new runScriptBlock(runSBAction); //runner(sb, cmdlet.EventSource, cmdlet.EventArgs); var runnerWithParams = new runScriptBlockWithParameters(runSBActionWithParams); // cmdlet.WriteVerbose(cmdlet, "the scriptblock runner has been created"); // 20130606 try { cmdlet.WriteVerbose(cmdlet, "listing parameters"); if (null == parameters || 0 == parameters.Length) { cmdlet.WriteVerbose(cmdlet, "there are no parameters"); } else { foreach (var singleParam in parameters) { cmdlet.WriteVerbose(cmdlet, singleParam); } } } catch (Exception eListParameters) { cmdlet.WriteVerbose(cmdlet, eListParameters.Message); } runnerWithParams(sb, parameters); // cmdlet.WriteVerbose(cmdlet, "the scriptblock runner has finished"); } } catch (Exception) { // 20130318 // ErrorRecord err = // new ErrorRecord( // eInner, // "InvokeException", // ErrorCategory.OperationStopped, // sb); // err.ErrorDetails = // new ErrorDetails("Error in " + // sb.ToString()); // WriteError(this, err, false); // this.WriteError( // this, // "Error in " + // sb.ToString() + // ". " + // eInner.Message, // "InvokeException", // ErrorCategory.OperationStopped, // // 20130318 // //false); // true); // cmdlet.WriteVerbose(cmdlet, eInner.Message); throw new Exception("Failed to run scriptblock"); } } } } } catch (Exception) { // WriteError(this, // new ErrorRecord(eOuter, "runScriptBlocks", ErrorCategory.InvalidArgument, null), // true); // this.WriteError( // this, // eOuter.Message, // "runScriptBlocks", // ErrorCategory.InvalidArgument, // true); // cmdlet.WriteVerbose(cmdlet, eOuter.Message); throw new Exception("Failed to run scriptblocks"); } }
protected override void BeforeWriteCollection(PSCmdletBase cmdlet, IEnumerable outputObjectCollection) { }
protected abstract void AfterWriteCollection(PSCmdletBase cmdlet, Hashtable outputObjectCollection);