public void RouteSetting(RoutesModel body)
        {
            RouteServersModel[] array = ((IEnumerable <RouteServersModel>) this.ListRouteServers(body.Url)).ToArray <RouteServersModel>();
            for (int i = 0; i < array.Length; i++)
            {
                RouteServersModel s = array[i];
                if (body.Servers == null || body.Servers.FirstOrDefault((RouteServersModel p) => p.Host == s.Host) == null)
                {
                    this.RemoveRouteServer(body.Url, s.Host);
                }
            }
            var res = this.gateway.SetRoute(body.Url, body.Remark, body.HashPattern);

            res.TimeOut = body.TimeOut;
            if (body.Servers != null)
            {
                foreach (RouteServersModel gatewayRouteServerDTO in body.Servers)
                {
                    Bumblebee.Routes.UrlRoute route = this.gateway.Routes.GetRoute(body.Url);
                    if (route != null)
                    {
                        route.AddServer(gatewayRouteServerDTO.Host, gatewayRouteServerDTO.Weight, gatewayRouteServerDTO.MaxRps, gatewayRouteServerDTO.Standby);
                    }
                }
            }
            this.gateway.SaveConfig();
        }
 public void SetRouteServer(string url, string server, int weight, int maxRps, bool standby = false)
 {
     new Uri(server);
     Bumblebee.Routes.UrlRoute route = this.gateway.Routes.GetRoute(url);
     if (route != null)
     {
         route.AddServer(server, weight, maxRps, standby);
     }
     this.gateway.SaveConfig();
     this.gateway.Routes.UpdateUrlTable();
 }