public string GetConvertedCode() { switch (SourceCodeType) { case SourceCodeType.File: break; case SourceCodeType.LinesOfCode: StringBuilder codeStringBuilder = new StringBuilder(); ConvertCodeLines(codeStringBuilder, ConvertedCodeLines); return(codeStringBuilder.ToString()); case SourceCodeType.Method: StringBuilder methodStringBuilder = new StringBuilder(); MethodBuilderBase methodBuilderBase = null; if (VoidMethodBuilder != null) { methodStringBuilder.Append(VoidMethodBuilder.LeadingSpace); methodStringBuilder.Append("public void " + VoidMethodBuilder.MethodName); methodBuilderBase = VoidMethodBuilder; } else { methodStringBuilder.Append(MethodBuilder.LeadingSpace); methodStringBuilder.Append("public object " + MethodBuilder.MethodName); methodBuilderBase = MethodBuilder; } MethodParameterBuilder.FillConvertedCode(methodStringBuilder, methodBuilderBase.Parameters); if (!string.IsNullOrEmpty(methodBuilderBase.InLineComments)) { methodStringBuilder.AppendLine(" \\\\ " + methodBuilderBase.InLineComments); } methodStringBuilder.AppendLine(methodBuilderBase.LeadingSpace + "{"); ConvertCodeLines(methodStringBuilder, methodBuilderBase.LinesOfCode); methodStringBuilder.AppendLine(Environment.NewLine + methodBuilderBase.LeadingSpace + "}"); return(methodStringBuilder.ToString()); break; } return(string.Empty); }
public void AddOptionalParameterValue(string paramterName, string defaultValue, int paramterCount) { switch (SourceCodeType) { case SourceCodeType.File: break; case SourceCodeType.Method: MethodBuilderBase methodBuilderBase = null; if (MethodBuilder != null) { methodBuilderBase = MethodBuilder; } else { methodBuilderBase = VoidMethodBuilder; } MethodParameterBuilder.AddOptionalParamtervalue(methodBuilderBase.Parameters, paramterName, defaultValue, paramterCount); break; } }