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()); }
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); }
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()); }