Settings


Node Information
Gets and sets settings with the specified names and types from and to the settings file. You must set unique variable names to avoid mix up and errors.
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.
Visual
Visual

Ports
Text Type DataType Accepts IsList CustomAcception
Set IN RUN MULTIPLE FALSE FALSE

Source
namespace Korduene.KGraph.Nodes.Application.Settings
{
    [IsNode("Settings")]
    public class Settings : Node
    {
        Port run = new Port(PortType.IN, typeof(RUN), AcceptsLinks.MULTIPLE, "Set");
        public Settings()
        {
            NodeType = KGraph.NodeType.Method;
            Name = "Settings";
            AddPort(run);
            OptionsAvilable = true;
            Information = "Gets and sets settings with the specified names and types from and to the settings file. You must set unique variable names to avoid mix up and errors.";
            InfoContextMenu = GetSettingsMenu();
        }
        public override void OnSettingSelected(ObjectPropertyInfo opi)
        {
            Port p = new Port(opi.PortType, opi.DataType, AcceptsLinks.MULTIPLE, opi.Name, true);
            p.IsRemovable = true;
            p.IsExtra = true;
            AddPort(p);
        }
        public override string Code()
        {
            string code = string.Empty;
            foreach (var port in Ports)
            {
                if (port.IsExtra && port.PortType == PortType.IN)
                {
                    code += "Settings." + port.Text + " = " + GetValue(port) + ";\r\n";
                }
                if (port.IsExtra && port.PortType == PortType.OUT)
                {
                    port.Instructions = "Settings." + port.Text;
                }
            }
            return code;
        }
        public override void UpdateResults()
        {
            InfoContextMenu = GetSettingsMenu();
        }
    }
}