summaryrefslogtreecommitdiff
path: root/RhSolutions.QueryModifiers/DrinkingWaterHeatingFittings/ThreadTPieceExternal.cs
blob: af5df7276ca5e16e8bc275dd62c7ad48457d4df5 (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
using System.Text.RegularExpressions;

namespace RhSolutions.QueryModifiers.DrinkingWaterHeatingFittings;

public class ThreadTPieceExternal : DrinkingWaterHeatingFitting
{
    protected override string _title => "Тройник RAUTITAN с наружной резьбой";
    protected override string? BuildRhSolutionsName(string query)
    {
        MatchCollection diametersMatches = _diameter.Matches(query);
        if (diametersMatches.Count == 0)
        {
            return null;
        }
        string thread = _thread.Match(query).Groups["Thread"].Value;
        int[] diameters = diametersMatches.Select(match => int.Parse(match.Groups["Diameter"].Value)).ToArray();
        if (diameters.Length == 1)
        {
            return $"{_title} {diameters[0]}-{diameters[0]}-R {thread}";
        }
        else
        {
            return $"{_title} {diameters[0]}-{diameters[1]}-R {thread}";
        }
    }
}