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

30 lines
903 B
C#
Raw Permalink Normal View History

2023-10-13 15:04:27 +03:00
using System.Text.RegularExpressions;
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 ThreadTPieceExternal : DrinkingWaterHeatingFitting
{
2024-01-18 22:32:53 +03:00
protected override string _title => "Тройник с наружной резьбой";
2023-10-22 13:43:18 +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;
MatchCollection diametersMatches = _diameter.Matches(input);
if (diametersMatches.Count == 0)
{
return false;
}
string thread = _thread.Match(input).Groups["Thread"].Value;
int[] diameters = diametersMatches.Select(match => int.Parse(match.Groups["Diameter"].Value)).ToArray();
if (diameters.Length == 1)
{
output = $"{_title} {diameters[0]}-{diameters[0]}-R {thread}";
}
else
{
output = $"{_title} {diameters[0]}-{diameters[1]}-R {thread}";
}
return true;
}
2023-10-13 15:04:27 +03:00
}