Run Command


Node Information
Runs specified command using cmd.exe.commands must be valid commands, you can search on the web to find out about commands.
General Information
• This node doesn't have other available options.
Visual
Visual

Ports
Text Type DataType Accepts IsList CustomAcception
Execute IN RUN MULTIPLE FALSE FALSE
Command IN String MULTIPLE FALSE FALSE
Executed OUT RUN MULTIPLE FALSE FALSE

Source
namespace Korduene.KGraph.Nodes.CommandLine
{
    [IsNode("Run Command")]
    public class RunCommand : Node
    {
        Port run = new Port(PortType.IN, typeof(RUN), AcceptsLinks.MULTIPLE, "Execute");
        Port command = new Port(PortType.IN, typeof(string), AcceptsLinks.MULTIPLE, "Command");
        Port runout = new Port(PortType.OUT, typeof(RUN), AcceptsLinks.MULTIPLE, "Executed");
        public string Command
        {
            set { command.Value = value.ToString(); }
            get { return GetRuntimeValue(command); }
        }
        public bool HideWindow
        {
            set { Settings[0] = value.ToString(); }
            get { return bool.Parse(Settings[0]); }
        }
        public RunCommand()
        {
            this.Dependency = DependencyLibraries.COMMANDLINE;
            this.NodeType = KGraph.NodeType.Method;
            this.Name = "Run Command";
            HideWindow = true;
            AddPort(run);
            AddPort(command);
            AddPort(runout);
            Information = "Runs specified command using cmd.exe." +
                "commands must be valid commands, you can search on the web to find out about commands.";
        }
        public override string Code()
        {
            string code = string.Empty;
            code = "CMDExecute cmd = new CMDExecute(); \r\n" +
            "cmd.Execute(" + GetValue(command) + ", 0," + HideWindow.ToString().ToLower() + ", true); \r\n" +
            "cmd.CommandExecuted += delegate(object sender, int e)\r\n{\r\n" + GetValue(runout) + "};";
            return code;
        }
    }
}