Refactoring

This commit is contained in:
Sergey Chebotar 2021-12-08 12:03:33 +03:00
parent 8da955aab1
commit 89e420a890

View File

@ -17,10 +17,10 @@ namespace Rehau.Sku.Assist
.Replace("Ø", " ") .Replace("Ø", " ")
.ToString(); .ToString();
return replace._tPiece(); return replace._tPieceNormalize();
} }
private static string _tPiece(this string line) private static string _tPieceNormalize(this string line)
{ {
Regex regex = new Regex(@"\d{2}.\d{2}.\d{2}"); Regex regex = new Regex(@"\d{2}.\d{2}.\d{2}");
@ -29,11 +29,12 @@ namespace Rehau.Sku.Assist
string match = regex.Match(line).Value; string match = regex.Match(line).Value;
int endFaceA = int.Parse($"{match[0]}{match[1]}"), int side = int.Parse($"{match[3]}{match[4]}");
side = int.Parse($"{match[3]}{match[4]}"), int[] endFaces = new int[]
endFaceB = int.Parse($"{match[6]}{match[7]}"); {
int.Parse($"{match[0]}{match[1]}"),
int[] endFaces = new[] { endFaceA, endFaceB }; int.Parse($"{match[6]}{match[7]}")
};
List<string> additions = new List<string>(); List<string> additions = new List<string>();
@ -42,7 +43,7 @@ namespace Rehau.Sku.Assist
else else
{ {
if (new[] { endFaceA, endFaceB, side }.Distinct().Count() == 1) if (new[] { endFaces[0], endFaces[1], side }.Distinct().Count() == 1)
additions.Add("равнопроходной"); additions.Add("равнопроходной");
else else
additions.Add("уменьшенный"); additions.Add("уменьшенный");
@ -50,7 +51,7 @@ namespace Rehau.Sku.Assist
if (endFaces.Any(x => x > side)) if (endFaces.Any(x => x > side))
additions.Add("боковой"); additions.Add("боковой");
if (endFaceA != endFaceB) if (endFaces[0] != endFaces[1])
additions.Add("торцевой"); additions.Add("торцевой");
} }