Example #1
0
        public virtual void FixupStartEndLink(EntityLink <EntityType> SourceLink, string DestLinkFilename, string DestLinkName, XMLSerializable.LinkType TypeName)
        {
            EntityType DestEntity = GetEntityByFileName(DestLinkFilename);

            if (DestEntity != null)
            {
                EntityLink <EntityType> DestinationLink = ((EntityType)DestEntity).GetLinkByName(DestLinkName);

                if (DestinationLink != null)
                {
                    SourceLink.EstablishLink(DestinationLink);
                    DestinationLink.EstablishLink(SourceLink);
                }
            }
            else
            {
                string InvertLinkType = (DestLinkName.StartsWith("Input") ? DestLinkName.Replace("Input", "Output") : DestLinkName.Replace("Output", "Input"));

                EntityLink <EntityType> DestinationLink = GetLinkByName(InvertLinkType);

                if (DestinationLink != null)
                {
                    SourceLink.EstablishLink(DestinationLink);
                    DestinationLink.EstablishLink(SourceLink);
                }
            }
        }
Example #2
0
        public virtual void OnConnectedAnchors(Anchor <EntityType> LocalAnchor, Anchor <EntityType> RemoteAnchor)
        {
            EntityBox <EntityType> RemoteBox = RemoteAnchor.Owner;
            string LocalAnchorName           = "";
            string RemoteAnchorName          = "";

            if (Inputs.Contains(LocalAnchor))
            {
                LocalAnchorName = "Input";
            }
            else
            {
                LocalAnchorName = "Output";
            }

            LocalAnchorName += LocalAnchor.GetLabelText();

            if (RemoteBox.Inputs.Contains(RemoteAnchor))
            {
                RemoteAnchorName = "Input";
            }
            else
            {
                RemoteAnchorName = "Output";
            }

            RemoteAnchorName += RemoteAnchor.GetLabelText();

            EntityLink <EntityType> LocalLink  = GetLinkByName(LocalAnchorName);
            EntityLink <EntityType> RemoteLink = RemoteBox.GetLinkByName(RemoteAnchorName);

            if (LocalLink != null && RemoteLink != null)
            {
                LocalLink.EstablishLink(RemoteLink);
            }
        }