Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / AddIn / AddIn / System / Addin / Hosting / PipelineDeploymentState.cs / 1305376 / PipelineDeploymentState.cs
// ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== /*============================================================ ** ** Class: PipelineDeploymentState ** ** Purpose: Represents all the add-in pipeline components ** in a directory structure. ** ===========================================================*/ using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Globalization; using System.IO; using System.Text; using System.Reflection; using System.AddIn.MiniReflection; using System.Diagnostics.Contracts; namespace System.AddIn.Hosting { [Serializable] internal sealed class PipelineDeploymentState : DeploymentState { private List_hostAdapters; private List _contracts; private List _addinAdapters; private List _addinBases; private List _partialTokens; private List _fileCounts; internal PipelineDeploymentState() { _hostAdapters = new List (); _contracts = new List (); _addinAdapters = new List (); _addinBases = new List (); _fileCounts = new List (new int[]{0,0,0,0}); } internal List HostAdapters { get { return _hostAdapters; } } internal List Contracts { get { return _contracts; } } internal List AddInAdapters { get { return _addinAdapters; } } internal List AddInBases { get { return _addinBases; } } internal List PartialTokens { get { return _partialTokens; } } internal List FileCounts { get { return _fileCounts; } } internal void ConnectPipeline(Collection warnings) { List result = new List (); // For ease of maintanence & debugging for users of the add-in // model, we must make it easy to report which parts are not // usable, due to missing connections with other parts of the // pipeline. // Real connect loop. foreach (HostAdapter hostAdapter in HostAdapters) { foreach (ContractComponent contract in Contracts) { if (!hostAdapter.Constructors.Contains(contract.TypeInfo)) continue; hostAdapter.ConnectedToNeighbors = true; foreach (AddInAdapter addinAdapter in AddInAdapters) { if (!addinAdapter.Contracts.Contains(contract.TypeInfo)) continue; contract.ConnectedToNeighbors = true; foreach (AddInBase addinBase in AddInBases) { if (!addinAdapter.CanConnectTo(addinBase)) continue; addinAdapter.ConnectedToNeighbors = true; addinBase.ConnectedToNeighbors = true; PartialToken partialToken = new PartialToken(hostAdapter, contract, addinAdapter, addinBase); result.Add(partialToken); } // foreach addinBase } // foreach addinAdapter } // foreach contract } // foreach hostAdapter // Look for unconnected parts. int unconnectedParts = 0; unconnectedParts += LookForUnconnectedParts(HostAdapters, warnings); unconnectedParts += LookForUnconnectedParts(Contracts, warnings); unconnectedParts += LookForUnconnectedParts(AddInAdapters, warnings); unconnectedParts += LookForUnconnectedParts(AddInBases, warnings); #if ADDIN_VERBOSE_WARNINGS warnings.Add(String.Format(CultureInfo.CurrentCulture, "PipelineDeploymentState::Connect: Found {0} valid pipelines.", result.Count)); #endif if (unconnectedParts > 0) warnings.Add(String.Format(CultureInfo.CurrentCulture, Res.CouldntConnectNInvalidParts, unconnectedParts)); _partialTokens = result; } private static int LookForUnconnectedParts (IEnumerable parts, Collection warnings) where T : PipelineComponent { int numUnconnected = 0; foreach (PipelineComponent part in parts) { if (!part.ConnectedToNeighbors) { warnings.Add(String.Format(CultureInfo.CurrentCulture, Res.CouldntConnectOnePart, part.ToString())); numUnconnected++; } } return numUnconnected; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- FloatUtil.cs
- DataGrid.cs
- Stroke2.cs
- ToolBar.cs
- MarkupObject.cs
- SuppressIldasmAttribute.cs
- CriticalExceptions.cs
- OneOfElement.cs
- BlockUIContainer.cs
- EntityStoreSchemaGenerator.cs
- MenuItemCollection.cs
- XmlDocument.cs
- MouseWheelEventArgs.cs
- SerialPinChanges.cs
- TagPrefixCollection.cs
- TakeOrSkipQueryOperator.cs
- WebScriptMetadataFormatter.cs
- FilteredXmlReader.cs
- DataGridViewButtonColumn.cs
- CodeAttributeDeclaration.cs
- BindingExpression.cs
- CreateUserWizard.cs
- XmlIncludeAttribute.cs
- DrawingState.cs
- PolyLineSegment.cs
- SimpleWebHandlerParser.cs
- RelationshipType.cs
- FactoryRecord.cs
- VBCodeProvider.cs
- AccessedThroughPropertyAttribute.cs
- WinFormsSpinner.cs
- DetailsViewDeleteEventArgs.cs
- SqlExpressionNullability.cs
- CodeTypeReference.cs
- ListDictionary.cs
- XPathNavigator.cs
- SafeNativeMethods.cs
- SapiGrammar.cs
- ListenerSessionConnectionReader.cs
- NativeCppClassAttribute.cs
- DoWorkEventArgs.cs
- Hashtable.cs
- MatrixTransform3D.cs
- XpsFilter.cs
- CaseStatement.cs
- IisTraceListener.cs
- X509CertificateCollection.cs
- TextBreakpoint.cs
- SafeNativeMethods.cs
- ResourceReferenceExpressionConverter.cs
- SystemIPInterfaceStatistics.cs
- BinaryNode.cs
- Grid.cs
- CustomErrorsSection.cs
- DocumentEventArgs.cs
- base64Transforms.cs
- ColumnHeaderConverter.cs
- ObjectManager.cs
- SHA256Managed.cs
- ManagementInstaller.cs
- AutomationEventArgs.cs
- Int32AnimationUsingKeyFrames.cs
- DoubleAnimation.cs
- BuildProviderCollection.cs
- CharConverter.cs
- BuildProviderCollection.cs
- InitiatorSessionSymmetricTransportSecurityProtocol.cs
- CodeBinaryOperatorExpression.cs
- FixedSOMPageConstructor.cs
- DescriptionAttribute.cs
- TimeIntervalCollection.cs
- EventHandlerList.cs
- SafeRightsManagementSessionHandle.cs
- WebColorConverter.cs
- SerTrace.cs
- TrustLevel.cs
- ProviderException.cs
- StrongNamePublicKeyBlob.cs
- WindowsPen.cs
- BamlLocalizableResource.cs
- IdentityModelStringsVersion1.cs
- PanelStyle.cs
- ManagementEventWatcher.cs
- SlipBehavior.cs
- SchemaTypeEmitter.cs
- MimeFormatExtensions.cs
- TypedElement.cs
- GeometryHitTestResult.cs
- IProvider.cs
- WebPartDisplayModeCollection.cs
- WriterOutput.cs
- XmlAttributeCollection.cs
- WindowsGrip.cs
- MouseButton.cs
- EdmProviderManifest.cs
- StylusPoint.cs
- UrlPath.cs
- EditorPartCollection.cs
- mediaeventshelper.cs
- TreeBuilder.cs