/// <summary> /// Process every input object to group them. /// </summary> protected override void ProcessRecord() { if (InputObject != null && InputObject != AutomationNull.Value) { OrderByPropertyEntry currentEntry = null; if (!_hasProcessedFirstInputObject) { if (Property == null) { Property = OrderByProperty.GetDefaultKeyPropertySet(InputObject); } _orderByProperty.ProcessExpressionParameter(this, Property); currentEntry = _orderByProperty.CreateOrderByPropertyEntry(this, InputObject, CaseSensitive, _cultureInfo); bool[] ascending = new bool[currentEntry.orderValues.Count]; for (int index = 0; index < currentEntry.orderValues.Count; index++) { ascending[index] = true; } _orderByPropertyComparer = new OrderByPropertyComparer(ascending, _cultureInfo, CaseSensitive); _hasProcessedFirstInputObject = true; } else { currentEntry = _orderByProperty.CreateOrderByPropertyEntry(this, InputObject, CaseSensitive, _cultureInfo); } DoGrouping(currentEntry, this.NoElement, _groups, _tupleToGroupInfoMappingDictionary, _orderByPropertyComparer); } }
/// <summary> /// Process every input object to group them. /// </summary> protected override void ProcessRecord() { if (InputObject != null && InputObject != AutomationNull.Value) { OrderByPropertyEntry currentEntry; if (!_hasProcessedFirstInputObject) { if (Property == null) { Property = OrderByProperty.GetDefaultKeyPropertySet(InputObject); } _orderByProperty.ProcessExpressionParameter(this, Property); if (AsString && !AsHashTable) { ArgumentException ex = new ArgumentException(UtilityCommonStrings.GroupObjectWithHashTable); ErrorRecord er = new ErrorRecord(ex, "ArgumentException", ErrorCategory.InvalidArgument, AsString); ThrowTerminatingError(er); } if (AsHashTable && !AsString && (Property != null && (Property.Length > 1 || _orderByProperty.MshParameterList.Count > 1))) { ArgumentException ex = new ArgumentException(UtilityCommonStrings.GroupObjectSingleProperty); ErrorRecord er = new ErrorRecord(ex, "ArgumentException", ErrorCategory.InvalidArgument, Property); ThrowTerminatingError(er); } currentEntry = _orderByProperty.CreateOrderByPropertyEntry(this, InputObject, CaseSensitive, _cultureInfo); bool[] ascending = new bool[currentEntry.orderValues.Count]; for (int index = 0; index < currentEntry.orderValues.Count; index++) { ascending[index] = true; } _orderByPropertyComparer = new OrderByPropertyComparer(ascending, _cultureInfo, CaseSensitive); _hasProcessedFirstInputObject = true; } else { currentEntry = _orderByProperty.CreateOrderByPropertyEntry(this, InputObject, CaseSensitive, _cultureInfo); } _entriesToOrder.Add(currentEntry); var currentEntryOrderValues = currentEntry.orderValues; if (!_hasDifferentValueTypes) { UpdateOrderPropertyTypeInfo(currentEntryOrderValues); } } }