Get Members


Node Information
Gets m of the specifed object. Click on the info button for available members.
General Information
• This node has other options, you can view them by clicking on the info button, this also means according to the node you might be able to add more ports than what is already listed.
• Some of the ports of this node can change their types and accept types automatically.
Visual
Visual

Ports
Text Type DataType Accepts IsList CustomAcception
Get IN Object ONE FALSE TRUE

Source
namespace Korduene.KGraph.Nodes.Types
{
    [IsNode("Get Members")]
    public class GetMembers : Node
    {
        Port obj = new Port(PortType.IN, typeof(object), AcceptsLinks.ONE, "Get");
        public bool Instance
        {
            set { obj.Value = value.ToString(); }
            get
            {
                bool ret = false;
                bool.TryParse(obj.Value, out ret);
                return ret;
            }
        }
        public GetMembers()
        {
            Name = "Get Members";
            OptionsAvilable = true;
            AddPort(obj);
            Instance = true;
            obj.CustomAcception = ObjAcception;
            Information = "Gets m of the specifed object. Click on the info button for available members.";
        }
        bool ObjAcception(Port port)
        {
            if (string.IsNullOrWhiteSpace(ReferenceName))
            {
                if (port != null && port.DataType != null)
                {
                    ReferenceName = port.ParentNode.ReferenceName;
                    ReferenceType = port.DataType;
                    CreateMenu(port.DataType);
                }
            }
            return true;
        }
        private void CreateMenu(Type type)
        {
            InfoContextMenu = GetTypeMembersMenu(type, Instance);
        }
        public override void OnTypeMemberSelected(System.Reflection.FieldInfo fi)
        {
            Port newport = new Port(PortType.OUT, fi.FieldType, AcceptsLinks.MULTIPLE, fi.Name, true);
            newport.DataType = fi.FieldType;
            newport.IsRemovable = true;
            AddPort(newport);
        }
        public override void UpdateResults()
        {
            foreach (var prt in Ports)
            {
                if (prt != obj)
                {
                    prt.Instructions = GetValue(obj) + "." + prt.Text;
                }
            }
        }
        public override void OnLoad()
        {
            CreateMenu(ReferenceType);
        }
    }
}