summaryrefslogtreecommitdiff
path: root/Aktywator
diff options
context:
space:
mode:
Diffstat (limited to 'Aktywator')
-rw-r--r--Aktywator/Aktywator.csproj1
-rw-r--r--Aktywator/RRBTournament.cs83
-rw-r--r--Aktywator/Tournament.cs4
3 files changed, 87 insertions, 1 deletions
diff --git a/Aktywator/Aktywator.csproj b/Aktywator/Aktywator.csproj
index e1b78f1..a4dc515 100644
--- a/Aktywator/Aktywator.csproj
+++ b/Aktywator/Aktywator.csproj
@@ -105,6 +105,7 @@
<Compile Include="PBNFile.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
+ <Compile Include="RRBTournament.cs" />
<Compile Include="Setting.cs" />
<Compile Include="Settings.cs" />
<Compile Include="Sql.cs" />
diff --git a/Aktywator/RRBTournament.cs b/Aktywator/RRBTournament.cs
new file mode 100644
index 0000000..d35e8f3
--- /dev/null
+++ b/Aktywator/RRBTournament.cs
@@ -0,0 +1,83 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Xml;
+using System.IO;
+
+namespace Aktywator
+{
+ class RRBTournament : Tournament
+ {
+ private XmlDocument _xml;
+ private string p;
+
+ public RRBTournament(string name)
+ {
+ this._name = name;
+ this._type = Tournament.TYPE_RRB;
+ }
+
+ override internal void setup()
+ {
+ this._xml = new XmlDocument();
+ this._xml.Load(this._name);
+ }
+
+ override internal string getName()
+ {
+ return this._xml.SelectSingleNode("//ustawienia/nazwa").InnerText;
+ }
+
+ override public string getSectionsNum()
+ {
+ List<string> sections = new List<string>();
+ foreach (XmlNode table in this._xml.SelectNodes("//monitor/stoly/stol"))
+ {
+ string section = table.SelectSingleNode("sektor").InnerText;
+ if (!sections.Contains(section))
+ {
+ sections.Add(section);
+ }
+ }
+ return sections.Count.ToString();
+ }
+
+ override public string getTablesNum()
+ {
+ return this._xml.SelectNodes("//monitor/stoly/stol").Count.ToString();
+ }
+
+ override internal string getTypeLabel()
+ {
+ return "RRBridge";
+ }
+
+ override internal Dictionary<int, List<string>> getNameList()
+ {
+ Dictionary<int, List<string>> names = new Dictionary<int, List<string>>();
+ foreach (XmlNode pair in this._xml.SelectNodes("//lista/para"))
+ {
+ int pairNo = Int32.Parse(pair.SelectSingleNode("numer").InnerText);
+ names.Add(pairNo, new List<string>());
+ foreach (XmlNode player in pair.SelectNodes("gracz/nazwisko"))
+ {
+ string[] name = player.InnerText.Trim().Split(' ');
+ if (name.Length > 0)
+ {
+ name[0] = name[0][0].ToString();
+ names[pairNo].Add(String.Join(" ", name));
+ }
+ }
+ }
+
+ foreach (KeyValuePair<int, List<string>> pair in names)
+ {
+ while (pair.Value.Count < 2)
+ {
+ pair.Value.Add("");
+ }
+ }
+ return names;
+ }
+ }
+}
diff --git a/Aktywator/Tournament.cs b/Aktywator/Tournament.cs
index 70fe268..85a2666 100644
--- a/Aktywator/Tournament.cs
+++ b/Aktywator/Tournament.cs
@@ -8,6 +8,7 @@ namespace Aktywator
{
public const int TYPE_PARY = 1;
public const int TYPE_TEAMY = 2;
+ public const int TYPE_RRB = 3;
public const int TYPE_UNKNOWN = 0;
protected string _name;
@@ -16,7 +17,7 @@ namespace Aktywator
get { return _name; }
}
- protected int _type; // 0-unknown, 1-Pary, 2-Teamy
+ protected int _type = Tournament.TYPE_UNKNOWN; // 0-unknown, 1-Pary, 2-Teamy, 3-RRB
public int type
{
get { return _type; }
@@ -36,5 +37,6 @@ namespace Aktywator
{
return new Dictionary<int, List<string>>();
}
+
}
}