using Microsoft.AspNetCore.Routing.Template;
using Microsoft.AspNetCore.Routing;
using System.Text.Encodings.Web;
using Microsoft.Extensions.ObjectPool;
using Microsoft.AspNetCore.Routing.Internal;
namespace chat
{
public class UrlBuilder
{
public static string BuildUri(string routeTemplate, RouteValueDictionary values ){
var template = TemplateParser.Parse(routeTemplate);
var urlencoder = UrlEncoder.Create(new TextEncoderSettings{});
var poolpolicy = new UriBuilderContextPooledObjectPolicy();
var pool = new DefaultObjectPool<UriBuildingContext>(poolpolicy);
var binder = new TemplateBinder(urlEncoder: urlencoder, pool: pool, template: template, defaults: null);
var x = binder.BindValues(values);
return x;
}
}
}