0
0
RhSolutions-Api/RhSolutions.Parsers/DrinkingWaterHeatingFittings/TPiece.cs

37 lines
855 B
C#
Raw Permalink Normal View History

2024-02-08 17:11:11 +03:00
namespace RhSolutions.Parsers.Fittings;
2023-10-13 15:04:27 +03:00
2024-02-08 17:11:11 +03:00
[ParserKey("Тройник RAUTITAN")]
2023-10-13 15:04:27 +03:00
public class TPiece : DrinkingWaterHeatingFitting
{
2024-01-18 22:32:53 +03:00
protected override string _title => "Тройник -PLATINUM";
2023-10-13 15:04:27 +03:00
2024-02-08 17:11:11 +03:00
public override bool TryParse(string input, out string output)
2023-10-22 13:43:18 +03:00
{
output = string.Empty;
var diameters = _diameter.Matches(input)
.Select(match => match.Groups["Diameter"].Value)
2024-01-26 15:57:56 +03:00
.Select(d => int.Parse(d))
2023-10-22 13:43:18 +03:00
.ToArray();
if (diameters.Length == 1)
{
output = $"{_title} {diameters[0]}-{diameters[0]}-{diameters[0]}";
}
else if (diameters.Length >= 3)
{
2024-01-26 15:57:56 +03:00
if (diameters[2] > diameters[0])
{
output = $"{_title} {diameters[2]}-{diameters[1]}-{diameters[0]}";
}
else
{
output = $"{_title} {diameters[0]}-{diameters[1]}-{diameters[2]}";
}
2023-10-22 13:43:18 +03:00
}
else
{
return false;
}
return true;
}
2023-10-13 15:04:27 +03:00
}