Exemplo n.º 1
0
        public override string GenerateCode()
        {
            var sb = new StringBuilder();

            sb.AppendLine();
            sb.Append("if(" + InputPorts[0].Data.Value + "){");
            try
            {
                if (OutExecPorts[1] != null)
                {
                    sb.Append(CodeMiner.Code(OutExecPorts[1].ConnectedConnectors[0].EndPort.ParentNode));
                }
            }
            catch (Exception)
            {
                //Ignored
            }
            sb.Append("}");
            sb.Append("else{");
            try
            {
                if (OutExecPorts[1] != null)
                {
                    sb.Append(CodeMiner.Code(OutExecPorts[2].ConnectedConnectors[0].EndPort.ParentNode));
                }
            }
            catch (Exception)
            {
                //Ignored
            }
            sb.Append("}");
            sb.AppendLine();
            return(sb.ToString());
        }
Exemplo n.º 2
0
        private void Compile()
        {
            File.WriteAllText(Hub.WorkSpace + "code.r", CodeMiner.Code(vc.RootNode));
            var path = Hub.WorkSpace + "virtualConsole.bat";
            var cmd  = @"@echo off
title Console
rscript """ + Hub.WorkSpace + @"code.r""" + @" 

pause";

            File.WriteAllText(path, cmd);
            Process.Start(path);
        }
Exemplo n.º 3
0
        public override string GenerateCode()
        {
            var sb = new StringBuilder();

            sb.Append($"for({InputPorts?[0].Data.Value} in {InputPorts?[1].Data.Value})" + "{");
            sb.AppendLine();
            if (OutExecPorts[1].ConnectedConnectors.Count > 0)
            {
                sb.AppendLine(CodeMiner.Code(OutExecPorts[1].ConnectedConnectors[0].EndPort.ParentNode));
            }
            sb.AppendLine();
            sb.Append("}");
            return(sb.ToString());
        }