public IInputPlug[] GetInputPlugs(IActor actor, IOutputPlug plug)
        {
            List <IInputPlug> tempList = new List <IInputPlug>();

            foreach (IInputPlug p in inputPlugs)
            {
                // Cases to add.
                if (plug != null)
                {
                    if (plug.IsCompatible(p))
                    {
                        tempList.Add(p);
                    }
                }
                else if (actor != null)
                {
                    foreach (IOutputPlug op in actor.GetOutputPlugs(null, null))
                    {
                        if (op.IsCompatible(p))
                        {
                            tempList.Add(p);
                            break;
                        }
                    }
                }
                else
                {
                    tempList.Add(p);
                }
            }

            return(tempList.ToArray());
        }
        public IInputPlug[] GetInputPlugs(IActor actor, IOutputPlug plug)
        {
            List<IInputPlug> tempList = new List<IInputPlug>();

            foreach (IInputPlug p in inputPlugs)
            {
                // Cases to add.
                if (plug != null)
                {
                    if (plug.IsCompatible(p))
                        tempList.Add(p);
                }
                else if (actor != null)
                {
                    foreach (IOutputPlug op in actor.GetOutputPlugs(null, null))
                    {
                        if (op.IsCompatible(p) )
                        {
                            tempList.Add(p);
                            break;
                        }
                    }
                }
                else
                {
                    tempList.Add(p);
                }
            }

            return tempList.ToArray();
        }
Esempio n. 3
0
        public static IConnection Connect(IEnvironment environment,
                                          string sourceActorName,
                                          string sourcePlugName,
                                          string targetActorName,
                                          string targetPlugName)
        {
            IActor sourceActor = environment[sourceActorName];
            IActor targetActor = environment[targetActorName];

            if (sourceActor != null && targetActor != null)
            {
                IOutputPlug[] outputPlugs = sourceActor.GetOutputPlugs(targetActor, null);

                IOutputPlug sourcePlug = null;

                foreach (IOutputPlug op in outputPlugs)
                {
                    if (op.Name == sourcePlugName)
                    {
                        sourcePlug = op;
                        break;
                    }
                }

                if (sourcePlug != null)
                {
                    IInputPlug[] inputPlugs = targetActor.GetInputPlugs(sourceActor, sourcePlug);
                    foreach (IInputPlug ip in inputPlugs)
                    {
                        if (ip.Name == targetPlugName)
                        {
                            // Found everything.
                            IConnection connection = sourcePlug.Connect(ip);

                            if (connection != null)
                            {
                                environment.Add(connection);
                                return(connection);
                            }
                        }
                    }
                }
            }
            return(null);
        }
 public PropertyInterfaceConnection(IOutputPlug _outputPlug, IInputPlug _inputPlug)
     : base(_outputPlug, _inputPlug)
 {
 }
Esempio n. 5
0
 public virtual IInputPlug[] GetInputPlugs(IActor outputActor, IOutputPlug outputPlug)
 {
     return(actorPlugs.GetInputPlugs(outputActor, outputPlug));
 }
 public void Remove(IOutputPlug plug)
 {
     outputPlugs.Remove(plug);
 }
 public void Add(IOutputPlug plug)
 {
     outputPlugs.Add(plug);
 }
Esempio n. 8
0
 protected Connection(IOutputPlug _outputPlug, IInputPlug _inputPlug)
 {
     outputPlug = _outputPlug;
     inputPlug  = _inputPlug;
 }
 public EventMethodConnection(IOutputPlug _outputPlug, IInputPlug _inputPlug,System.Delegate _delegate)
     : base(_outputPlug,_inputPlug)
 {
     connectionDelegate = _delegate;
 }
Esempio n. 10
0
 public EventMethodConnection(IOutputPlug _outputPlug, IInputPlug _inputPlug, System.Delegate _delegate)
     : base(_outputPlug, _inputPlug)
 {
     connectionDelegate = _delegate;
 }
 public PropertyInterfaceConnection(IOutputPlug _outputPlug, IInputPlug _inputPlug)
     : base(_outputPlug,_inputPlug)
 {
 }
 public void Add(IOutputPlug plug)
 {
     outputPlugs.Add(plug);
 }
 public void Remove(IOutputPlug plug)
 {
     outputPlugs.Remove(plug);
 }