private string codeModule2Class(CodeModule cm) { bool cmIsStandard = false; if (cm.Name == this.STD_MODULE_NAME) { cmIsStandard = true; } StringBuilder sb = new StringBuilder(); sb.Append("public class "); sb.Append(cm.Name); sb.Append(" {\r\n"); //open class foreach (Function f in cm.Functions) { if (cmIsStandard && f.Name == this.STD_EVENT_NAME_BEFORE_RULE_FIRED) { this.standardBeforeRuleFiredDefined = true; } else if (cmIsStandard && f.Name == this.STD_EVENT_NAME_AFTER_RULE_FIRED) { this.standardAfterRuleFiredDefined = true; } else if (cmIsStandard && f.Name == this.STD_EVENT_NAME_NO_RULE_FIRED) { this.standardNoRuleFiredDefined = true; } else if (cmIsStandard && f.Name == this.STD_EVENT_NAME_NO_OUTPUT_FOUND) { this.standardNoOutputFoundDefined = true; } 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 string ShowCodeModuleClassCode(CodeModule cm) { return(this.codeModule2Class(cm)); }
public void AddCodeModule(CodeModule cm) { this.codeModules.Add(cm); }