0
0
RhSolutions-Api/RhSolutions.Parsers/DrinkingWaterHeatingPipes/StabilPipe.cs

48 lines
1.2 KiB
C#
Raw Permalink Normal View History

2024-02-08 17:11:11 +03:00
namespace RhSolutions.Parsers.Pipes;
2024-01-26 15:50:41 +03:00
2024-02-08 17:11:11 +03:00
[ParserKey("Stabil")]
2024-01-26 15:50:41 +03:00
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;
}
2024-01-26 15:50:41 +03:00
}