diff options
author | Michal Zimniewicz <mzimniew@man.poznan.pl> | 2016-11-19 17:59:10 +0100 |
---|---|---|
committer | Michal Zimniewicz <mzimniew@man.poznan.pl> | 2016-11-19 17:59:10 +0100 |
commit | cd8f6bf8c23f9a63669d7489dd9d49525c9df6e4 (patch) | |
tree | f274fec74eaa624cc86f1b50514d6bddcefd7b20 /Aktywator/PBNFile.cs | |
parent | 531b20117552e9a7a78bce3a70ad71acff2de340 (diff) | |
parent | 211efd174ac0333cdf9f40695ea5673e5bfb7b95 (diff) |
Merge branch 'hand-evaluation' into validate-lead-card
Diffstat (limited to 'Aktywator/PBNFile.cs')
-rw-r--r-- | Aktywator/PBNFile.cs | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/Aktywator/PBNFile.cs b/Aktywator/PBNFile.cs new file mode 100644 index 0000000..044630a --- /dev/null +++ b/Aktywator/PBNFile.cs @@ -0,0 +1,46 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.IO; + +namespace Aktywator +{ + class PBNFile + { + public List<PBNBoard> Boards; + + private String filename; + + public PBNFile(String filename) + { + this.filename = filename; + this.Boards = new List<PBNBoard>(); + String[] fileContents = File.ReadAllLines(this.filename); + List<String> contents = new List<String>(); + foreach (String line in fileContents) { + contents.Add(line.Trim()); + } + List<String> lines = new List<String>(); + foreach (String line in contents) + { + if (line.Length == 0) + { + if (lines.Count > 0) + { + this.Boards.Add(new PBNBoard(lines)); + lines = new List<String>(); + } + } + else + { + lines.Add(line); + } + } + if (lines.Count > 0) + { + this.Boards.Add(new PBNBoard(lines)); + } + } + + } +} |