public string BuildCode(int indented = 0) { StringBuilder b = new StringBuilder(); b.Append("function "); if (Name != null) { b.Append(Name); } b.Append("("); for (int i = 0; i < Parameters.Count; i++) { b.Append(Parameters[i]); if (i < Parameters.Count - 1) { b.Append(","); } } b.Append(")\n" + JSBuilder.GetIndented(indented) + "{\n"); b.Append(Code.BuildCode(indented + 1)); b.Append(JSBuilder.GetIndented(indented) + "}"); return(b.ToString()); }
public string BuildCode(int indented = 0) { StringBuilder b = new StringBuilder(); b.AppendLine("{"); int i = 0; foreach (KeyValuePair <string, object> kv in Properties) { b.Append(JSBuilder.GetIndented(indented + 1)); b.Append(kv.Key); b.Append(": "); b.Append(BuildValue(kv.Value, indented + 1)); if (i < (Properties.Count - 1)) { b.Append(",\n"); } else { b.Append("\n"); } i++; } b.Append(JSBuilder.GetIndented(indented) + "}"); return(b.ToString()); }
public override string BuildCode(int indented = 0) { if (indented > 0) { return(Code.Replace("\n", JSBuilder.GetIndented(indented))); } return(Code); }
public override string BuildCode(int indented = 0) { StringBuilder builder = new StringBuilder(); builder.Append("if(" + Condition + ") {\n"); builder.Append(Body.BuildCode(indented + 1)); builder.Append(JSBuilder.GetIndented(indented) + "}"); return(builder.ToString()); }
public string BuildCode(int indented = 0) { StringBuilder b = new StringBuilder(); foreach (JSBOperation op in Operations) { b.AppendLine(JSBuilder.GetIndented(indented) + op.BuildCode(indented)); } return(b.ToString()); }
public override string BuildCode(int indented = 0) { StringBuilder b = new StringBuilder(); b.Append(JSBuilder.GetIndented(indented)); b.Append(VariableName); b.Append(" = "); if (!IsValueType) { b.Append(((JSBObject)VariableValue).BuildCode(indented)); } else { b.Append(JSBObject.BuildValue(VariableValue, indented)); } b.Append(";"); return(b.ToString()); }