diff options
Diffstat (limited to 'RhSolutions.Parsers/DrinkingWaterHeatingFittings/Adapter.cs')
-rw-r--r-- | RhSolutions.Parsers/DrinkingWaterHeatingFittings/Adapter.cs | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/RhSolutions.Parsers/DrinkingWaterHeatingFittings/Adapter.cs b/RhSolutions.Parsers/DrinkingWaterHeatingFittings/Adapter.cs index 8ef4f33..3600cc8 100644 --- a/RhSolutions.Parsers/DrinkingWaterHeatingFittings/Adapter.cs +++ b/RhSolutions.Parsers/DrinkingWaterHeatingFittings/Adapter.cs @@ -15,24 +15,35 @@ public abstract class Adapter : DrinkingWaterHeatingFitting ["63"] = "2" }; public override bool TryParse(string input, out string output) - { + { output = string.Empty; - Match diameter = _diameter.Match(input); - if (!diameter.Success) + MatchCollection diameters = _diameter.Matches(input); + if (diameters.Count < 1) { return false; } Match thread = _thread.Match(input); string threadValue; - if (!thread.Success) + if (!thread.Success && diameters.Count >= 2) + { + var diameterThread = diameters[1].Groups["Diameter"]; + threadValue = diameterThread.Value switch + { + "15" => "1/2", + "20" => "3/4", + "25" => "1", + _ => string.Empty + }; + } + else if (!thread.Success) { - threadValue = _defaultThreads[diameter.Groups["Diameter"].Value]; + threadValue = _defaultThreads[diameters[0].Groups["Diameter"].Value]; } else { threadValue = thread.Groups["Thread"].Value; } - output = $"{_title} {diameter.Groups["Diameter"]} {threadValue}"; + output = $"{_title} {diameters[0].Groups["Diameter"]} {threadValue}"; return true; } } |