30 lines
903 B
C#
30 lines
903 B
C#
using System.Text.RegularExpressions;
|
||
|
||
namespace RhSolutions.Parsers.Fittings;
|
||
|
||
[ParserKey("Тройник RAUTITAN резьбовой наружный")]
|
||
public class ThreadTPieceExternal : DrinkingWaterHeatingFitting
|
||
{
|
||
protected override string _title => "Тройник с наружной резьбой";
|
||
|
||
public override bool TryParse(string input, out string output)
|
||
{
|
||
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;
|
||
}
|
||
} |