diff options
author | emkael <emkael@tlen.pl> | 2016-05-23 22:34:17 +0200 |
---|---|---|
committer | emkael <emkael@tlen.pl> | 2016-05-23 22:34:17 +0200 |
commit | 152e52320b2137176ce1e1c74ff4a80c323d7bcf (patch) | |
tree | 86ac4a9da8d1682cea6a52e12b7c805857dd94f0 /Program.cs | |
parent | 666393fc1619daabdba4a187493479e2c1f82c2a (diff) |
* error reporting in main loop
Diffstat (limited to 'Program.cs')
-rw-r--r-- | Program.cs | 72 |
1 files changed, 39 insertions, 33 deletions
@@ -36,47 +36,53 @@ namespace BCDD {
foreach (String filename in Program.getFiles(args))
{
- Console.WriteLine("Analyzing " + filename);
- PBNFile file = new PBNFile(filename);
- foreach (PBNBoard board in file.Boards)
+ try
{
- DDTable table = new DDTable(board);
- String boardNo;
- try
+ Console.WriteLine("Analyzing " + filename);
+ PBNFile file = new PBNFile(filename);
+ foreach (PBNBoard board in file.Boards)
{
- boardNo = board.GetNumber();
- }
- catch (FieldNotFoundException)
- {
- boardNo = "?";
- }
- try
- {
- int[,] ddTable = table.GetDDTable();
- if (ddTable != null)
+ DDTable table = new DDTable(board);
+ String boardNo;
+ try
{
- Console.WriteLine("Board " + boardNo);
- DDTable.PrintTable(ddTable);
- ParScore par = new ParScore(board);
- ParContract contract = par.GetParContract(ddTable);
- Console.WriteLine(contract);
- Console.WriteLine();
- board.SaveDDTable(ddTable);
- board.SaveParContract(contract);
- file.WriteBoard(board);
+ boardNo = board.GetNumber();
}
- else
+ catch (FieldNotFoundException)
{
- Console.WriteLine("ERROR: unable to determine DD table for board " + boardNo);
+ boardNo = "?";
+ }
+ try
+ {
+ int[,] ddTable = table.GetDDTable();
+ if (ddTable != null)
+ {
+ Console.WriteLine("Board " + boardNo);
+ DDTable.PrintTable(ddTable);
+ ParScore par = new ParScore(board);
+ ParContract contract = par.GetParContract(ddTable);
+ Console.WriteLine(contract);
+ Console.WriteLine();
+ board.SaveDDTable(ddTable);
+ board.SaveParContract(contract);
+ file.WriteBoard(board);
+ }
+ else
+ {
+ Console.WriteLine("ERROR: unable to determine DD table for board " + boardNo);
+ }
+ }
+ catch (Exception e)
+ {
+ Console.WriteLine(e.Message);
}
}
- catch (Exception e)
- {
- Console.WriteLine(e.Message);
- Console.WriteLine(e.StackTrace);
- }
+ file.Save();
+ }
+ catch (Exception e)
+ {
+ Console.WriteLine("ERROR: " + e.Message);
}
- file.Save();
}
Console.WriteLine("Press any key to continue...");
Console.ReadLine();
|