summaryrefslogtreecommitdiff
path: root/Aktywator
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2017-08-22 14:35:03 +0200
committeremkael <emkael@tlen.pl>2017-08-22 14:35:42 +0200
commit0d2b00ca675fdb80a944a4ba403d078d728fa087 (patch)
tree809aac598f3a63badd01d0c2b5ccc3c3f4a594d6 /Aktywator
parentc3be44ed94e61c3c4bb6a69f0db891580ee7a037 (diff)
Convert BWS and add all required fields silently
Fixes #15
Diffstat (limited to 'Aktywator')
-rw-r--r--Aktywator/Bws.cs27
-rw-r--r--Aktywator/MainForm.cs5
-rw-r--r--Aktywator/Setting.cs21
3 files changed, 23 insertions, 30 deletions
diff --git a/Aktywator/Bws.cs b/Aktywator/Bws.cs
index 4bc107f..5c318f0 100644
--- a/Aktywator/Bws.cs
+++ b/Aktywator/Bws.cs
@@ -159,24 +159,6 @@ namespace Aktywator
System.Diagnostics.Process.Start(app, param);
}
- public bool isBm2()
- {
- if (!sql.checkFieldExists("Settings", "BM2PINcode"))
- return false;
- if (!sql.checkFieldExists("PlayerNames", "Name"))
- return false;
- if (!sql.checkFieldExists("PlayerNumbers", "Name"))
- return false;
- if (!sql.checkFieldExists("Settings", "BM2ViewHandrecord"))
- return false;
- if (!sql.checkTableExists("HandRecord"))
- return false;
- if (!sql.checkTableExists("HandEvaluation"))
- return false;
-
- return true;
- }
-
public void convert()
{
List<Setting> settings = new List<Setting>();
@@ -209,14 +191,7 @@ namespace Aktywator
foreach (Setting s in settings)
{
- try
- {
- sql.query(s.getAddColumnSql());
- sql.query(s.getSetDefaultSql());
- }
- catch (OleDbException)
- {
- }
+ s.createField(sql, false);
}
try
diff --git a/Aktywator/MainForm.cs b/Aktywator/MainForm.cs
index 01c7e19..85ec29f 100644
--- a/Aktywator/MainForm.cs
+++ b/Aktywator/MainForm.cs
@@ -63,10 +63,7 @@ namespace Aktywator
}
bws = new Bws(filename, this);
- if (!bws.isBm2())
- if (MessageBox.Show("Ten BWS nie jest przygotowany dla BM2. Przekonwertować?", "Konwersja do BM2",
- MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
- bws.convert();
+ bws.convert();
labelFilename.Text = filename;
// cloning Setting List returned from Bws, because we're going to extend it for version tracking purposes
diff --git a/Aktywator/Setting.cs b/Aktywator/Setting.cs
index d31a452..e981328 100644
--- a/Aktywator/Setting.cs
+++ b/Aktywator/Setting.cs
@@ -135,5 +135,26 @@ namespace Aktywator
}
return str.ToString();
}
+
+ public void createField(Sql sql, bool setDefault = true)
+ {
+ try
+ {
+ sql.query(this.getAddColumnSql());
+ }
+ catch (OleDbException)
+ {
+ }
+ if (setDefault)
+ {
+ try
+ {
+ sql.query(this.getSetDefaultSql());
+ }
+ catch (OleDbException)
+ {
+ }
+ }
+ }
}
}