private static string GetRight(HorizontalBorderType borderType) { switch (borderType) { case HorizontalBorderType.Top: return("╗"); case HorizontalBorderType.Mid: return("╣"); case HorizontalBorderType.Bottom: return("╝"); default: return("╢"); } }
private static string GetMidMain(HorizontalBorderType borderType) { switch (borderType) { case HorizontalBorderType.Top: return("╦"); case HorizontalBorderType.Mid: return("╬"); case HorizontalBorderType.Bottom: return("╩"); default: return("╫"); } }
private static string GetLeft(HorizontalBorderType borderType) { switch (borderType) { case HorizontalBorderType.Top: return("╔"); case HorizontalBorderType.Mid: return("╠"); case HorizontalBorderType.Bottom: return("╚"); default: return("╟"); } }
private static string GetMid(HorizontalBorderType borderType) { switch (borderType) { case HorizontalBorderType.Top: return("╤"); case HorizontalBorderType.Mid: return("╪"); case HorizontalBorderType.Bottom: return("╧"); default: return("┼"); } }
private static string GenerateHorizontalBorder(int sudokuSize, int sudokuRegionSize, HorizontalBorderType borderType) { int nrDigits = sudokuSize.ToString().Length + 1; string doubleHorizontal = new string(borderType == HorizontalBorderType.Intermed ? '─' : '═', sudokuRegionSize *nrDigits); StringBuilder horizontalBorder = new StringBuilder(); horizontalBorder.Append(GetLeft(borderType)); for (int i = 0; i < sudokuSize; i++) { horizontalBorder.Append(doubleHorizontal); if (i < sudokuSize - 1) { if ((i + 1) % sudokuRegionSize == 0) { horizontalBorder.Append(GetMidMain(borderType)); } else { horizontalBorder.Append(GetMid(borderType)); } } } horizontalBorder.Append(GetRight(borderType)); return(horizontalBorder.ToString()); }