internal override object GetValue(PSObject liveObject) { object baseObject = liveObject.BaseObject; if (baseObject.GetType().Equals(this.type)) { return(ColumnInfo.LimitString(baseObject)); } return(null); }
internal override Object GetValue(PSObject liveObject) { // Strip a wrapping PSObject. object baseObject = ((PSObject)liveObject).BaseObject; if (baseObject.GetType().Equals(_type)) { return(ColumnInfo.LimitString(baseObject)); } return(null); }
internal override object GetValue(PSObject liveObject) { try { PSPropertyInfo propertyInfo = liveObject.Properties[_liveObjectPropertyName]; if (propertyInfo == null) { return(null); } // The live object has the liveObjectPropertyName property. object liveObjectValue = propertyInfo.Value; ICollection collectionValue = liveObjectValue as ICollection; if (collectionValue != null) { liveObjectValue = _parentCmdlet.ConvertToString(PSObjectHelper.AsPSObject(propertyInfo.Value)); } else { PSObject psObjectValue = liveObjectValue as PSObject; if (psObjectValue != null) { // Since PSObject implements IComparable there is a need to verify if its BaseObject actually implements IComparable. if (psObjectValue.BaseObject is IComparable) { liveObjectValue = psObjectValue; } else { // Use the String type as default. liveObjectValue = _parentCmdlet.ConvertToString(psObjectValue); } } } return(ColumnInfo.LimitString(liveObjectValue)); } catch (GetValueException) { // ignore } catch (ExtendedTypeSystemException) { // ignore } return(null); }
internal override object GetValue(PSObject liveObject) { List <PSPropertyExpressionResult> resList = _expression.GetValues(liveObject); if (resList.Count == 0) { return(null); } // Only first element is used. PSPropertyExpressionResult result = resList[0]; if (result.Exception != null) { return(null); } object objectResult = result.Result; return(objectResult == null ? string.Empty : ColumnInfo.LimitString(objectResult.ToString())); }
internal override Object GetValue(PSObject liveObject) { // Convert to a string preserving PowerShell formatting. return(ColumnInfo.LimitString(_parentCmdlet.ConvertToString(liveObject))); }
internal override object GetValue(PSObject liveObject) { return(ColumnInfo.LimitString(this.parentCmdlet.ConvertToString(liveObject))); }