Adding Profile and ProfileList class
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1,3 +1,3 @@
|
|||||||
Password\ Manager/bin
|
Password\ Manager/bin
|
||||||
Password\ Manager/obj
|
Password\ Manager/obj
|
||||||
.vs
|
.vs/
|
||||||
|
|||||||
Binary file not shown.
49
Password Manager/Form1.Designer.cs
generated
49
Password Manager/Form1.Designer.cs
generated
@@ -1,6 +1,6 @@
|
|||||||
namespace Password_Manager
|
namespace Password_Manager
|
||||||
{
|
{
|
||||||
partial class Form1
|
partial class MainForm
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Required designer variable.
|
/// Required designer variable.
|
||||||
@@ -28,34 +28,46 @@
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private void InitializeComponent()
|
private void InitializeComponent()
|
||||||
{
|
{
|
||||||
textBox1 = new TextBox();
|
searchBox = new TextBox();
|
||||||
listBox1 = new ListBox();
|
resultList = new ListBox();
|
||||||
|
profileSelection = new ComboBox();
|
||||||
SuspendLayout();
|
SuspendLayout();
|
||||||
//
|
//
|
||||||
// textBox1
|
// textBox1
|
||||||
//
|
//
|
||||||
textBox1.Location = new Point(23, 27);
|
searchBox.Location = new Point(12, 27);
|
||||||
textBox1.Name = "textBox1";
|
searchBox.Name = "textBox1";
|
||||||
textBox1.PlaceholderText = "Search for a password";
|
searchBox.PlaceholderText = "Search for a password";
|
||||||
textBox1.Size = new Size(257, 27);
|
searchBox.Size = new Size(257, 27);
|
||||||
textBox1.TabIndex = 0;
|
searchBox.TabIndex = 0;
|
||||||
|
searchBox.TextChanged += UpdateResultList;
|
||||||
//
|
//
|
||||||
// listBox1
|
// listBox1
|
||||||
//
|
//
|
||||||
listBox1.FormattingEnabled = true;
|
resultList.FormattingEnabled = true;
|
||||||
listBox1.ItemHeight = 20;
|
resultList.ItemHeight = 20;
|
||||||
listBox1.Location = new Point(23, 99);
|
resultList.Location = new Point(12, 99);
|
||||||
listBox1.Name = "listBox1";
|
resultList.Name = "listBox1";
|
||||||
listBox1.Size = new Size(150, 104);
|
resultList.Size = new Size(150, 104);
|
||||||
listBox1.TabIndex = 1;
|
resultList.TabIndex = 1;
|
||||||
|
//
|
||||||
|
// comboBox1
|
||||||
|
//
|
||||||
|
profileSelection.FormattingEnabled = true;
|
||||||
|
profileSelection.Location = new Point(637, 26);
|
||||||
|
profileSelection.Name = "comboBox1";
|
||||||
|
profileSelection.Size = new Size(151, 28);
|
||||||
|
profileSelection.TabIndex = 2;
|
||||||
|
profileSelection.SelectedIndexChanged += ChangeProfile;
|
||||||
//
|
//
|
||||||
// Form1
|
// Form1
|
||||||
//
|
//
|
||||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
ClientSize = new Size(800, 450);
|
ClientSize = new Size(800, 450);
|
||||||
Controls.Add(listBox1);
|
Controls.Add(profileSelection);
|
||||||
Controls.Add(textBox1);
|
Controls.Add(resultList);
|
||||||
|
Controls.Add(searchBox);
|
||||||
Name = "Form1";
|
Name = "Form1";
|
||||||
Text = "Form1";
|
Text = "Form1";
|
||||||
ResumeLayout(false);
|
ResumeLayout(false);
|
||||||
@@ -64,7 +76,8 @@
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
private TextBox textBox1;
|
private TextBox searchBox;
|
||||||
private ListBox listBox1;
|
private ListBox resultList;
|
||||||
|
private ComboBox profileSelection;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,10 +1,20 @@
|
|||||||
namespace Password_Manager
|
namespace Password_Manager
|
||||||
{
|
{
|
||||||
public partial class Form1 : Form
|
public partial class MainForm : Form
|
||||||
{
|
{
|
||||||
public Form1()
|
public MainForm()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void ChangeProfile(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void UpdateResultList(object sender, EventArgs args)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4,7 +4,7 @@ namespace Password_Manager
|
|||||||
{
|
{
|
||||||
public delegate void PasswordStoreChange();
|
public delegate void PasswordStoreChange();
|
||||||
|
|
||||||
sealed class Password_Store
|
sealed class Profile
|
||||||
{
|
{
|
||||||
public string Name { get; } //the name of the password store profile ("personal", "work", or similar)
|
public string Name { get; } //the name of the password store profile ("personal", "work", or similar)
|
||||||
public string Path { get; } //path of the folder containing the password store
|
public string Path { get; } //path of the folder containing the password store
|
||||||
62
Password Manager/ProfileList.cs
Normal file
62
Password Manager/ProfileList.cs
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace Password_Manager
|
||||||
|
{
|
||||||
|
sealed class ProfileList
|
||||||
|
{
|
||||||
|
private Profile[] list;
|
||||||
|
|
||||||
|
public int Length
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return this.list.Length;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Profile this[int index]
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return this.list[index];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public ProfileList()
|
||||||
|
{
|
||||||
|
this.list = new Profile[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Add(Profile p)
|
||||||
|
{
|
||||||
|
//grow the list by 1 and copy all existing items
|
||||||
|
Profile[] tmp = new Profile[this.Length + 1];
|
||||||
|
|
||||||
|
for (int i = 0; i < this.Length; i++)
|
||||||
|
{
|
||||||
|
tmp[i] = this[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
this.list = tmp;
|
||||||
|
|
||||||
|
//--------------------------------------------------------
|
||||||
|
|
||||||
|
list[this.Length - 1] = p;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Remove(Profile p)
|
||||||
|
{
|
||||||
|
Profile[] tmp = new Profile[this.Length - 1];
|
||||||
|
|
||||||
|
for (int i = 0; i < tmp.Length; i++)
|
||||||
|
{
|
||||||
|
if (this[i] != p)
|
||||||
|
{
|
||||||
|
tmp[i] = this[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.list = tmp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,7 +2,6 @@ namespace Password_Manager
|
|||||||
{
|
{
|
||||||
internal static class Program
|
internal static class Program
|
||||||
{
|
{
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The main entry point for the application.
|
/// The main entry point for the application.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -12,12 +11,7 @@ namespace Password_Manager
|
|||||||
// To customize application configuration such as set high DPI settings or default font,
|
// To customize application configuration such as set high DPI settings or default font,
|
||||||
// see https://aka.ms/applicationconfiguration.
|
// see https://aka.ms/applicationconfiguration.
|
||||||
ApplicationConfiguration.Initialize();
|
ApplicationConfiguration.Initialize();
|
||||||
Application.Run(new Form1());
|
Application.Run(new MainForm());
|
||||||
}
|
|
||||||
|
|
||||||
static void UpdateList(TextBox textbox, ListBox listbox)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user