diff --git a/Voile.Patchouli/Reflection/VoilePluginManager.cs b/Voile.Patchouli/Reflection/VoilePluginManager.cs index 0a3522b..16c40fc 100644 --- a/Voile.Patchouli/Reflection/VoilePluginManager.cs +++ b/Voile.Patchouli/Reflection/VoilePluginManager.cs @@ -83,5 +83,10 @@ namespace Voile.Patchouli.Reflection throw new VoileReflectionException(String.Format("Could not figure out plugin type of {0}", t.Name)); } } + + public IReadOnlyList GetDataStorages() + { + return _knownDataStorages.AsReadOnly(); + } } } diff --git a/Voile/FirstRunWizard.Designer.cs b/Voile/FirstRunWizard.Designer.cs index a7840a4..54c684d 100644 --- a/Voile/FirstRunWizard.Designer.cs +++ b/Voile/FirstRunWizard.Designer.cs @@ -48,11 +48,14 @@ buttonNext = new Button(); buttonBack = new Button(); openFileDialogCertificate = new OpenFileDialog(); + tabPage1 = new TabPage(); + label5 = new Label(); ((System.ComponentModel.ISupportInitialize)pictureBox1).BeginInit(); tabControl1.SuspendLayout(); tabPageWelcome.SuspendLayout(); tabPageLicense.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)pictureBox2).BeginInit(); + tabPage1.SuspendLayout(); SuspendLayout(); // // pictureBox1 @@ -69,6 +72,7 @@ // tabControl1.Controls.Add(tabPageWelcome); tabControl1.Controls.Add(tabPageLicense); + tabControl1.Controls.Add(tabPage1); tabControl1.Location = new Point(138, 12); tabControl1.Name = "tabControl1"; tabControl1.SelectedIndex = 0; @@ -255,6 +259,25 @@ openFileDialogCertificate.Filter = "X.509 Certificate (*.cer)|*.cer"; openFileDialogCertificate.Title = "Open Voile License File"; // + // tabPage1 + // + tabPage1.Controls.Add(label5); + tabPage1.Location = new Point(4, 24); + tabPage1.Name = "tabPage1"; + tabPage1.Size = new Size(348, 384); + tabPage1.TabIndex = 2; + tabPage1.Text = "Pick Data Storage"; + tabPage1.UseVisualStyleBackColor = true; + // + // label5 + // + label5.AutoSize = true; + label5.Location = new Point(3, 0); + label5.Name = "label5"; + label5.Size = new Size(347, 165); + label5.TabIndex = 0; + label5.Text = resources.GetString("label5.Text"); + // // FirstRunWizard // AutoScaleDimensions = new SizeF(7F, 15F); @@ -277,6 +300,8 @@ tabPageLicense.ResumeLayout(false); tabPageLicense.PerformLayout(); ((System.ComponentModel.ISupportInitialize)pictureBox2).EndInit(); + tabPage1.ResumeLayout(false); + tabPage1.PerformLayout(); ResumeLayout(false); } @@ -301,5 +326,7 @@ private Label label4; private PictureBox pictureBox2; private OpenFileDialog openFileDialogCertificate; + private TabPage tabPage1; + private Label label5; } } \ No newline at end of file diff --git a/Voile/FirstRunWizard.cs b/Voile/FirstRunWizard.cs index 965002f..6705a9a 100644 --- a/Voile/FirstRunWizard.cs +++ b/Voile/FirstRunWizard.cs @@ -10,6 +10,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; +using Voile.Patchouli.Reflection; using Voile.Properties; namespace Voile @@ -31,6 +32,9 @@ namespace Voile private byte[] licenseBuffer; private int licenseState; private X509Certificate licenseCertificate; + private bool sharewareMode; + + private bool dataStorageRadioButtonsGenerated; public void DisplayTabPage(int target, bool isGoingBack = false) { @@ -74,6 +78,7 @@ namespace Voile buttonNext.Enabled = radioButtonAmBegginer.Checked || radioButtonAmExpert.Checked; break; case 1: + //Lizenzstatus validieren. buttonValidateLicense.Enabled = ((licenceCertificateFileInfo != null) & radioButtonHasLicense.Checked); buttonLoadLicenseFile.Enabled = radioButtonHasLicense.Checked; pictureBox2.Visible = radioButtonHasLicense.Checked; @@ -102,6 +107,14 @@ namespace Voile break; } } + + //Können wir weiter machen? + sharewareMode = radioButtonNoLicense.Checked; + buttonNext.Enabled = (sharewareMode) | (licenseState == 6); + break; + case 2: + if (!dataStorageRadioButtonsGenerated) + GenerateDataStorageRadioButtons(); break; default: MessageBox.Show("Could not find handler for the current tab page."); @@ -109,6 +122,13 @@ namespace Voile } } + private void GenerateDataStorageRadioButtons() + { + VoilePluginManager pluginManager = VoilePluginManager.GetInstance(); + IReadOnlyList dataStoragePlugins = pluginManager.GetDataStorages(); + //TODO: Finish generating the radio buttons for the data storage. + } + private void radioButton3_CheckedChanged(object sender, EventArgs e) { RefreshView(); diff --git a/Voile/FirstRunWizard.resx b/Voile/FirstRunWizard.resx index d12d1bf..951b465 100644 --- a/Voile/FirstRunWizard.resx +++ b/Voile/FirstRunWizard.resx @@ -117,6 +117,19 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + Great — let’s choose where Voile should store its +structured data. + +Blindscan results, DVB table contents, and historical +scan information will all be kept in the storage option you select +below. Since you’re using Expert Mode, you have full control +over the database backend. (In Beginner Mode, Voile would +simply use SQLite automatically.) + +Feel free to pick the option that best fits your workflow or +existing infrastructure. + Welcome to Voile! diff --git a/Voile/Persistence/DirectoryStorage.cs b/Voile/Persistence/DirectoryStorage.cs new file mode 100644 index 0000000..f0920b4 --- /dev/null +++ b/Voile/Persistence/DirectoryStorage.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Voile.Patchouli.Data; + +namespace Voile.Persistence +{ + internal class DirectoryStorage : IVoileObjectStorage, IVoileDataStorage + { + public DirectoryStorage(DirectoryInfo directory) + { + Directory = directory; + } + + public DirectoryInfo Directory { get; } + } +} diff --git a/Voile/Persistence/DirectoryStorageFactory.cs b/Voile/Persistence/DirectoryStorageFactory.cs new file mode 100644 index 0000000..131d91c --- /dev/null +++ b/Voile/Persistence/DirectoryStorageFactory.cs @@ -0,0 +1,47 @@ +using skyscraper8.Skyscraper.Scraper.Storage; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Voile.Common.Reflection; +using Voile.Patchouli.Data; +using Voile.Patchouli.Reflection; + +namespace Voile.Persistence +{ + [VoilePlugin] + [VoilePluginId(1)] + [Voile.Patchouli.Reflection.DisplayName("File-system folder")] + class DirectoryStorageFactory : IVoileDataStorageFactory, IVoileObjectStorageFactory + { + public override bool Equals(object? obj) + { + DirectoryStorageFactory dsf = obj as DirectoryStorageFactory + if (dsf == null) + return false; + + return dsf.Directory.Equals(this.Directory); + } + + IVoileDataStorage IVoileDataStorageFactory.CreateDataStorage() + { + return new DirectoryStorage(Directory); + } + + IVoileObjectStorage IVoileObjectStorageFactory.CreateObjectStorage() + { + return new DirectoryStorage(Directory); + } + + public bool IsEquipvalentDataStorageFactory(IVoileDataStorageFactory dataStorageFactory) + { + return Equals(dataStorageFactory); + } + + [System.ComponentModel.DisplayName("Path")] + [System.ComponentModel.Description("The Path in which data should be stored.")] + public DirectoryInfo Directory { get; set; } + } +} diff --git a/Voile/README.md b/Voile/README.md new file mode 100644 index 0000000..02efcfc --- /dev/null +++ b/Voile/README.md @@ -0,0 +1,11 @@ +# DataStorage Ids + +|Id|Name | +|--|----------------| +|1 |DirectoryStorage| + +# ObjectStorage Ids + +|Id|Name | +|--|----------------| +|1 |DirectoryStorage| \ No newline at end of file diff --git a/Voile/Voile.csproj b/Voile/Voile.csproj index 5a9e17a..a3438ae 100644 --- a/Voile/Voile.csproj +++ b/Voile/Voile.csproj @@ -22,6 +22,7 @@ +