diff options
author | Serghei Cebotari <serghei@cebotari.ru> | 2023-10-22 13:43:18 +0300 |
---|---|---|
committer | Serghei Cebotari <serghei@cebotari.ru> | 2023-10-22 13:43:18 +0300 |
commit | b91d8fbe99ac56155e6b7547d2e4931832eeb9f4 (patch) | |
tree | c3746de9b60d76870f8327387b04b765fb209375 /RhSolutions.QueryModifiers/DrinkingWaterHeatingFittings/ThreadTPieceInternal.cs | |
parent | 020922d749ab0f53fc178700e2181487be9a05ee (diff) |
Remove BuildRhSolutionsName methods
Diffstat (limited to 'RhSolutions.QueryModifiers/DrinkingWaterHeatingFittings/ThreadTPieceInternal.cs')
-rw-r--r-- | RhSolutions.QueryModifiers/DrinkingWaterHeatingFittings/ThreadTPieceInternal.cs | 66 |
1 files changed, 34 insertions, 32 deletions
diff --git a/RhSolutions.QueryModifiers/DrinkingWaterHeatingFittings/ThreadTPieceInternal.cs b/RhSolutions.QueryModifiers/DrinkingWaterHeatingFittings/ThreadTPieceInternal.cs index 08afe62..9cfd1c6 100644 --- a/RhSolutions.QueryModifiers/DrinkingWaterHeatingFittings/ThreadTPieceInternal.cs +++ b/RhSolutions.QueryModifiers/DrinkingWaterHeatingFittings/ThreadTPieceInternal.cs @@ -4,36 +4,38 @@ namespace RhSolutions.QueryModifiers.DrinkingWaterHeatingFittings; public class ThreadTPieceInternal : DrinkingWaterHeatingFitting { - 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) - { - if (diameters[0] < 25) - { - return $"Тройник RAUTITAN настенный с внутренней резьбой {diameters[0]}-Rp{thread}-{diameters[0]}"; - } - else - { - return $"Тройник RAUTITAN с внутр. резьбой на боков. проходе {diameters[0]}-Rp {thread}-{diameters[0]}"; - } - } - else - { - if (diameters[0] < 25) - { - return $"Тройник RAUTITAN настенный с внутренней резьбой {diameters[0]}-Rp{thread}-{diameters[1]}"; - } - else - { - return $"Тройник RAUTITAN с внутр. резьбой на боков. проходе {diameters[0]}-Rp {thread}-{diameters[1]}"; - } - } - } + 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; + } } |