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

30 lines
957 B
C#
Raw Normal View History

2023-10-13 22:35:48 +03:00
using System.Text.RegularExpressions;
2024-02-08 17:11:11 +03:00
namespace RhSolutions.Parsers.Fittings;
2023-10-13 22:35:48 +03:00
2024-02-08 17:11:11 +03:00
[ParserKey("Угольник настенный внутренний")]
2023-10-13 22:35:48 +03:00
public class ThreadElbowWallInternal : DrinkingWaterHeatingFitting
{
protected override string _title => "Угольник настенный внутр. резьба";
private Regex _type = new(@"([\b\Wу])(?<Type>длин)([\b\w\.\s])");
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;
var diameterMatch = _diameter.Match(input);
2023-10-13 22:35:48 +03:00
if (!diameterMatch.Success)
{
2023-10-22 13:43:18 +03:00
return false;
2023-10-13 22:35:48 +03:00
}
2023-10-22 13:43:18 +03:00
var threadMatch = _thread.Match(input);
2023-10-13 22:35:48 +03:00
if (!threadMatch.Success)
{
2023-10-22 13:43:18 +03:00
return false;
2023-10-13 22:35:48 +03:00
}
2023-10-22 13:43:18 +03:00
var typeMatch = _type.Match(input);
2023-10-13 22:35:48 +03:00
string diameter = diameterMatch.Groups["Diameter"].Value;
string thread = threadMatch.Groups["Thread"].Value;
2023-10-22 13:43:18 +03:00
output = $"{_title} {(typeMatch.Success ? "длинный " : string.Empty)}{diameter}-Rp {thread}";
return true;
2023-10-13 22:35:48 +03:00
}
}