internal override void ProcessInputObject(PSObject input) { // Find out if the input has matching types in the this.appliesTo collection. foreach (TypeOrGroupReference typeOrGroupRef in _appliesTo.referenceList) { if (typeOrGroupRef is TypeReference) { // Add deserialization prefix. string deserializedTypeName = typeOrGroupRef.name; Deserializer.AddDeserializationPrefix(ref deserializedTypeName); for (int i = 0; i < input.TypeNames.Count; i++) { if (typeOrGroupRef.name.Equals(input.TypeNames[i], StringComparison.OrdinalIgnoreCase) || deserializedTypeName.Equals(input.TypeNames[i], StringComparison.OrdinalIgnoreCase)) { // Current view supports the input's Type; // Add the input PSObject as an item to the underlying Management List. base.parentCmd._windowProxy.AddItem(input); return; } } } else { // Find out if the input's Type belongs to the current TypeGroup. // TypeGroupReference has only a group's name, so use the database to get through all actual TypeGroup's. List <TypeGroupDefinition> typeGroupList = base.parentCmd._typeInfoDataBase.typeGroupSection.typeGroupDefinitionList; foreach (TypeGroupDefinition typeGroup in typeGroupList) { if (typeGroup.name.Equals(typeOrGroupRef.name, StringComparison.OrdinalIgnoreCase)) { // A matching TypeGroup is found in the database. // Find out if the input's Type belongs to this TypeGroup. foreach (TypeReference typeRef in typeGroup.typeReferenceList) { // Add deserialization prefix. string deserializedTypeName = typeRef.name; Deserializer.AddDeserializationPrefix(ref deserializedTypeName); if (input.TypeNames.Count > 0 && (typeRef.name.Equals(input.TypeNames[0], StringComparison.OrdinalIgnoreCase) || deserializedTypeName.Equals(input.TypeNames[0], StringComparison.OrdinalIgnoreCase))) { // Current view supports the input's Type; // Add the input PSObject as an item to the underlying Management List. base.parentCmd._windowProxy.AddItem(input); return; } } } } } } // The input's Type is not supported by the current view; // Switch to the Hetero Type view. parentCmd._gridHeader = new HeteroTypeHeader(base.parentCmd, input); }
internal override void ProcessInputObject(PSObject input) { foreach (TypeOrGroupReference reference in this.appliesTo.referenceList) { if (reference is TypeReference) { string name = reference.name; Deserializer.AddDeserializationPrefix(ref name); for (int i = 0; i < input.TypeNames.Count; i++) { if (reference.name.Equals(input.TypeNames[i], StringComparison.OrdinalIgnoreCase) || name.Equals(input.TypeNames[i], StringComparison.OrdinalIgnoreCase)) { base.parentCmd.windowProxy.AddItem(input); return; } } } else { foreach (TypeGroupDefinition definition in base.parentCmd.typeInfoDataBase.typeGroupSection.typeGroupDefinitionList) { if (definition.name.Equals(reference.name, StringComparison.OrdinalIgnoreCase)) { foreach (TypeReference reference2 in definition.typeReferenceList) { string type = reference2.name; Deserializer.AddDeserializationPrefix(ref type); if ((input.TypeNames.Count > 0) && (reference2.name.Equals(input.TypeNames[0], StringComparison.OrdinalIgnoreCase) || type.Equals(input.TypeNames[0], StringComparison.OrdinalIgnoreCase))) { base.parentCmd.windowProxy.AddItem(input); return; } } } } } } base.parentCmd.gridHeader = new OutGridViewCommand.HeteroTypeHeader(base.parentCmd, input); }