public void AddParam(string type, string name, object value) { CSVar param = new CSVar(type, name, null); param.SetValue(value); attParamList.Add(param); }
public CSVar AddParam(string restrain, string type, string name) { CSVar param = new CSVar(restrain, type, name, null); paramArray.Add(param); return(param); }
/// <summary> /// 添加参数 /// </summary> /// <param name="type"></param> /// <param name="value"></param> /// <returns></returns> public CSVar AddParam(string type, string value) { CSVar param = new CSVar(type, "name", null); param.SetValue(value); paramArray.Add(param); return(param); }
public string GenerateFuncDefineString() { StringBuilder funcStringBuilder = new StringBuilder(); //write func delc if (!string.IsNullOrEmpty(restrain)) { funcStringBuilder.Append(restrain); funcStringBuilder.Append(" "); } funcStringBuilder.Append(type); funcStringBuilder.Append(" "); funcStringBuilder.Append(name); //func param list funcStringBuilder.Append("("); for (int i = 0; i < paramArray.Count; ++i) { CSVar param = paramArray[i]; funcStringBuilder.Append(param.type); funcStringBuilder.Append(" "); funcStringBuilder.Append(param.name); if (i < paramArray.Count - 1) { funcStringBuilder.Append(","); } } funcStringBuilder.Append(")"); funcStringBuilder.AppendLine(); //body funcStringBuilder.Append("\t"); funcStringBuilder.Append("{"); funcStringBuilder.AppendLine(); GenerateFuncContent(funcStringBuilder); funcStringBuilder.AppendLine(); funcStringBuilder.Append("\t"); funcStringBuilder.Append("}"); return(funcStringBuilder.ToString()); }