} // end ResetState() internal static string FormatSingleLineDirect(object obj) { if (null == obj) { return(String.Empty); } PSObject pso = obj as PSObject; if (null == pso) { pso = new PSObject(obj); } var view = AltFormattingManager.ChooseFormatInfoForPSObject <AltSingleLineViewDefinition>(pso); ScriptBlock script; if (null != view) { script = view.Script; } else { script = sm_DefaultScript; } return(FormatSingleLineDirect(pso, script)); }
protected override void ProcessRecord() { base.ProcessRecord(); // BUG: Hmm... we don't support wildcards, and we don't complain if nothing is // removed. Oh well. AltFormattingManager.RemoveByName(TypeName); } // end ProcessRecord()
} // end ProcessRecord() protected override void EndProcessing() { using (var pipe = GetPipelineCallback()) { AltFormattingManager.Reload(InvokeCommand, m_appendPaths, m_prependPaths, pipe); } } // end EndProcessing()
// TODO: -All parameter? protected override void ProcessRecord() { base.ProcessRecord(); IFormatInfo fi = AltFormattingManager.ChooseFormatInfoForPSObject(ForObject, FormatInfoType); if (null != fi) { WriteObject(fi); } } // end ProcessRecord()
protected override void ProcessRecord() { base.ProcessRecord(); if (null != InputObject) { Util.Assert(ParameterSetName == c_PSObjectParamSet); foreach (var fep in AltFormattingManager.EnumerateAllFormatInfoForPSObject(InputObject, FormatInfoType)) { WriteObject(fep); } return; } var map = AltFormattingManager.GetEntries(); if (String.IsNullOrEmpty(TypeName)) { foreach (string key in map.Keys) { foreach (var viewInfo in map[key]) { if ((null == FormatInfoType) || (FormatInfoType.IsAssignableFrom(viewInfo.ViewDefinition.GetType()))) { WriteObject(new AltTypeFormatEntryPair(key, viewInfo)); } } } } else if (WildcardPattern.ContainsWildcardCharacters(TypeName)) { WildcardPattern pattern = new WildcardPattern(TypeName, WildcardOptions.CultureInvariant | WildcardOptions.IgnoreCase); foreach (string key in map.Keys) { if (pattern.IsMatch(key)) { foreach (var viewInfo in map[key]) { if ((null == FormatInfoType) || (FormatInfoType.IsAssignableFrom(viewInfo.ViewDefinition.GetType()))) { WriteObject(new AltTypeFormatEntryPair(key, viewInfo)); } } } } } else { IReadOnlyList <ViewDefinitionInfo> list; if (!map.TryGetValue(TypeName, out list)) { SafeWriteError(Util.Sprintf("There is no type format entry for type name '{0}'.", TypeName), "TypeNameNotFound", ErrorCategory.ObjectNotFound, TypeName); } else { foreach (var formatInfo in list) { if ((null == FormatInfoType) || (FormatInfoType.IsAssignableFrom(formatInfo.ViewDefinition.GetType()))) { WriteObject(new AltTypeFormatEntryPair(TypeName, formatInfo)); } } } } } // end ProcessRecord()
protected override void ProcessRecord() { base.ProcessRecord(); AltFormattingManager.RegisterViewDefinition(Entry); } // end ProcessRecord()
} // end ProcessRecord() protected override void EndProcessing() { AltFormattingManager.ScrubFileList(); base.EndProcessing(); }
protected override void ProcessRecord() { base.ProcessRecord(); AltFormattingManager.SetDefaultFormatInfoForObject(ForObject, FormatInfo); } // end ProcessRecord()