/// <summary> /// 转换为 URL 组合器。 /// </summary> /// <param name="absoluteUriString">给定的绝对 URI 字符串。</param> /// <param name="queriesAction">给定的改变查询参数集合动作。</param> /// <param name="newScheme">给定的新协议(可选)。</param> /// <param name="newHost">给定可能包含端口号的新主机(可选)。</param> /// <param name="newPath">给定以 / 开始的新路径(可选)。</param> /// <param name="newAnchor">给定以 # 开始的新锚点(可选)。</param> /// <returns>返回 <see cref="UriCombiner"/>。</returns> public static UriCombiner AsUriCombiner(this string absoluteUriString, Action <ConcurrentDictionary <string, string> > queriesAction, string newScheme = null, string newHost = null, string newPath = null, string newAnchor = null) { var combiner = new UriCombiner(absoluteUriString); return(combiner.ChangeParameters(newScheme, newHost, newPath, newQuery: default, queriesAction, newAnchor));
/// <summary> /// 转换为 URL 组合器。 /// </summary> /// <param name="absoluteUriString">给定的绝对 URI 字符串。</param> /// <param name="newScheme">给定的新协议(可选)。</param> /// <param name="newHost">给定可能包含端口号的新主机(可选)。</param> /// <param name="newPath">给定以 / 开始的新路径(可选)。</param> /// <param name="newQuery">给定以 ? 开始的新查询(可选)。</param> /// <param name="newAnchor">给定以 # 开始的新锚点(可选)。</param> /// <returns>返回 <see cref="UriCombiner"/>。</returns> public static UriCombiner AsUriCombiner(this string absoluteUriString, string newScheme = null, string newHost = null, string newPath = null, string newQuery = null, string newAnchor = null) { var combiner = new UriCombiner(absoluteUriString); return(combiner.ChangeParameters(newScheme, newHost, newPath, newQuery, queriesAction: null, newAnchor)); }
public static bool TryParseCombiner(string absoluteUriString, out UriCombiner result) { result = new UriCombiner(absoluteUriString); return(result.Host.IsNotEmpty() || result.Path.IsNotEmpty()); }