From a0a1c23c4d313d7c78b7cc6b7d6a108c3dad04ca Mon Sep 17 00:00:00 2001 From: Serghei Cebotari Date: Fri, 26 Jan 2024 15:50:41 +0300 Subject: Add ML Modifiers with attribute --- .../DrinkingWaterHeatingPipes/BlackPipe.cs | 16 ------- .../DrinkingWaterHeatingPipe.cs | 56 ---------------------- .../DrinkingWaterHeatingPipes/FlexPipe.cs | 6 --- .../DrinkingWaterHeatingPipes/PinkPipe.cs | 23 --------- .../DrinkingWaterHeatingPipes/StabilPipe.cs | 16 ------- 5 files changed, 117 deletions(-) delete mode 100644 RhSolutions.QueryModifiers/DrinkingWaterHeatingPipes/BlackPipe.cs delete mode 100644 RhSolutions.QueryModifiers/DrinkingWaterHeatingPipes/DrinkingWaterHeatingPipe.cs delete mode 100644 RhSolutions.QueryModifiers/DrinkingWaterHeatingPipes/FlexPipe.cs delete mode 100644 RhSolutions.QueryModifiers/DrinkingWaterHeatingPipes/PinkPipe.cs delete mode 100644 RhSolutions.QueryModifiers/DrinkingWaterHeatingPipes/StabilPipe.cs (limited to 'RhSolutions.QueryModifiers/DrinkingWaterHeatingPipes') diff --git a/RhSolutions.QueryModifiers/DrinkingWaterHeatingPipes/BlackPipe.cs b/RhSolutions.QueryModifiers/DrinkingWaterHeatingPipes/BlackPipe.cs deleted file mode 100644 index b715cc1..0000000 --- a/RhSolutions.QueryModifiers/DrinkingWaterHeatingPipes/BlackPipe.cs +++ /dev/null @@ -1,16 +0,0 @@ -namespace RhSolutions.QueryModifiers.DrinkingWaterHeatingPipes; - -public class BlackPipe : DrinkingWaterHeatingPipe -{ - protected override string _title => "Black"; - protected override Dictionary _diameterNames => new() - { - [16] = "16х2,2", - [20] = "20х2,8", - [25] = "25х3,5", - [32] = string.Empty, - [40] = string.Empty, - [50] = string.Empty, - [63] = string.Empty - }; -} diff --git a/RhSolutions.QueryModifiers/DrinkingWaterHeatingPipes/DrinkingWaterHeatingPipe.cs b/RhSolutions.QueryModifiers/DrinkingWaterHeatingPipes/DrinkingWaterHeatingPipe.cs deleted file mode 100644 index 1420d03..0000000 --- a/RhSolutions.QueryModifiers/DrinkingWaterHeatingPipes/DrinkingWaterHeatingPipe.cs +++ /dev/null @@ -1,56 +0,0 @@ -using System.Text.RegularExpressions; - -namespace RhSolutions.QueryModifiers.DrinkingWaterHeatingPipes; - -public class DrinkingWaterHeatingPipe : IProductQueryModifier -{ - protected static readonly Regex _diameter = - new(@"([\b\D]|^)?(?16|20|25|32|40|50|63)([\b\D]|$)"); - protected static readonly Regex _type = - new(@"([\b\W])(?бухт|отр|штанг)([\b\w\.\s])"); - protected virtual string _title { get; } = string.Empty; - - protected virtual Dictionary _diameterNames { get; } = new() - { - [16] = "16x2,2", - [20] = "20x2,8", - [25] = "25x3,5", - [32] = "32x4,4", - [40] = "40x5,5", - [50] = "50x6,9", - [63] = "63x8,6" - }; - - protected virtual Dictionary _makeUp { get; } = new() - { - ["бухт"] = "бухта", - ["штанг"] = "прям.отрезки", - ["отр"] = "прям.отрезки" - }; - - public bool TryQueryModify(string input, out string output) - { - output = string.Empty; - var diameterMatch = _diameter.Match(input); - if (!diameterMatch.Success) - { - return false; - } - var diameter = int.Parse(diameterMatch.Groups["Diameter"].Value); - var typeMatch = _type.Match(input); - if (typeMatch.Success) - { - var type = typeMatch.Groups["Type"].Value; - output = $"Труба {_title} {_diameterNames[diameter]} {_makeUp[type]}"; - } - else if (diameter < 32) - { - output = $"Труба {_title} {_diameterNames[diameter]} {_makeUp["бухт"]}"; - } - else - { - output = $"Труба {_title} {_diameterNames[diameter]} {_makeUp["отр"]}"; - } - return true; - } -} diff --git a/RhSolutions.QueryModifiers/DrinkingWaterHeatingPipes/FlexPipe.cs b/RhSolutions.QueryModifiers/DrinkingWaterHeatingPipes/FlexPipe.cs deleted file mode 100644 index 4294a9a..0000000 --- a/RhSolutions.QueryModifiers/DrinkingWaterHeatingPipes/FlexPipe.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace RhSolutions.QueryModifiers.DrinkingWaterHeatingPipes; - -public class FlexPipe : DrinkingWaterHeatingPipe -{ - protected override string _title => "Flex"; -} \ No newline at end of file diff --git a/RhSolutions.QueryModifiers/DrinkingWaterHeatingPipes/PinkPipe.cs b/RhSolutions.QueryModifiers/DrinkingWaterHeatingPipes/PinkPipe.cs deleted file mode 100644 index 295744f..0000000 --- a/RhSolutions.QueryModifiers/DrinkingWaterHeatingPipes/PinkPipe.cs +++ /dev/null @@ -1,23 +0,0 @@ -namespace RhSolutions.QueryModifiers.DrinkingWaterHeatingPipes; - -public class PinkPipe : DrinkingWaterHeatingPipe -{ - protected override string _title => "Pink+"; - - protected override Dictionary _makeUp => new() - { - ["бухт"] = "бухта", - ["штанг"] = "прямые отрезки", - ["отр"] = "прямые отрезки" - }; - protected override Dictionary _diameterNames => new() - { - [16] = "16х2,2", - [20] = "20х2,8", - [25] = "25х3,5", - [32] = "32х4,4", - [40] = "40х5,5", - [50] = "50х6,9", - [63] = "63х8,7" - }; -} diff --git a/RhSolutions.QueryModifiers/DrinkingWaterHeatingPipes/StabilPipe.cs b/RhSolutions.QueryModifiers/DrinkingWaterHeatingPipes/StabilPipe.cs deleted file mode 100644 index 49dde86..0000000 --- a/RhSolutions.QueryModifiers/DrinkingWaterHeatingPipes/StabilPipe.cs +++ /dev/null @@ -1,16 +0,0 @@ -namespace RhSolutions.QueryModifiers.DrinkingWaterHeatingPipes; - -public class StabilPipe : DrinkingWaterHeatingPipe -{ - protected override string _title => "Stabil -PLATINUM"; - protected override Dictionary _diameterNames => new() - { - [16] = "16,2х2,6", - [20] = "20х2,9", - [25] = "25х3,7", - [32] = "32х4,7", - [40] = "40х6,0", - [50] = "50x6,9", - [63] = "63x8,6" - }; -} -- cgit v1.2.3