0
0
RhSolutions-Api/RhSolutions.MLModifiers/DrinkingWaterHeatingFittings/TPiece.cs
Serghei Cebotari 194d85fbfe
All checks were successful
Test API / test (push) Successful in 2m8s
Improve t-piece parsing
2024-01-26 15:57:56 +03:00

37 lines
889 B
C#

namespace RhSolutions.MLModifiers.DrinkingWaterHeatingFittings;
[MLModifierKey("Тройник RAUTITAN")]
public class TPiece : DrinkingWaterHeatingFitting
{
protected override string _title => "Тройник -PLATINUM";
public override bool TryQueryModify(string input, out string output)
{
output = string.Empty;
var diameters = _diameter.Matches(input)
.Select(match => match.Groups["Diameter"].Value)
.Select(d => int.Parse(d))
.ToArray();
if (diameters.Length == 1)
{
output = $"{_title} {diameters[0]}-{diameters[0]}-{diameters[0]}";
}
else if (diameters.Length >= 3)
{
if (diameters[2] > diameters[0])
{
output = $"{_title} {diameters[2]}-{diameters[1]}-{diameters[0]}";
}
else
{
output = $"{_title} {diameters[0]}-{diameters[1]}-{diameters[2]}";
}
}
else
{
return false;
}
return true;
}
}