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

30 lines
812 B
C#

namespace RhSolutions.QueryModifiers.DrinkingWaterHeatingFittings;
public class Coupling : DrinkingWaterHeatingFitting
{
protected override string _title => "Муфта соединительная";
public override bool TryQueryModify(string input, out string output)
{
output = string.Empty;
var diametersMatches = _diameter.Matches(input);
if (diametersMatches.Count == 0)
{
return false;
}
var diameters = diametersMatches.Select(x => x.Groups["Diameter"].Value)
.Take(2)
.OrderByDescending(x => int.Parse(x))
.ToArray();
if (diameters.Length == 1 || diameters[0] == diameters[1])
{
output = $"{_title} равнопроходная {diameters[0]}";
}
else
{
output = $"{_title} переходная {diameters[0]}-{diameters[1]}";
}
return true;
}
}