diff --git a/LibationLauncher/LibationLauncher.csproj b/LibationLauncher/LibationLauncher.csproj index cce0b2e6..9d7606d9 100644 --- a/LibationLauncher/LibationLauncher.csproj +++ b/LibationLauncher/LibationLauncher.csproj @@ -13,7 +13,7 @@ win-x64 - 3.1.12.279 + 3.1.12.280 diff --git a/LibationWinForms/LibationWinForms.csproj b/LibationWinForms/LibationWinForms.csproj index 13c58b46..a5634bb3 100644 --- a/LibationWinForms/LibationWinForms.csproj +++ b/LibationWinForms/LibationWinForms.csproj @@ -27,6 +27,12 @@ LibationFilesDialog.cs + + Form + + + ScanAccountsDialog.cs + SettingsDialog.cs @@ -49,6 +55,9 @@ LibationFilesDialog.cs + + ScanAccountsDialog.cs + SettingsDialog.cs diff --git a/LibationWinForms/UNTESTED/Dialogs/ScanAccountsDialog.Designer.cs b/LibationWinForms/UNTESTED/Dialogs/ScanAccountsDialog.Designer.cs new file mode 100644 index 00000000..40d82977 --- /dev/null +++ b/LibationWinForms/UNTESTED/Dialogs/ScanAccountsDialog.Designer.cs @@ -0,0 +1,105 @@ +namespace LibationWinForms.Dialogs +{ + partial class ScanAccountsDialog + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.accountsLbl = new System.Windows.Forms.Label(); + this.accountsClb = new System.Windows.Forms.CheckedListBox(); + this.importBtn = new System.Windows.Forms.Button(); + this.cancelBtn = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // accountsLbl + // + this.accountsLbl.AutoSize = true; + this.accountsLbl.Location = new System.Drawing.Point(12, 9); + this.accountsLbl.Name = "accountsLbl"; + this.accountsLbl.Size = new System.Drawing.Size(193, 13); + this.accountsLbl.TabIndex = 0; + this.accountsLbl.Text = "Check the accounts to scan and import"; + // + // accountsClb + // + this.accountsClb.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.accountsClb.FormattingEnabled = true; + this.accountsClb.Location = new System.Drawing.Point(12, 25); + this.accountsClb.Name = "accountsClb"; + this.accountsClb.Size = new System.Drawing.Size(265, 94); + this.accountsClb.TabIndex = 1; + // + // importBtn + // + this.importBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.importBtn.Location = new System.Drawing.Point(101, 125); + this.importBtn.Name = "importBtn"; + this.importBtn.Size = new System.Drawing.Size(75, 23); + this.importBtn.TabIndex = 2; + this.importBtn.Text = "Import"; + this.importBtn.UseVisualStyleBackColor = true; + this.importBtn.Click += new System.EventHandler(this.importBtn_Click); + // + // cancelBtn + // + this.cancelBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.cancelBtn.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.cancelBtn.Location = new System.Drawing.Point(202, 125); + this.cancelBtn.Name = "cancelBtn"; + this.cancelBtn.Size = new System.Drawing.Size(75, 23); + this.cancelBtn.TabIndex = 3; + this.cancelBtn.Text = "Cancel"; + this.cancelBtn.UseVisualStyleBackColor = true; + this.cancelBtn.Click += new System.EventHandler(this.cancelBtn_Click); + // + // ScanAccountsDialog + // + this.AcceptButton = this.importBtn; + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.CancelButton = this.cancelBtn; + this.ClientSize = new System.Drawing.Size(289, 160); + this.Controls.Add(this.cancelBtn); + this.Controls.Add(this.importBtn); + this.Controls.Add(this.accountsClb); + this.Controls.Add(this.accountsLbl); + this.Name = "ScanAccountsDialog"; + this.Text = "Which accounts?"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Label accountsLbl; + private System.Windows.Forms.CheckedListBox accountsClb; + private System.Windows.Forms.Button importBtn; + private System.Windows.Forms.Button cancelBtn; + } +} \ No newline at end of file diff --git a/LibationWinForms/UNTESTED/Dialogs/ScanAccountsDialog.cs b/LibationWinForms/UNTESTED/Dialogs/ScanAccountsDialog.cs new file mode 100644 index 00000000..f3ea660c --- /dev/null +++ b/LibationWinForms/UNTESTED/Dialogs/ScanAccountsDialog.cs @@ -0,0 +1,30 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace LibationWinForms.Dialogs +{ + public partial class ScanAccountsDialog : Form + { + public ScanAccountsDialog() + { + InitializeComponent(); + } + + private void importBtn_Click(object sender, EventArgs e) + { + + + + // this.Close(); + } + + private void cancelBtn_Click(object sender, EventArgs e) => this.Close(); + } +} diff --git a/LibationWinForms/UNTESTED/Dialogs/ScanAccountsDialog.resx b/LibationWinForms/UNTESTED/Dialogs/ScanAccountsDialog.resx new file mode 100644 index 00000000..1af7de15 --- /dev/null +++ b/LibationWinForms/UNTESTED/Dialogs/ScanAccountsDialog.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/WinFormsDesigner/Dialogs/ScanAccountsDialog.Designer.cs b/WinFormsDesigner/Dialogs/ScanAccountsDialog.Designer.cs new file mode 100644 index 00000000..d432345a --- /dev/null +++ b/WinFormsDesigner/Dialogs/ScanAccountsDialog.Designer.cs @@ -0,0 +1,103 @@ +namespace WinFormsDesigner.Dialogs +{ + partial class ScanAccountsDialog + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.accountsLbl = new System.Windows.Forms.Label(); + this.accountsClb = new System.Windows.Forms.CheckedListBox(); + this.importBtn = new System.Windows.Forms.Button(); + this.cancelBtn = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // accountsLbl + // + this.accountsLbl.AutoSize = true; + this.accountsLbl.Location = new System.Drawing.Point(12, 9); + this.accountsLbl.Name = "accountsLbl"; + this.accountsLbl.Size = new System.Drawing.Size(193, 13); + this.accountsLbl.TabIndex = 0; + this.accountsLbl.Text = "Check the accounts to scan and import"; + // + // accountsClb + // + this.accountsClb.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.accountsClb.FormattingEnabled = true; + this.accountsClb.Location = new System.Drawing.Point(12, 25); + this.accountsClb.Name = "accountsClb"; + this.accountsClb.Size = new System.Drawing.Size(265, 94); + this.accountsClb.TabIndex = 1; + // + // importBtn + // + this.importBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.importBtn.Location = new System.Drawing.Point(101, 125); + this.importBtn.Name = "importBtn"; + this.importBtn.Size = new System.Drawing.Size(75, 23); + this.importBtn.TabIndex = 2; + this.importBtn.Text = "Import"; + this.importBtn.UseVisualStyleBackColor = true; + // + // cancelBtn + // + this.cancelBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.cancelBtn.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.cancelBtn.Location = new System.Drawing.Point(202, 125); + this.cancelBtn.Name = "cancelBtn"; + this.cancelBtn.Size = new System.Drawing.Size(75, 23); + this.cancelBtn.TabIndex = 3; + this.cancelBtn.Text = "Cancel"; + this.cancelBtn.UseVisualStyleBackColor = true; + // + // ScanAccountsDialog + // + this.AcceptButton = this.importBtn; + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.CancelButton = this.cancelBtn; + this.ClientSize = new System.Drawing.Size(289, 160); + this.Controls.Add(this.cancelBtn); + this.Controls.Add(this.importBtn); + this.Controls.Add(this.accountsClb); + this.Controls.Add(this.accountsLbl); + this.Name = "ScanAccountsDialog"; + this.Text = "Which accounts?"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Label accountsLbl; + private System.Windows.Forms.CheckedListBox accountsClb; + private System.Windows.Forms.Button importBtn; + private System.Windows.Forms.Button cancelBtn; + } +} \ No newline at end of file diff --git a/WinFormsDesigner/Dialogs/ScanAccountsDialog.cs b/WinFormsDesigner/Dialogs/ScanAccountsDialog.cs new file mode 100644 index 00000000..63237b77 --- /dev/null +++ b/WinFormsDesigner/Dialogs/ScanAccountsDialog.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace WinFormsDesigner.Dialogs +{ + public partial class ScanAccountsDialog : Form + { + public ScanAccountsDialog() + { + InitializeComponent(); + } + } +} diff --git a/WinFormsDesigner/Dialogs/ScanAccountsDialog.resx b/WinFormsDesigner/Dialogs/ScanAccountsDialog.resx new file mode 100644 index 00000000..1af7de15 --- /dev/null +++ b/WinFormsDesigner/Dialogs/ScanAccountsDialog.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/WinFormsDesigner/WinFormsDesigner.csproj b/WinFormsDesigner/WinFormsDesigner.csproj index 8804cddb..37f10612 100644 --- a/WinFormsDesigner/WinFormsDesigner.csproj +++ b/WinFormsDesigner/WinFormsDesigner.csproj @@ -113,6 +113,12 @@ EditTagsDialog.cs + + Form + + + ScanAccountsDialog.cs + Form @@ -179,6 +185,9 @@ _2faCodeDialog.cs + + ScanAccountsDialog.cs + SettingsDialog.cs diff --git a/_Tests/InternalUtilities.Tests/AccountTests.cs b/_Tests/InternalUtilities.Tests/AccountTests.cs index ad555c5c..b2db871b 100644 --- a/_Tests/InternalUtilities.Tests/AccountTests.cs +++ b/_Tests/InternalUtilities.Tests/AccountTests.cs @@ -536,6 +536,31 @@ namespace AccountsTests } [TestMethod] + public void delete_updates() + { + var i = 0; + void update(object sender, EventArgs e) => i++; + + var accountsSettings = new AccountsSettings(); + accountsSettings.Updated += update; + + accountsSettings.Accounts.Count.Should().Be(0); + i.Should().Be(0); + + _ = accountsSettings.Upsert("cng", "us"); + accountsSettings.Accounts.Count.Should().Be(1); + i.Should().Be(1); + + accountsSettings.Delete("baz", "baz").Should().BeFalse(); + accountsSettings.Accounts.Count.Should().Be(1); + i.Should().Be(1); + + accountsSettings.Delete("cng", "us").Should().BeTrue(); + accountsSettings.Accounts.Count.Should().Be(0); + i.Should().Be(2); // <== this is the one being tested + } + + [TestMethod] public void deleted_account_should_not_persist_file() { Account acct;