48 lines
1.2 KiB
C#
48 lines
1.2 KiB
C#
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;
|
||
}
|
||
}
|