summaryrefslogtreecommitdiff
path: root/Aktywator
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2017-09-30 12:46:05 +0200
committeremkael <emkael@tlen.pl>2017-09-30 12:46:05 +0200
commitfcff84144c5a8871cfcb3983784133f412b31ed8 (patch)
tree32f895c2f177ebdcd0db17386ea59bba718b6b3c /Aktywator
parentf44c3ffab5d4146744cb45d57ff756c70453be75 (diff)
Automatically detecting MySQL database for player names from Teamy BWS files
Diffstat (limited to 'Aktywator')
-rw-r--r--Aktywator/Bws.cs13
-rw-r--r--Aktywator/MainForm.cs24
2 files changed, 35 insertions, 2 deletions
diff --git a/Aktywator/Bws.cs b/Aktywator/Bws.cs
index 2662b88..700969c 100644
--- a/Aktywator/Bws.cs
+++ b/Aktywator/Bws.cs
@@ -802,5 +802,18 @@ namespace Aktywator
this.displayHandRecordInfo(this.loadSectionBoards(sections));
return count;
}
+
+ internal string getMySQLDatabaseForSection()
+ {
+ try
+ {
+ string dbString = this.sql.selectOne("SELECT custom_MySQL FROM `Section` WHERE ID = 1");
+ return dbString.Split(',')[3];
+ }
+ catch (Exception ee)
+ {
+ return null;
+ }
+ }
}
}
diff --git a/Aktywator/MainForm.cs b/Aktywator/MainForm.cs
index 602a260..40ebb2d 100644
--- a/Aktywator/MainForm.cs
+++ b/Aktywator/MainForm.cs
@@ -74,11 +74,31 @@ namespace Aktywator
this.bwsSettings.Add(new Setting("BM2ShowPlayerNames", this.xShowPlayerNames, bws, new Version(2, 0, 0), new Version(1, 3, 1)));
bindSettingChanges();
bws.loadSettings();
- syncToolStrip.Visible = false;
- namesPanel.Visible = false;
+
+ tournament = this.detectTeamyTournament();
+ if (tournament != null)
+ {
+ updateTournamentInfo(tournament);
+ }
+ else
+ {
+ syncToolStrip.Visible = false;
+ namesPanel.Visible = false;
+ }
+
this.WindowState = FormWindowState.Normal;
}
+ private Tournament detectTeamyTournament()
+ {
+ string name = bws.getMySQLDatabaseForSection();
+ if (name != null)
+ {
+ return new TeamyTournament(name);
+ }
+ return null;
+ }
+
private void fillSectionSelector(string sections)
{
cbSettingsSection.SelectedIndex = 0;