diff options
author | Michał Zimniewicz <michzimny@users.noreply.github.com> | 2016-11-19 17:53:52 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-19 17:53:52 +0100 |
commit | 001db1e8d9389c092def6037fe4ac098d5e0e535 (patch) | |
tree | c5c22053a517f1b9bbb553171e84eb4334f24377 /Aktywator/PBNFile.cs | |
parent | fc037b277004b98ee740a1fc5191e6571b6cbaf3 (diff) | |
parent | 211efd174ac0333cdf9f40695ea5673e5bfb7b95 (diff) |
Merge pull request #3 from emkael/hand-evaluation
Dane analizy w widne wczytywane wraz z rozkładami
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)); + } + } + + } +} |