diff options
author | emkael <emkael@tlen.pl> | 2017-12-28 01:52:11 +0100 |
---|---|---|
committer | emkael <emkael@tlen.pl> | 2017-12-28 01:52:11 +0100 |
commit | fd382a796b78bd460ab7ad87af3f001f23f5a27c (patch) | |
tree | c0a039eb0a1c00dc5330e7fa1b6b09ee3e60d29c /Aktywator | |
parent | 6a66e9c3b1c7f04b047883cc034c616681297c6f (diff) |
Fix for #28 - RRT file lock becomes a "terminal" issue only on initial load, on subsequent refreshes it's ignored (but sends an empty names list, so generates a warning)
Diffstat (limited to 'Aktywator')
-rw-r--r-- | Aktywator/RRBTournament.cs | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/Aktywator/RRBTournament.cs b/Aktywator/RRBTournament.cs index 48040ee..3e73d43 100644 --- a/Aktywator/RRBTournament.cs +++ b/Aktywator/RRBTournament.cs @@ -54,25 +54,29 @@ namespace Aktywator override internal Dictionary<int, List<string>> getNameList() { - this._xml.Load(this._name); Dictionary<int, List<string>> names = new Dictionary<int, List<string>>(); - foreach (XmlNode pair in this._xml.SelectNodes("//lista/para")) + try { - int pairNo = Int32.Parse(pair.SelectSingleNode("numer").InnerText); - names.Add(pairNo, new List<string>()); - foreach (XmlNode player in pair.SelectNodes("gracz/nazwisko")) + this._xml.Load(this._name); + foreach (XmlNode pair in this._xml.SelectNodes("//lista/para")) { - names[pairNo].Add(player.InnerText); + int pairNo = Int32.Parse(pair.SelectSingleNode("numer").InnerText); + names.Add(pairNo, new List<string>()); + foreach (XmlNode player in pair.SelectNodes("gracz/nazwisko")) + { + names[pairNo].Add(player.InnerText); + } } - } - foreach (KeyValuePair<int, List<string>> pair in names) - { - while (pair.Value.Count < 2) + foreach (KeyValuePair<int, List<string>> pair in names) { - pair.Value.Add(" "); + while (pair.Value.Count < 2) + { + pair.Value.Add(" "); + } } } + catch (Exception) { } return names; } } |