internal PSObject AddColumnsToWindow(OutWindowProxy windowProxy, PSObject liveObject) { PSObject staleObject = new PSObject(); // Initiate arrays to be of the same size. int count = _columns.Count; string[] propertyNames = new string[count]; string[] displayNames = new string[count]; Type[] types = new Type[count]; count = 0; // Reuse this variable to count cycles. foreach (ColumnInfo column in _columns) { propertyNames[count] = column.StaleObjectPropertyName(); displayNames[count] = column.DisplayName(); object columnValue = null; types[count] = column.GetValueType(liveObject, out columnValue); // Add a property to the stale object since a column value has been evaluated to get column's type. staleObject.Properties.Add(new PSNoteProperty(propertyNames[count], columnValue)); count++; } windowProxy.AddColumns(propertyNames, displayNames, types); return(staleObject); }
internal PSObject AddColumnsToWindow(OutWindowProxy windowProxy, PSObject liveObject) { PSObject staleObject = new PSObject(); // Initiate arrays to be of the same size. int count = _columns.Count; string[] propertyNames = new string[count]; string[] displayNames = new string[count]; Type[] types = new Type[count]; count = 0; // Reuse this variable to count cycles. foreach (ColumnInfo column in _columns) { propertyNames[count] = column.StaleObjectPropertyName(); displayNames[count] = column.DisplayName(); Object columnValue = null; types[count] = column.GetValueType(liveObject, out columnValue); // Add a property to the stale object since a column value has been evaluated to get column's type. staleObject.Properties.Add(new PSNoteProperty(propertyNames[count], columnValue)); count++; } windowProxy.AddColumns(propertyNames, displayNames, types); return staleObject; }
private void Dispose(bool isDisposing) { if (isDisposing && (this.windowProxy != null)) { this.windowProxy.Dispose(); this.windowProxy = null; } }
/// <summary> /// Implements IDisposable logic. /// </summary> /// <param name="isDisposing">true if being called from Dispose</param> private void Dispose(bool isDisposing) { if (isDisposing) { if (_windowProxy != null) { _windowProxy.Dispose(); _windowProxy = null; } } }
protected override void BeginProcessing() { this.expressionFactory = new MshExpressionFactory(); if (this.title != null) { this.windowProxy = new OutWindowProxy(this.title, this.outputMode, this); } else { this.windowProxy = new OutWindowProxy(base.MyInvocation.Line, this.outputMode, this); } this.typeInfoDataBase = base.Context.FormatDBManager.GetTypeInfoDataBase(); }
/// <summary> /// Provides a one-time, pre-processing functionality for the cmdlet. /// </summary> protected override void BeginProcessing() { // Set up the ExpressionFactory _expressionFactory = new PSPropertyExpressionFactory(); // If the value of the Title parameter is valid, use it as a window's title. if (this.Title != null) { _windowProxy = new OutWindowProxy(this.Title, OutputMode, this); } else { // Using the command line as a title. _windowProxy = new OutWindowProxy(this.MyInvocation.Line, OutputMode, this); } // Load the Type info database. _typeInfoDataBase = this.Context.FormatDBManager.GetTypeInfoDataBase(); }
internal PSObject AddColumnsToWindow(OutWindowProxy windowProxy, PSObject liveObject) { PSObject obj2 = new PSObject(); int count = this.columns.Count; string[] propertyNames = new string[count]; string[] displayNames = new string[count]; Type[] types = new Type[count]; count = 0; foreach (ColumnInfo info in this.columns) { propertyNames[count] = info.StaleObjectPropertyName(); displayNames[count] = info.DisplayName(); object columnValue = null; types[count] = info.GetValueType(liveObject, out columnValue); obj2.Properties.Add(new PSNoteProperty(propertyNames[count], columnValue)); count++; } windowProxy.AddColumns(propertyNames, displayNames, types); return obj2; }
internal PSObject AddColumnsToWindow(OutWindowProxy windowProxy, PSObject liveObject) { PSObject obj2 = new PSObject(); int count = this.columns.Count; string[] propertyNames = new string[count]; string[] displayNames = new string[count]; Type[] types = new Type[count]; count = 0; foreach (ColumnInfo info in this.columns) { propertyNames[count] = info.StaleObjectPropertyName(); displayNames[count] = info.DisplayName(); object columnValue = null; types[count] = info.GetValueType(liveObject, out columnValue); obj2.Properties.Add(new PSNoteProperty(propertyNames[count], columnValue)); count++; } windowProxy.AddColumns(propertyNames, displayNames, types); return(obj2); }
/// <summary> /// Implements IDisposable logic /// </summary> /// <param name="isDisposing">true if being called from Dispose</param> private void Dispose(bool isDisposing) { if (isDisposing) { if (_windowProxy != null) { _windowProxy.Dispose(); _windowProxy = null; } } }
/// <summary> /// Provides a one-time, pre-processing functionality for the cmdlet. /// </summary> protected override void BeginProcessing() { // Set up the ExpressionFactory _expressionFactory = new MshExpressionFactory(); // If the value of the Title parameter is valid, use it as a window's title. if (this.Title != null) { _windowProxy = new OutWindowProxy(this.Title, OutputMode, this); } else { // Using the command line as a title. _windowProxy = new OutWindowProxy(this.MyInvocation.Line, OutputMode, this); } // Load the Type info database. _typeInfoDataBase = this.Context.FormatDBManager.GetTypeInfoDataBase(); }