0
0
RhSolutions-Api/RhSolutions.QueryModifiers/DrinkingWaterHeatingFittings/ThreadTPieceInternal.cs

42 lines
1.3 KiB
C#
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System.Text.RegularExpressions;
namespace RhSolutions.QueryModifiers.DrinkingWaterHeatingFittings;
public class ThreadTPieceInternal : DrinkingWaterHeatingFitting
{
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)
{
output = $"Тройник RAUTITAN настенный с внутренней резьбой {diameters[0]}-Rp{thread}-{diameters[0]}";
}
else
{
output = $"Тройник RAUTITAN с внутр. резьбой на боков. проходе {diameters[0]}-Rp {thread}-{diameters[0]}";
}
}
else
{
if (diameters[0] < 25)
{
output = $"Тройник RAUTITAN настенный с внутренней резьбой {diameters[0]}-Rp{thread}-{diameters[1]}";
}
else
{
output = $"Тройник RAUTITAN с внутр. резьбой на боков. проходе {diameters[0]}-Rp {thread}-{diameters[1]}";
}
}
return true;
}
}