diff options
| author | Michał Klichowicz <emkael@tlen.pl> | 2026-09-18 10:17:43 +0200 |
|---|---|---|
| committer | Michał Klichowicz <emkael@tlen.pl> | 2026-09-18 10:17:43 +0200 |
| commit | 7bf0f9b00303dbd372566ebe0f7af2646caad7e0 (patch) | |
| tree | f8fc89b3ee6e18964a9d1eee7683de6b8c5b378b | |
| parent | 961bf05e7e71a4dbfd1ed1641afbed4e90c10464 (diff) | |
Layout error readability improvements
| -rw-r--r-- | src/BCDDFile.cs | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/src/BCDDFile.cs b/src/BCDDFile.cs index 03d0af2..4e9c3f9 100644 --- a/src/BCDDFile.cs +++ b/src/BCDDFile.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.IO; using System.Threading; namespace BCDD @@ -7,6 +8,8 @@ namespace BCDD public class BCDDFile { public List<String> errors; + private bool errorsEncountered; + private static Mutex _errorsPrintLock = new Mutex(); private String filename; private PBNFile file; private String shortname; @@ -20,6 +23,7 @@ namespace BCDD public BCDDFile(String filename) { this.errors = new List<String>(); + this.errorsEncountered = false; this.filename = filename; this.file = new PBNFile(filename); this.shortname = Path.GetFileName(this.filename); @@ -74,9 +78,17 @@ namespace BCDD List<String> validationErrors = board.ValidateLayout(); if (validationErrors.Count > 0) { - throw new InvalidLayoutException( - String.Join("; ", validationErrors.ToArray()) - ); + BCDDFile._errorsPrintLock.WaitOne(); + if (!this.errorsEncountered) + { + this.error("Deal layout errors encountered"); + } + foreach (String validationError in validationErrors) + { + this.error(validationError, boardNo); + } + this.errorsEncountered = true; + BCDDFile._errorsPrintLock.ReleaseMutex(); } int[,] ddTable = table.GetDDTable(); if (ddTable != null) |
