diff options
author | emkael <emkael@tlen.pl> | 2016-11-26 16:26:16 +0100 |
---|---|---|
committer | emkael <emkael@tlen.pl> | 2016-11-26 16:26:16 +0100 |
commit | 2f47067c7b0db33b6b5e9fe1c846c054b75256e2 (patch) | |
tree | 44c4f587123ec4ca4f5f073b36eb05530cb91311 /Aktywator/Bws.cs | |
parent | 665e91d1a86047d726aebc7cf14c2441a36b484e (diff) |
* load only boards necessary for existing sections
Diffstat (limited to 'Aktywator/Bws.cs')
-rw-r--r-- | Aktywator/Bws.cs | 38 |
1 files changed, 34 insertions, 4 deletions
diff --git a/Aktywator/Bws.cs b/Aktywator/Bws.cs index ba11b72..381e10f 100644 --- a/Aktywator/Bws.cs +++ b/Aktywator/Bws.cs @@ -27,7 +27,35 @@ namespace Aktywator this._filename = filename; sql = new Sql(filename); this.main = main; - main.lWczytywane.Text += this.lowBoard() + "-" + this.highBoard(); + main.lWczytywane.Text = this.getBoardRangeText(this.getSections().Split(',')); + } + + private int sectorLetterToNumber(string sector) + { + return sector[0] - 'A' + 1; + } + + private string sectorNumberToLetter(int sector) + { + char character = (char)('A' - 1 + sector); + return character.ToString(); + } + + private string getBoardRangeText(string[] sectors) + { + StringBuilder sb = new StringBuilder(); + sb.Append("Wczytywane rozkłady:"); + foreach (string sector in sectors) + { + sb.Append("\n "); + sb.Append(this.lowBoard(sector)); + sb.Append("-"); + sb.Append(this.highBoard(sector)); + sb.Append(" (sektor "); + sb.Append(this.sectorNumberToLetter(Int16.Parse(sector))); + sb.Append(")"); + } + return sb.ToString(); } public void initSettings() @@ -453,9 +481,10 @@ namespace Aktywator { sql.query("DELETE FROM HandRecord"); sql.query("DELETE FROM HandEvaluation"); - for (int i = 0; i < pbn.handRecords.Length; i++) - if (pbn.handRecords[i] != null) - for (int section = lowSection(); section <= highSection(); section++) + foreach (string section in this.getSections().Split(',')) + { + for (int i = this.lowBoard(section.Trim()); i <= this.highBoard(section.Trim()); i++) + if (pbn.handRecords[i] != null) { HandRecord b = pbn.handRecords[i]; StringBuilder str = new StringBuilder(50); @@ -506,6 +535,7 @@ namespace Aktywator sql.query(ddStr.ToString()); } } + } } } } |