0
0
RhSolutions-Api/RhSolutions.QueryModifiers/DrinkingWaterHeatingFittings/ThreadElbowDoubleWallInternal.cs

29 lines
993 B
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System.Text.RegularExpressions;
namespace RhSolutions.QueryModifiers.DrinkingWaterHeatingFittings;
public class ThreadElbowDoubleWallInternal : DrinkingWaterHeatingFitting
{
protected override string _title => "Проточный настенный угольник";
private Regex _type = new(@"([\b\Wу])(?<Type>длин)([\b\w\.\s])");
protected override string? BuildRhSolutionsName(string query)
{
var diameterMatches = _diameter.Matches(query);
if (diameterMatches.Count == 0)
{
return null;
}
var threadMatch = _thread.Match(query);
if (!threadMatch.Success)
{
return null;
}
var typeMatch = _type.Match(query);
string[] diameters = diameterMatches.Select(x => x.Groups["Diameter"].Value).ToArray();
string thread = threadMatch.Groups["Thread"].Value;
string type = typeMatch.Success ? "длинный" : "короткий";
return $"{_title} {diameters[0]}/{(diameters.Length > 1 ? diameters[1] : diameters[0])}-Rp {thread} {type}";
}
}