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

24 lines
516 B
C#
Raw 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
public abstract class Adapter : DrinkingWaterHeatingFitting
{
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;
Match diameter = _diameter.Match(input);
2023-10-13 15:04:27 +03:00
if (!diameter.Success)
{
2023-10-22 13:43:18 +03:00
return false;
2023-10-13 15:04:27 +03:00
}
2023-10-22 13:43:18 +03:00
Match thread = _thread.Match(input);
2023-10-13 15:04:27 +03:00
if (!thread.Success)
{
2023-10-22 13:43:18 +03:00
return false;
2023-10-13 15:04:27 +03:00
}
2023-10-22 13:43:18 +03:00
output = $"{_title} {diameter.Groups["Diameter"]} {thread.Groups["Thread"]}";
return true;
2023-10-13 15:04:27 +03:00
}
}