private string CreateRequestUri(RouteMode mode = RouteMode.Car) { var modeStr = (mode.ToString()).ToCamelCase(); return $"/2/matchroute.json?app_id={_apiSettings.AppId}" + $"&app_code={_apiSettings.AppCode}" + $"&routemode={modeStr}" + $"&Te=gzip,deflate" + $"&Accept-encoding=gzip,deflate"; }
/// <inheritdoc/> public XmlElement ToXmlElement(XmlDocument xmlDocument, ref IList <object> id_source, string name = "") { if (xmlDocument is null) { throw new ArgumentNullException(nameof(xmlDocument)); } if (id_source is null) { throw new ArgumentNullException(nameof(id_source)); } if (name is null) { throw new ArgumentNullException(nameof(name)); } if (name == "") { name = GetType().Name; } XmlElement xmlThis = xmlDocument.CreateElement(name); if (id_source.Contains(this)) { xmlThis.SetAttribute("ref", id_source.IndexOf(this).ToString("x16")); } else { xmlThis.SetAttribute("id", id_source.Count.ToString("x16")); id_source.Add(this); xmlThis.SetAttribute("type", GetType().FullName); XmlElement xmlRoute = xmlDocument.CreateElement("RouteType"); xmlThis.AppendChild(xmlRoute); xmlRoute.InnerText = RouteType.ToString(); XmlElement xmlRouteMode = xmlDocument.CreateElement("RouteMode"); xmlThis.AppendChild(xmlRouteMode); xmlRouteMode.InnerText = RouteMode.ToString(); XmlElement xmlIncrease = xmlDocument.CreateElement("Increase"); xmlThis.AppendChild(xmlIncrease); xmlIncrease.InnerText = _increase.ToString(); XmlElement xmlCurrentIndex = xmlDocument.CreateElement("CurrentIndex"); xmlThis.AppendChild(xmlCurrentIndex); xmlCurrentIndex.InnerText = CurrentIndex is null ? "null" : CurrentIndex.ToString(); XmlElement xmlEntries = xmlDocument.CreateElement("Entries"); xmlThis.AppendChild(xmlEntries); foreach (T entry in this) { XmlElement xmlEntry = CyclicalMethods.ToXmlElement(entry, xmlDocument, ref id_source, "Entry"); xmlEntries.AppendChild(xmlEntry); } } return(xmlThis); }