2023-10-13 15:04:27 +03:00
|
|
|
|
using System.Text.RegularExpressions;
|
|
|
|
|
|
|
|
|
|
namespace RhSolutions.QueryModifiers.DrinkingWaterHeatingFittings;
|
|
|
|
|
|
|
|
|
|
public class ThreadTPieceInternal : DrinkingWaterHeatingFitting
|
|
|
|
|
{
|
2023-10-22 13:43:18 +03:00
|
|
|
|
public override bool TryQueryModify(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)
|
|
|
|
|
{
|
|
|
|
|
if (diameters[0] < 25)
|
|
|
|
|
{
|
2024-01-18 22:32:53 +03:00
|
|
|
|
output = $"Тройник настенный с внутренней резьбой {diameters[0]}-Rp{thread}-{diameters[0]}";
|
2023-10-22 13:43:18 +03:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2024-01-18 22:32:53 +03:00
|
|
|
|
output = $"Тройник с внутр. резьбой на боков. проходе {diameters[0]}-Rp {thread}-{diameters[0]}";
|
2023-10-22 13:43:18 +03:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (diameters[0] < 25)
|
|
|
|
|
{
|
2024-01-18 22:32:53 +03:00
|
|
|
|
output = $"Тройник настенный с внутренней резьбой {diameters[0]}-Rp{thread}-{diameters[1]}";
|
2023-10-22 13:43:18 +03:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2024-01-18 22:32:53 +03:00
|
|
|
|
output = $"Тройник с внутр. резьбой на боков. проходе {diameters[0]}-Rp {thread}-{diameters[1]}";
|
2023-10-22 13:43:18 +03:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
2023-10-13 15:04:27 +03:00
|
|
|
|
}
|