0
0
RhSolutions-Api/RhSolutions.Parsers/DrinkingWaterHeatingPipes/StabilPipe.cs
Serghei Cebotari d4a9149daa
All checks were successful
Test and release / test (push) Successful in 2m39s
Test and release / release-image (push) Successful in 4m26s
Return flex result for stabil pipe over 40 diameter
2024-02-16 14:18:49 +03:00

48 lines
1.2 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

namespace RhSolutions.Parsers.Pipes;
[ParserKey("Stabil")]
public class StabilPipe : DrinkingWaterHeatingPipe
{
protected override string _title => "Stabil -PLATINUM";
protected override Dictionary<int, string> _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"
};
public override bool TryParse(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 (diameter > 40)
{
var flexParser = new FlexPipe();
return flexParser.TryParse(input, out output);
}
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;
}
}