Ejemplo n.º 1
0
        public static bool AllowConnection(this IConnection connection, IHook one, IHook two)
        {
            if (one == null || two == null)
            {
                return(false);
            }

            // TODO: Implement multidirectional hooks to this.
            if (one.Direction == two.Direction)
            {
                return(false);
            }

            if (one.ParentNode == two.ParentNode)
            {
                return(false);
            }

            if (!one.AllowConnection(two) || !two.AllowConnection(one))
            {
                return(false);
            }

            IHook from;
            IHook to;

            Hook.GetOrderedIO(one, two, out from, out to);

            if (from == null || to == null)
            {
                return(false);
            }

            return(true);
        }