From e15b65add34b28e9c90ec816b018c29cc24d2557 Mon Sep 17 00:00:00 2001 From: emkael Date: Thu, 27 Jul 2017 14:10:54 +0200 Subject: Detecting BCS version number --- Aktywator/MainForm.cs | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) (limited to 'Aktywator/MainForm.cs') diff --git a/Aktywator/MainForm.cs b/Aktywator/MainForm.cs index d8fb6c0..8d8fb89 100644 --- a/Aktywator/MainForm.cs +++ b/Aktywator/MainForm.cs @@ -6,6 +6,7 @@ using System.Drawing; using System.Text; using System.Windows.Forms; using System.Data.OleDb; +using Microsoft.Win32; namespace Aktywator { @@ -17,6 +18,8 @@ namespace Aktywator private Bws bws; private Tournament tournament; + private Version BCSVersion; + public MainForm() { InitializeComponent(); @@ -32,6 +35,17 @@ namespace Aktywator status2.Text = "Wersja " + this.version; status3.Text = "Data: " + this.date; + string detectedVersion = detectBCSVersion(); + if (detectedVersion != null) + { + lDetectedVersion.Text = detectedVersion; + BCSVersion = new Version(detectedVersion); + } + else + { + lDetectedVersion.Text = "nie wykryto"; + } + string filename; string[] args = Environment.GetCommandLineArgs(); if (args.Length > 1) @@ -56,6 +70,45 @@ namespace Aktywator this.WindowState = FormWindowState.Normal; } + private string detectBCSVersion() + { + RegistryKey[] keys = + { + Registry.CurrentUser.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall"), + Registry.CurrentUser.OpenSubKey("Software\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall"), + Registry.LocalMachine.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall"), + Registry.LocalMachine.OpenSubKey("Software\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall") + }; + foreach (RegistryKey key in keys) + { + if (key != null) + { + foreach (var subKey in key.GetSubKeyNames()) + { + RegistryKey appKey = key.OpenSubKey(subKey); + if (appKey != null) + { + foreach (var value in appKey.GetValueNames()) + { + string keyValue = Convert.ToString(appKey.GetValue("Publisher")); + if (!keyValue.Equals("Bridge Systems BV", StringComparison.OrdinalIgnoreCase)) + continue; + + string productName = Convert.ToString(appKey.GetValue("DisplayName")); + if (!productName.Equals("Bridgemate Control Software", StringComparison.OrdinalIgnoreCase) + && !productName.Equals("Bridgemate Pro Control", StringComparison.OrdinalIgnoreCase)) + continue; + + string version = Convert.ToString(appKey.GetValue("DisplayVersion")); + return version; + } + } + } + } + } + return null; + } + private void bLaunch_Click(object sender, EventArgs e) { if (trySave()) -- cgit v1.2.3 From 706d0a874b693252a4bab491226df876a819fb25 Mon Sep 17 00:00:00 2001 From: emkael Date: Thu, 27 Jul 2017 14:11:17 +0200 Subject: Launching BCS from detected location --- Aktywator/MainForm.cs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'Aktywator/MainForm.cs') diff --git a/Aktywator/MainForm.cs b/Aktywator/MainForm.cs index 8d8fb89..cfe2324 100644 --- a/Aktywator/MainForm.cs +++ b/Aktywator/MainForm.cs @@ -99,6 +99,12 @@ namespace Aktywator && !productName.Equals("Bridgemate Pro Control", StringComparison.OrdinalIgnoreCase)) continue; + string appPath = Convert.ToString(appKey.GetValue("InstallLocation")); + if (appPath != null) + { + Bws.setAppLocation(appPath); + } + string version = Convert.ToString(appKey.GetValue("DisplayVersion")); return version; } -- cgit v1.2.3 From 79bf7b0fa374e3f92c05dfa5dae34eef83d12a0c Mon Sep 17 00:00:00 2001 From: emkael Date: Thu, 27 Jul 2017 14:16:22 +0200 Subject: Storing setting checkbox-version number association separately from BWS operations --- Aktywator/Bws.cs | 3 ++- Aktywator/MainForm.cs | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'Aktywator/MainForm.cs') diff --git a/Aktywator/Bws.cs b/Aktywator/Bws.cs index 14a97ad..0e574b8 100644 --- a/Aktywator/Bws.cs +++ b/Aktywator/Bws.cs @@ -78,7 +78,7 @@ namespace Aktywator return sections.ToArray(); } - public void initSettings() + public List initSettings() { settings = new List(); settings.Add(new Setting("ShowResults", main.xShowResults, this, new Version(2, 0, 0), new Version(1, 3, 1))); @@ -105,6 +105,7 @@ namespace Aktywator settings.Add(new Setting("BM2RecordBidding", main.xCollectBidding, this, new Version(2, 0, 0), new Version(1, 3, 1))); settings.Add(new Setting("BM2RecordPlay", main.xCollectPlay, this, new Version(2, 0, 0), new Version(1, 3, 1))); settings.Add(new Setting("BM2ValidateLeadCard", main.xCheckLeadCard, this, new Version(3, 2, 1), new Version(2, 2, 1))); + return settings; } private string getSectionList(string table) diff --git a/Aktywator/MainForm.cs b/Aktywator/MainForm.cs index cfe2324..5999e4a 100644 --- a/Aktywator/MainForm.cs +++ b/Aktywator/MainForm.cs @@ -16,6 +16,7 @@ namespace Aktywator public string date = "28.06.2017"; private Bws bws; + private List bwsSettings; private Tournament tournament; private Version BCSVersion; @@ -65,7 +66,9 @@ namespace Aktywator bws.convert(); labelFilename.Text = filename; - bws.initSettings(); + // cloning Setting List returned from Bws, because we're going to extend it for version tracking purposes + this.bwsSettings = new List(bws.initSettings()); + this.bwsSettings.Add(new Setting("BM2ShowPlayerNames", this.xShowPlayerNames, bws, new Version(2, 0, 0), new Version(1, 3, 1))); bws.loadSettings(); this.WindowState = FormWindowState.Normal; } -- cgit v1.2.3 From 1a6e46fb0a4726093509723a71512868fe6eaa40 Mon Sep 17 00:00:00 2001 From: emkael Date: Thu, 27 Jul 2017 14:20:19 +0200 Subject: Checking required versions on setting checkbox changes --- Aktywator/MainForm.cs | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) (limited to 'Aktywator/MainForm.cs') diff --git a/Aktywator/MainForm.cs b/Aktywator/MainForm.cs index 5999e4a..039ab72 100644 --- a/Aktywator/MainForm.cs +++ b/Aktywator/MainForm.cs @@ -21,6 +21,9 @@ namespace Aktywator private Version BCSVersion; + public static Version requiredBCSVersion; + public static Version requiredFWVersion; + public MainForm() { InitializeComponent(); @@ -69,10 +72,56 @@ namespace Aktywator // cloning Setting List returned from Bws, because we're going to extend it for version tracking purposes this.bwsSettings = new List(bws.initSettings()); this.bwsSettings.Add(new Setting("BM2ShowPlayerNames", this.xShowPlayerNames, bws, new Version(2, 0, 0), new Version(1, 3, 1))); + bindSettingChanges(); bws.loadSettings(); this.WindowState = FormWindowState.Normal; } + private void bindSettingChanges() + { + foreach (Setting s in this.bwsSettings) + { + s.field.CheckedChanged += new EventHandler(setting_field_CheckedChanged); + } + } + + void setting_field_CheckedChanged(object sender, EventArgs e) + { + requiredBCSVersion = null; + requiredFWVersion = null; + foreach (Setting s in this.bwsSettings) + { + if (s.field.Checked) + { + if (requiredBCSVersion == null || requiredBCSVersion < s.bcsV) + { + requiredBCSVersion = s.bcsV; + } + if (requiredFWVersion == null || requiredFWVersion < s.fwV) + { + requiredFWVersion = s.fwV; + } + } + } + lRequiredVersion.Text = (requiredBCSVersion != null) ? requiredBCSVersion.ToString() : "--"; + lRequiredFirmware.Text = (requiredFWVersion != null) ? requiredFWVersion.ToString() : "--"; + if (BCSVersion != null) + { + if (requiredBCSVersion > BCSVersion) + { + lDetectedVersion.ForeColor = Color.Red; + } + else + { + lDetectedVersion.ForeColor = Color.Green; + } + } + else + { + lDetectedVersion.ForeColor = Color.Black; + } + } + private string detectBCSVersion() { RegistryKey[] keys = -- cgit v1.2.3 From 2258d181b8dfab45d73812bdc1ddc2d4aaff1817 Mon Sep 17 00:00:00 2001 From: emkael Date: Thu, 27 Jul 2017 14:20:46 +0200 Subject: Displaying required versions in checkbox tooltips --- Aktywator/MainForm.cs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'Aktywator/MainForm.cs') diff --git a/Aktywator/MainForm.cs b/Aktywator/MainForm.cs index 039ab72..5e90be1 100644 --- a/Aktywator/MainForm.cs +++ b/Aktywator/MainForm.cs @@ -82,6 +82,24 @@ namespace Aktywator foreach (Setting s in this.bwsSettings) { s.field.CheckedChanged += new EventHandler(setting_field_CheckedChanged); + StringBuilder tBuilder = new StringBuilder(); + if (s.bcsV != null) + { + tBuilder.Append("BCS >= "); + tBuilder.Append(s.bcsV); + tBuilder.Append(", "); + } + if (s.fwV != null) + { + tBuilder.Append("firmware >= "); + tBuilder.Append(s.fwV); + } + String title = tBuilder.ToString().Trim().Trim(','); + if (!("".Equals(title))) + { + ToolTip tip = new ToolTip(); + tip.SetToolTip(s.field, title); + } } } -- cgit v1.2.3 From d881e1c8c1c0997ed56a386ab815fb8a8147e0f8 Mon Sep 17 00:00:00 2001 From: emkael Date: Thu, 27 Jul 2017 14:29:52 +0200 Subject: Changelog and version bump --- Aktywator.txt | 5 +++++ Aktywator/MainForm.cs | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) (limited to 'Aktywator/MainForm.cs') diff --git a/Aktywator.txt b/Aktywator.txt index b88ba1a..ca14637 100644 --- a/Aktywator.txt +++ b/Aktywator.txt @@ -1,6 +1,11 @@ Known issues: - nie działa oddzielne maksowanie każdego sektora +--------------------- +Aktywator 1.0.8 +27.07.2017 [mkl] + * kontrola sugerowanych minimalnych wersji oprogramowania BCS wymaganych do działania poszczególnych opcji + --------------------- Aktywator 1.0.7 13.03.2017 [mkl] diff --git a/Aktywator/MainForm.cs b/Aktywator/MainForm.cs index 5e90be1..b1efe50 100644 --- a/Aktywator/MainForm.cs +++ b/Aktywator/MainForm.cs @@ -12,8 +12,8 @@ namespace Aktywator { public partial class MainForm : Form { - public string version = "1.0.7"; - public string date = "28.06.2017"; + public string version = "1.0.8"; + public string date = "27.07.2017"; private Bws bws; private List bwsSettings; -- cgit v1.2.3