diff options
Diffstat (limited to 'RhSolutions.MLModifiers/DrinkingWaterHeatingFittings/ThreadElbowDoubleWallInternal.cs')
-rw-r--r-- | RhSolutions.MLModifiers/DrinkingWaterHeatingFittings/ThreadElbowDoubleWallInternal.cs | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/RhSolutions.MLModifiers/DrinkingWaterHeatingFittings/ThreadElbowDoubleWallInternal.cs b/RhSolutions.MLModifiers/DrinkingWaterHeatingFittings/ThreadElbowDoubleWallInternal.cs new file mode 100644 index 0000000..aaeca67 --- /dev/null +++ b/RhSolutions.MLModifiers/DrinkingWaterHeatingFittings/ThreadElbowDoubleWallInternal.cs @@ -0,0 +1,32 @@ +using System.Text.RegularExpressions; + +namespace RhSolutions.MLModifiers.DrinkingWaterHeatingFittings; + +[MLModifierKey("Проточный настенный угольник")] +public class ThreadElbowDoubleWallInternal : DrinkingWaterHeatingFitting +{ + protected override string _title => "Проточный настенный угольник"; + private Regex _type = new(@"([\b\Wу])(?<Type>длин)([\b\w\.\s])"); + + public override bool TryQueryModify(string input, out string output) + { + output = string.Empty; + var diameterMatches = _diameter.Matches(input); + if (diameterMatches.Count == 0) + { + return false; + } + var threadMatch = _thread.Match(input); + if (!threadMatch.Success) + { + return false; + } + var typeMatch = _type.Match(input); + string[] diameters = diameterMatches.Select(x => x.Groups["Diameter"].Value).ToArray(); + string thread = threadMatch.Groups["Thread"].Value; + string type = typeMatch.Success ? "длинный" : "короткий"; + + output = $"{_title} {diameters[0]}/{(diameters.Length > 1 ? diameters[1] : diameters[0])}-Rp {thread} {type}"; + return true; + } +}
\ No newline at end of file |