private void ProcessRouteParameter(string param) { param = param.Trim('{', '}'); PropertyInfo property = null; try { property = RouteType.GetProperty(param); } catch (Exception) { } if (property == null) { MethodParameters.Add("\n /* CANNOT FIND " + param + " */\n "); } else { param = param.ToCamelCase(); ProcessClrProperty(property, true); // Uri Encode string parameters. if (property.GetGetMethod().ReturnType == typeof(string)) { UrlPath.Add("encodeURIComponent(" + param + ")"); } else { UrlPath.Add(param); } } }
public void ParseRoutePath() { string[] pathHierarchy = Route.Path.Trim('/').Split('/'); for (int i = 0; i < pathHierarchy.Length; i++) { string param = pathHierarchy[i]; if (!IsRouteParam(param)) { UrlPath.Add("\"" + param + "\""); } else { ProcessRouteParameter(param); } } }