2023-10-14 14:24:46 +03:00
|
|
|
|
using System.Text.RegularExpressions;
|
|
|
|
|
|
2024-02-08 17:11:11 +03:00
|
|
|
|
namespace RhSolutions.Parsers.Fittings;
|
2023-10-14 14:24:46 +03:00
|
|
|
|
|
2024-02-08 17:11:11 +03:00
|
|
|
|
[ParserKey("Проточный настенный угольник")]
|
2023-10-14 14:24:46 +03:00
|
|
|
|
public class ThreadElbowDoubleWallInternal : DrinkingWaterHeatingFitting
|
|
|
|
|
{
|
|
|
|
|
protected override string _title => "Проточный настенный угольник";
|
|
|
|
|
private Regex _type = new(@"([\b\Wу])(?<Type>длин)([\b\w\.\s])");
|
|
|
|
|
|
2024-02-08 17:11:11 +03:00
|
|
|
|
public override bool TryParse(string input, out string output)
|
2023-10-14 14:24:46 +03:00
|
|
|
|
{
|
2023-10-22 13:43:18 +03:00
|
|
|
|
output = string.Empty;
|
|
|
|
|
var diameterMatches = _diameter.Matches(input);
|
2023-10-14 14:24:46 +03:00
|
|
|
|
if (diameterMatches.Count == 0)
|
|
|
|
|
{
|
2023-10-22 13:43:18 +03:00
|
|
|
|
return false;
|
2023-10-14 14:24:46 +03:00
|
|
|
|
}
|
2023-10-22 13:43:18 +03:00
|
|
|
|
var threadMatch = _thread.Match(input);
|
2023-10-14 14:24:46 +03:00
|
|
|
|
if (!threadMatch.Success)
|
|
|
|
|
{
|
2023-10-22 13:43:18 +03:00
|
|
|
|
return false;
|
2023-10-14 14:24:46 +03:00
|
|
|
|
}
|
2023-10-22 13:43:18 +03:00
|
|
|
|
var typeMatch = _type.Match(input);
|
2023-10-14 14:24:46 +03:00
|
|
|
|
string[] diameters = diameterMatches.Select(x => x.Groups["Diameter"].Value).ToArray();
|
|
|
|
|
string thread = threadMatch.Groups["Thread"].Value;
|
|
|
|
|
string type = typeMatch.Success ? "длинный" : "короткий";
|
|
|
|
|
|
2023-10-22 13:43:18 +03:00
|
|
|
|
output = $"{_title} {diameters[0]}/{(diameters.Length > 1 ? diameters[1] : diameters[0])}-Rp {thread} {type}";
|
|
|
|
|
return true;
|
2023-10-14 14:24:46 +03:00
|
|
|
|
}
|
|
|
|
|
}
|