summaryrefslogtreecommitdiff
path: root/RhSolutions.Parsers/DrinkingWaterHeatingFittings/ThreadElbowWallInternal.cs
blob: 7729304852e71d1c18c7fbe312c517d90ff22cd8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
using System.Text.RegularExpressions;

namespace RhSolutions.Parsers.Fittings;

[ParserKey("Угольник настенный внутренний")]
public class ThreadElbowWallInternal : DrinkingWaterHeatingFitting
{
	protected override string _title => "Угольник настенный внутр. резьба";
	private Regex _type = new(@"([\b\Wу])(?<Type>длин)([\b\w\.\s])");

	public override bool TryParse(string input, out string output)
	{
		output = string.Empty;
		var diameterMatch = _diameter.Match(input);
		if (!diameterMatch.Success)
		{
			return false;
		}
		var threadMatch = _thread.Match(input);
		if (!threadMatch.Success)
		{
			return false;
		}
		var typeMatch = _type.Match(input);
		string diameter = diameterMatch.Groups["Diameter"].Value;
		string thread = threadMatch.Groups["Thread"].Value;
		output = $"{_title} {(typeMatch.Success ? "длинный " : string.Empty)}{diameter}-Rp {thread}";
		return true;
	}
}