summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2016-05-23 22:37:37 +0200
committeremkael <emkael@tlen.pl>2016-05-23 22:37:37 +0200
commit7454b56a82ee67c50f65281fe11463309ff5f2a0 (patch)
tree755bdf00f95f2e1ee48490d4fdd1c7f634f20c17
parent152e52320b2137176ce1e1c74ff4a80c323d7bcf (diff)
* wait for keypress at the end only when there were files
-rw-r--r--Program.cs84
1 files changed, 44 insertions, 40 deletions
diff --git a/Program.cs b/Program.cs
index e587a1c..b549c55 100644
--- a/Program.cs
+++ b/Program.cs
@@ -34,58 +34,62 @@ namespace BCDD
[STAThread]
static void Main(string[] args)
{
- foreach (String filename in Program.getFiles(args))
+ List<String> files = Program.getFiles(args);
+ if (files.Count > 0)
{
- try
+ foreach (String filename in files)
{
- 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);
- }
+ file.Save();
+ }
+ catch (Exception e)
+ {
+ Console.WriteLine("ERROR: " + e.Message);
}
- file.Save();
- }
- catch (Exception e)
- {
- Console.WriteLine("ERROR: " + e.Message);
}
+ Console.WriteLine("Press any key to continue...");
+ Console.ReadLine();
}
- Console.WriteLine("Press any key to continue...");
- Console.ReadLine();
}
}
}