private string codeModule2Class(CodeModule cm) { var sb = new StringBuilder(); sb.Append("public class "); sb.Append(cm.Name); sb.Append(" {\r\n"); //open class foreach (Function f in cm.Functions) { sb.Append("public "); sb.Append("static "); //all methods are static sb.Append(f.ReturnType); sb.Append(" "); sb.Append(f.Name); sb.Append("("); sb.Append(f.Parameters); sb.Append(") {\r\n"); //open method sb.Append(f.Code); sb.Append("}\r\n"); //close method } sb.Append("}"); //close class return sb.ToString(); } //CodeModule2Class()
public void AddCodeModule(CodeModule cm) { CodeModules.Add(cm); }
} //runCondition() public string ShowCodeModuleClassCode(CodeModule cm) { return codeModule2Class(cm); }