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

31 lines
868 B
C#
Raw Normal View History

2024-01-26 15:50:41 +03:00
namespace RhSolutions.MLModifiers.DrinkingWaterHeatingFittings;
2023-10-13 15:04:27 +03:00
2024-01-26 15:50:41 +03:00
[MLModifierKey("Муфта соединительная")]
2023-10-13 15:04:27 +03:00
public class Coupling : DrinkingWaterHeatingFitting
{
protected override string _title => "Муфта соединительная";
2023-10-22 13:43:18 +03:00
public override bool TryQueryModify(string input, out string output)
2023-10-13 15:04:27 +03:00
{
2023-10-22 13:43:18 +03:00
output = string.Empty;
var diametersMatches = _diameter.Matches(input);
if (diametersMatches.Count == 0)
2023-10-13 15:04:27 +03:00
{
2023-10-22 13:43:18 +03:00
return false;
2023-10-13 15:04:27 +03:00
}
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])
2023-10-22 13:43:18 +03:00
{
output = $"{_title} равнопроходная {diameters[0]}";
}
else
{
output = $"{_title} переходная {diameters[0]}-{diameters[1]}";
}
return true;
2023-10-13 15:04:27 +03:00
}
}