private string BuildName(string className, string ownName, bool useNew, bool isShort) { if (className == null) { className = string.Empty; } else { className = className + "."; } string result; if (resultType == null) { result = "void"; } else { EntityName resultName = useNew ? resultType.NameNew : resultType.NameOld; result = SystemTypeProcessor.SimplifyType(resultName, !isShort); } if (entityType == EntityType.Method) { return(string.Format("{0} {1}{2}({3})", result, className, ownName, MethodParamList(isShort, useNew))); } if (resultType != null) { return(string.Format("{0} {1}{2}", result, className, ownName)); } return(string.Format("{0}{1}", className, ownName)); }
public string MethodParamList(bool isShort, bool useNew) { if (methodParams.Count == 0) { return(string.Empty); } StringBuilder sb = new StringBuilder(); for (int i = 0; i < methodParams.Count; i++) { string paramValue; if (useNew) { paramValue = SystemTypeProcessor.SimplifyType(methodParams[i].NameNew, !isShort); } else { paramValue = SystemTypeProcessor.SimplifyType(methodParams[i].NameOld, !isShort); } sb.Append(paramValue); if (i < methodParams.Count - 1) { sb.Append(", "); } } return(sb.ToString()); }
private string CreateName(string ownName, bool isShort) { StringBuilder sb = new StringBuilder(); if (result != null) { sb.Append(SystemTypeProcessor.SimplifyType(result, !isShort)); sb.Append(' '); } else if (methodParams != null && string.Compare(name.Name, "ctor", StringComparison.Ordinal) != 0) // method with no result - void { sb.Append("void "); } sb.Append(ownName); CreateParams(isShort, sb); return(sb.ToString()); }
private void CreateParams(bool isShort, StringBuilder sb) { if (methodParams == null) { return; } sb.Append('('); bool paramAdded = false; foreach (EntityName param in methodParams) { if (paramAdded) { sb.Append(", "); } sb.Append(SystemTypeProcessor.SimplifyType(param, !isShort)); paramAdded = true; } sb.Append(')'); }
private string BuildGenericParams(bool full) { if (genericParams == null) { return(string.Empty); } StringBuilder sb = new StringBuilder(); sb.Append('<'); for (int i = 0; i < genericParams.Length; i++) { if (i > 0) { sb.Append(", "); } sb.Append(SystemTypeProcessor.SimplifyType(genericParams[i], full)); } sb.Append('>'); return(sb.ToString()); }