Added some features, check our release
This commit is contained in:
parent
57c213312c
commit
8852f03e2a
Binary file not shown.
66
OnePass/Form1.Designer.cs
generated
66
OnePass/Form1.Designer.cs
generated
@ -48,6 +48,9 @@ namespace OnePass
|
|||||||
this.special = new System.Windows.Forms.Label();
|
this.special = new System.Windows.Forms.Label();
|
||||||
this.extspc = new System.Windows.Forms.Label();
|
this.extspc = new System.Windows.Forms.Label();
|
||||||
this.help = new System.Windows.Forms.Button();
|
this.help = new System.Windows.Forms.Button();
|
||||||
|
this.save_login = new System.Windows.Forms.Button();
|
||||||
|
this.load_login = new System.Windows.Forms.Button();
|
||||||
|
this.label7 = new System.Windows.Forms.Label();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.passCycle)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.passCycle)).BeginInit();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.passLength)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.passLength)).BeginInit();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
@ -66,7 +69,7 @@ namespace OnePass
|
|||||||
//
|
//
|
||||||
this.passCycle.Location = new System.Drawing.Point(209, 149);
|
this.passCycle.Location = new System.Drawing.Point(209, 149);
|
||||||
this.passCycle.Maximum = new decimal(new int[] {
|
this.passCycle.Maximum = new decimal(new int[] {
|
||||||
1000,
|
9999,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
0});
|
0});
|
||||||
@ -78,7 +81,7 @@ namespace OnePass
|
|||||||
//
|
//
|
||||||
this.passLength.Location = new System.Drawing.Point(112, 150);
|
this.passLength.Location = new System.Drawing.Point(112, 150);
|
||||||
this.passLength.Maximum = new decimal(new int[] {
|
this.passLength.Maximum = new decimal(new int[] {
|
||||||
64,
|
128,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
0});
|
0});
|
||||||
@ -153,21 +156,21 @@ namespace OnePass
|
|||||||
//
|
//
|
||||||
this.sitename.Location = new System.Drawing.Point(43, 6);
|
this.sitename.Location = new System.Drawing.Point(43, 6);
|
||||||
this.sitename.Name = "sitename";
|
this.sitename.Name = "sitename";
|
||||||
this.sitename.Size = new System.Drawing.Size(290, 20);
|
this.sitename.Size = new System.Drawing.Size(321, 20);
|
||||||
this.sitename.TabIndex = 9;
|
this.sitename.TabIndex = 9;
|
||||||
//
|
//
|
||||||
// username
|
// username
|
||||||
//
|
//
|
||||||
this.username.Location = new System.Drawing.Point(43, 31);
|
this.username.Location = new System.Drawing.Point(43, 31);
|
||||||
this.username.Name = "username";
|
this.username.Name = "username";
|
||||||
this.username.Size = new System.Drawing.Size(325, 20);
|
this.username.Size = new System.Drawing.Size(321, 20);
|
||||||
this.username.TabIndex = 10;
|
this.username.TabIndex = 10;
|
||||||
//
|
//
|
||||||
// masterpass
|
// masterpass
|
||||||
//
|
//
|
||||||
this.masterpass.Location = new System.Drawing.Point(107, 56);
|
this.masterpass.Location = new System.Drawing.Point(107, 56);
|
||||||
this.masterpass.Name = "masterpass";
|
this.masterpass.Name = "masterpass";
|
||||||
this.masterpass.Size = new System.Drawing.Size(261, 20);
|
this.masterpass.Size = new System.Drawing.Size(257, 20);
|
||||||
this.masterpass.TabIndex = 11;
|
this.masterpass.TabIndex = 11;
|
||||||
this.masterpass.UseSystemPasswordChar = true;
|
this.masterpass.UseSystemPasswordChar = true;
|
||||||
//
|
//
|
||||||
@ -249,19 +252,55 @@ namespace OnePass
|
|||||||
//
|
//
|
||||||
// help
|
// help
|
||||||
//
|
//
|
||||||
this.help.Location = new System.Drawing.Point(339, 4);
|
this.help.Location = new System.Drawing.Point(370, 6);
|
||||||
this.help.Name = "help";
|
this.help.Name = "help";
|
||||||
this.help.Size = new System.Drawing.Size(29, 23);
|
this.help.Size = new System.Drawing.Size(52, 23);
|
||||||
this.help.TabIndex = 18;
|
this.help.TabIndex = 18;
|
||||||
this.help.Text = "?";
|
this.help.Text = "Help";
|
||||||
this.help.UseVisualStyleBackColor = true;
|
this.help.UseVisualStyleBackColor = true;
|
||||||
this.help.Click += new System.EventHandler(this.help_Click);
|
this.help.Click += new System.EventHandler(this.help_Click);
|
||||||
//
|
//
|
||||||
|
// save_login
|
||||||
|
//
|
||||||
|
this.save_login.Location = new System.Drawing.Point(370, 29);
|
||||||
|
this.save_login.Name = "save_login";
|
||||||
|
this.save_login.Size = new System.Drawing.Size(52, 23);
|
||||||
|
this.save_login.TabIndex = 19;
|
||||||
|
this.save_login.Text = "Save";
|
||||||
|
this.save_login.UseVisualStyleBackColor = true;
|
||||||
|
this.save_login.Click += new System.EventHandler(this.save_login_Click);
|
||||||
|
//
|
||||||
|
// load_login
|
||||||
|
//
|
||||||
|
this.load_login.Location = new System.Drawing.Point(370, 53);
|
||||||
|
this.load_login.Name = "load_login";
|
||||||
|
this.load_login.Size = new System.Drawing.Size(52, 23);
|
||||||
|
this.load_login.TabIndex = 20;
|
||||||
|
this.load_login.Text = "Load";
|
||||||
|
this.load_login.UseVisualStyleBackColor = true;
|
||||||
|
this.load_login.Click += new System.EventHandler(this.load_login_Click);
|
||||||
|
//
|
||||||
|
// label7
|
||||||
|
//
|
||||||
|
this.label7.AutoSize = true;
|
||||||
|
this.label7.BackColor = System.Drawing.SystemColors.InactiveCaption;
|
||||||
|
this.label7.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||||
|
this.label7.Font = new System.Drawing.Font("Segoe UI", 20F);
|
||||||
|
this.label7.Location = new System.Drawing.Point(370, 95);
|
||||||
|
this.label7.Name = "label7";
|
||||||
|
this.label7.Size = new System.Drawing.Size(49, 39);
|
||||||
|
this.label7.TabIndex = 21;
|
||||||
|
this.label7.Text = "Pn";
|
||||||
|
this.label7.Click += new System.EventHandler(this.label7_Click);
|
||||||
|
//
|
||||||
// Form1
|
// Form1
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
this.ClientSize = new System.Drawing.Size(380, 180);
|
this.ClientSize = new System.Drawing.Size(426, 180);
|
||||||
|
this.Controls.Add(this.label7);
|
||||||
|
this.Controls.Add(this.load_login);
|
||||||
|
this.Controls.Add(this.save_login);
|
||||||
this.Controls.Add(this.help);
|
this.Controls.Add(this.help);
|
||||||
this.Controls.Add(this.extspc);
|
this.Controls.Add(this.extspc);
|
||||||
this.Controls.Add(this.special);
|
this.Controls.Add(this.special);
|
||||||
@ -281,10 +320,10 @@ namespace OnePass
|
|||||||
this.Controls.Add(this.passCycle);
|
this.Controls.Add(this.passCycle);
|
||||||
this.Controls.Add(this.Generate);
|
this.Controls.Add(this.Generate);
|
||||||
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
||||||
this.MaximumSize = new System.Drawing.Size(396, 219);
|
this.MaximumSize = new System.Drawing.Size(442, 219);
|
||||||
this.MinimumSize = new System.Drawing.Size(396, 219);
|
this.MinimumSize = new System.Drawing.Size(442, 219);
|
||||||
this.Name = "Form1";
|
this.Name = "Form1";
|
||||||
this.Text = "OnePass V2.0";
|
this.Text = "OnePass V3.0";
|
||||||
((System.ComponentModel.ISupportInitialize)(this.passCycle)).EndInit();
|
((System.ComponentModel.ISupportInitialize)(this.passCycle)).EndInit();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.passLength)).EndInit();
|
((System.ComponentModel.ISupportInitialize)(this.passLength)).EndInit();
|
||||||
this.ResumeLayout(false);
|
this.ResumeLayout(false);
|
||||||
@ -312,6 +351,9 @@ namespace OnePass
|
|||||||
private System.Windows.Forms.Label special;
|
private System.Windows.Forms.Label special;
|
||||||
private System.Windows.Forms.Label extspc;
|
private System.Windows.Forms.Label extspc;
|
||||||
private System.Windows.Forms.Button help;
|
private System.Windows.Forms.Button help;
|
||||||
|
private System.Windows.Forms.Button save_login;
|
||||||
|
private System.Windows.Forms.Button load_login;
|
||||||
|
private System.Windows.Forms.Label label7;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
152
OnePass/Form1.cs
152
OnePass/Form1.cs
@ -11,13 +11,67 @@ namespace OnePass
|
|||||||
{
|
{
|
||||||
public partial class Form1 : Form
|
public partial class Form1 : Form
|
||||||
{
|
{
|
||||||
|
private Form2 form2 = new Form2();
|
||||||
public Form1()
|
public Form1()
|
||||||
{
|
{
|
||||||
|
Directory.CreateDirectory(form2.path);
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
string vowels = "aaaaaeeeeeeeiiiiiooooouuu";
|
||||||
|
string consonants = "bbcccdddfffgghhhhjklllmmmnnnnnpprrrrrsssssttttttvwwxyyz";
|
||||||
|
|
||||||
|
string[] vowelafter = { "th", "ch", "sh", "qu" };
|
||||||
|
string[] consonantafter = { "oo", "ee" };
|
||||||
|
|
||||||
|
public string GeneratePassword(int length, int seed)
|
||||||
|
{
|
||||||
|
Random rnd = new Random(seed);
|
||||||
|
string pass = "";
|
||||||
|
bool isvowel = false;
|
||||||
|
|
||||||
|
for (int i = 0; i < length; i++)
|
||||||
|
{
|
||||||
|
if (isvowel)
|
||||||
|
{
|
||||||
|
if (rnd.Next(0, 5) == 0 && i < (length - 1))
|
||||||
|
{
|
||||||
|
pass += consonantafter[rnd.Next(0, consonantafter.Length)];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pass += vowels.Substring(rnd.Next(0, vowels.Length), 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (rnd.Next(0, 5) == 0 && i < (length - 1))
|
||||||
|
{
|
||||||
|
pass += vowelafter[rnd.Next(0, vowelafter.Length)];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pass += consonants.Substring(rnd.Next(0, consonants.Length), 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
isvowel = !isvowel;
|
||||||
|
}
|
||||||
|
return pass;
|
||||||
|
}
|
||||||
|
private void label7_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
label7.BackColor = SystemColors.Highlight;
|
||||||
|
atoz.BackColor = SystemColors.InactiveCaption;
|
||||||
|
uAtoZ.BackColor = SystemColors.InactiveCaption;
|
||||||
|
numbers.BackColor = SystemColors.InactiveCaption;
|
||||||
|
special.BackColor = SystemColors.InactiveCaption;
|
||||||
|
extspc.BackColor = SystemColors.InactiveCaption;
|
||||||
|
}
|
||||||
private void atoz_Click(object sender, EventArgs e)
|
private void atoz_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
label7.BackColor = SystemColors.InactiveCaption;
|
||||||
if (atoz.BackColor == System.Drawing.SystemColors.InactiveCaption)
|
if (atoz.BackColor == System.Drawing.SystemColors.InactiveCaption)
|
||||||
{
|
{
|
||||||
atoz.BackColor = System.Drawing.SystemColors.Highlight;
|
atoz.BackColor = System.Drawing.SystemColors.Highlight;
|
||||||
@ -29,6 +83,7 @@ namespace OnePass
|
|||||||
|
|
||||||
private void uAtoZ_Click(object sender, EventArgs e)
|
private void uAtoZ_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
label7.BackColor = SystemColors.InactiveCaption;
|
||||||
if (uAtoZ.BackColor == System.Drawing.SystemColors.InactiveCaption)
|
if (uAtoZ.BackColor == System.Drawing.SystemColors.InactiveCaption)
|
||||||
{
|
{
|
||||||
uAtoZ.BackColor = System.Drawing.SystemColors.Highlight;
|
uAtoZ.BackColor = System.Drawing.SystemColors.Highlight;
|
||||||
@ -41,6 +96,7 @@ namespace OnePass
|
|||||||
|
|
||||||
private void numbers_Click(object sender, EventArgs e)
|
private void numbers_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
label7.BackColor = SystemColors.InactiveCaption;
|
||||||
if (numbers.BackColor == System.Drawing.SystemColors.InactiveCaption)
|
if (numbers.BackColor == System.Drawing.SystemColors.InactiveCaption)
|
||||||
{
|
{
|
||||||
numbers.BackColor = System.Drawing.SystemColors.Highlight;
|
numbers.BackColor = System.Drawing.SystemColors.Highlight;
|
||||||
@ -53,6 +109,7 @@ namespace OnePass
|
|||||||
|
|
||||||
private void special_Click(object sender, EventArgs e)
|
private void special_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
label7.BackColor = SystemColors.InactiveCaption;
|
||||||
if (special.BackColor == System.Drawing.SystemColors.InactiveCaption)
|
if (special.BackColor == System.Drawing.SystemColors.InactiveCaption)
|
||||||
{
|
{
|
||||||
special.BackColor = System.Drawing.SystemColors.Highlight;
|
special.BackColor = System.Drawing.SystemColors.Highlight;
|
||||||
@ -118,20 +175,6 @@ namespace OnePass
|
|||||||
}
|
}
|
||||||
return qs.ToString();
|
return qs.ToString();
|
||||||
}
|
}
|
||||||
private void buildImage()
|
|
||||||
{
|
|
||||||
string name = "";
|
|
||||||
var datapath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "OnePassData\\");
|
|
||||||
if(!Directory.Exists(datapath))
|
|
||||||
Directory.CreateDirectory(datapath);
|
|
||||||
MessageBox.Show(datapath + name + ".png");
|
|
||||||
var frm = Form.ActiveForm;
|
|
||||||
using (var bmp = new Bitmap(frm.Width, frm.Height))
|
|
||||||
{
|
|
||||||
frm.DrawToBitmap(bmp, new Rectangle(0, 0, bmp.Width, bmp.Height));
|
|
||||||
bmp.Save(datapath + name + ".png");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private void Generate_Click(object sender, EventArgs e)
|
private void Generate_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (sitename.Text == "" || username.Text == "" || masterpass.Text == "")
|
if (sitename.Text == "" || username.Text == "" || masterpass.Text == "")
|
||||||
@ -150,6 +193,10 @@ namespace OnePass
|
|||||||
addUpper(ref chars);
|
addUpper(ref chars);
|
||||||
if (extspc.BackColor == System.Drawing.SystemColors.Highlight)
|
if (extspc.BackColor == System.Drawing.SystemColors.Highlight)
|
||||||
addExtended(ref chars);
|
addExtended(ref chars);
|
||||||
|
if(label7.BackColor == SystemColors.Highlight)
|
||||||
|
{
|
||||||
|
chars.Add('A');
|
||||||
|
}
|
||||||
if (chars.Count == 0)
|
if (chars.Count == 0)
|
||||||
{
|
{
|
||||||
MessageBox.Show("Must have at least one option turned on to generate a password!");
|
MessageBox.Show("Must have at least one option turned on to generate a password!");
|
||||||
@ -177,6 +224,9 @@ namespace OnePass
|
|||||||
}
|
}
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
if (label7.BackColor == SystemColors.Highlight)
|
||||||
|
Clipboard.SetText(GeneratePassword((int)passLength.Value, (int)seed));
|
||||||
|
else
|
||||||
Clipboard.SetText(GenerateKey((uint)passLength.Value, seed, ref chars));
|
Clipboard.SetText(GenerateKey((uint)passLength.Value, seed, ref chars));
|
||||||
} catch
|
} catch
|
||||||
{
|
{
|
||||||
@ -194,6 +244,7 @@ namespace OnePass
|
|||||||
|
|
||||||
private void extspc_Click(object sender, EventArgs e)
|
private void extspc_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
label7.BackColor = SystemColors.InactiveCaption;
|
||||||
if (extspc.BackColor == System.Drawing.SystemColors.InactiveCaption)
|
if (extspc.BackColor == System.Drawing.SystemColors.InactiveCaption)
|
||||||
{
|
{
|
||||||
extspc.BackColor = System.Drawing.SystemColors.Highlight;
|
extspc.BackColor = System.Drawing.SystemColors.Highlight;
|
||||||
@ -208,45 +259,60 @@ namespace OnePass
|
|||||||
{
|
{
|
||||||
MessageBox.Show("When a password is generated the password will live on your clipboard for 7 seconds (paste it quick). Then your master password and the clipboard is also cleared out! Make sure nothing important is on the clipboard!","Help!");
|
MessageBox.Show("When a password is generated the password will live on your clipboard for 7 seconds (paste it quick). Then your master password and the clipboard is also cleared out! Make sure nothing important is on the clipboard!","Help!");
|
||||||
}
|
}
|
||||||
}
|
private string MakeValidFileName(string name)
|
||||||
class ImageHolder
|
|
||||||
{
|
{
|
||||||
string site;
|
string invalidChars = System.Text.RegularExpressions.Regex.Escape(new string(System.IO.Path.GetInvalidFileNameChars()));
|
||||||
string login;
|
string invalidRegStr = string.Format(@"([{0}]*\.+$)|([{0}]+)", invalidChars);
|
||||||
byte isize;
|
|
||||||
byte[] imagedata;
|
return form2.path + "\\" + System.Text.RegularExpressions.Regex.Replace(name, invalidRegStr, "_");
|
||||||
public ImageHolder(Bitmap img, string sitename, string login)
|
}
|
||||||
|
private void load_login_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
site = sitename;
|
form2.init();
|
||||||
this.login = login;
|
this.Enabled = false;
|
||||||
using (MemoryStream ms = new MemoryStream())
|
form2.ShowDialog(this);
|
||||||
|
this.Enabled = true;
|
||||||
|
if (form2.state == true)
|
||||||
{
|
{
|
||||||
img.Save(ms, System.Drawing.Imaging.ImageFormat.Bmp);
|
sitename.Text = form2.site;
|
||||||
imagedata = ms.ToArray();
|
username.Text = form2.login;
|
||||||
isize = (byte)ms.Length;
|
passCycle.Value = (decimal)form2.cycle;
|
||||||
|
passLength.Value = (decimal)form2.length;
|
||||||
|
special.BackColor = (form2.opt1) ? SystemColors.Highlight : SystemColors.InactiveCaption;
|
||||||
|
numbers.BackColor = (form2.opt2) ? SystemColors.Highlight : SystemColors.InactiveCaption;
|
||||||
|
atoz.BackColor = (form2.opt3) ? SystemColors.Highlight : SystemColors.InactiveCaption;
|
||||||
|
uAtoZ.BackColor = (form2.opt4) ? SystemColors.Highlight : SystemColors.InactiveCaption;
|
||||||
|
extspc.BackColor = (form2.opt5) ? SystemColors.Highlight : SystemColors.InactiveCaption;
|
||||||
|
label7.BackColor = (form2.opt6) ? SystemColors.Highlight : SystemColors.InactiveCaption;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public ImageHolder(string filename)
|
|
||||||
|
private void save_login_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (File.Exists(filename))
|
if(sitename.Text=="" || username.Text == "")
|
||||||
{
|
{
|
||||||
using (BinaryReader reader = new BinaryReader(File.Open(filename, FileMode.Open)))
|
MessageBox.Show("Cannot save data if fields are incomplete!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try
|
||||||
{
|
{
|
||||||
site = reader.ReadString();
|
BinaryWriter writer = new BinaryWriter(File.Open(MakeValidFileName(sitename.Text + username.Text), FileMode.Create));
|
||||||
login = reader.ReadString();
|
writer.Write(sitename.Text);
|
||||||
isize = reader.ReadByte();
|
writer.Write(username.Text);
|
||||||
imagedata = reader.ReadBytes(isize);
|
writer.Write((int)passCycle.Value);
|
||||||
|
writer.Write((int)passLength.Value);
|
||||||
|
writer.Write(special.BackColor == SystemColors.Highlight);
|
||||||
|
writer.Write(numbers.BackColor == SystemColors.Highlight);
|
||||||
|
writer.Write(atoz.BackColor == SystemColors.Highlight);
|
||||||
|
writer.Write(uAtoZ.BackColor == SystemColors.Highlight);
|
||||||
|
writer.Write(extspc.BackColor == SystemColors.Highlight);
|
||||||
|
writer.Write(label7.BackColor == SystemColors.Highlight);
|
||||||
|
writer.Flush();
|
||||||
|
writer.Dispose();
|
||||||
}
|
}
|
||||||
}
|
catch(Exception ex)
|
||||||
}
|
|
||||||
public void tofile(string filename)
|
|
||||||
{
|
{
|
||||||
using (BinaryWriter bw = new BinaryWriter(File.Open(filename, FileMode.Open)))
|
MessageBox.Show(ex.Message);
|
||||||
{
|
|
||||||
bw.Write(site);
|
|
||||||
bw.Write(login);
|
|
||||||
bw.Write(isize);
|
|
||||||
bw.Write(imagedata);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
102
OnePass/Form2.Designer.cs
generated
Normal file
102
OnePass/Form2.Designer.cs
generated
Normal file
@ -0,0 +1,102 @@
|
|||||||
|
|
||||||
|
namespace OnePass
|
||||||
|
{
|
||||||
|
partial class Form2
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean up any resources being used.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Windows Form Designer generated code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Required method for Designer support - do not modify
|
||||||
|
/// the contents of this method with the code editor.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form2));
|
||||||
|
this.Logins = new System.Windows.Forms.ListBox();
|
||||||
|
this.textBox1 = new System.Windows.Forms.TextBox();
|
||||||
|
this.select_login = new System.Windows.Forms.Button();
|
||||||
|
this.remove_login = new System.Windows.Forms.Button();
|
||||||
|
this.SuspendLayout();
|
||||||
|
//
|
||||||
|
// Logins
|
||||||
|
//
|
||||||
|
this.Logins.FormattingEnabled = true;
|
||||||
|
this.Logins.Location = new System.Drawing.Point(13, 26);
|
||||||
|
this.Logins.Name = "Logins";
|
||||||
|
this.Logins.Size = new System.Drawing.Size(296, 121);
|
||||||
|
this.Logins.TabIndex = 0;
|
||||||
|
//
|
||||||
|
// textBox1
|
||||||
|
//
|
||||||
|
this.textBox1.Enabled = false;
|
||||||
|
this.textBox1.Location = new System.Drawing.Point(13, 2);
|
||||||
|
this.textBox1.Name = "textBox1";
|
||||||
|
this.textBox1.Size = new System.Drawing.Size(296, 20);
|
||||||
|
this.textBox1.TabIndex = 1;
|
||||||
|
this.textBox1.Text = "Select a Stored Login";
|
||||||
|
//
|
||||||
|
// select_login
|
||||||
|
//
|
||||||
|
this.select_login.Location = new System.Drawing.Point(13, 153);
|
||||||
|
this.select_login.Name = "select_login";
|
||||||
|
this.select_login.Size = new System.Drawing.Size(132, 23);
|
||||||
|
this.select_login.TabIndex = 2;
|
||||||
|
this.select_login.Text = "Select Login Info";
|
||||||
|
this.select_login.UseVisualStyleBackColor = true;
|
||||||
|
this.select_login.Click += new System.EventHandler(this.select_login_Click);
|
||||||
|
//
|
||||||
|
// remove_login
|
||||||
|
//
|
||||||
|
this.remove_login.Location = new System.Drawing.Point(177, 153);
|
||||||
|
this.remove_login.Name = "remove_login";
|
||||||
|
this.remove_login.Size = new System.Drawing.Size(132, 23);
|
||||||
|
this.remove_login.TabIndex = 3;
|
||||||
|
this.remove_login.Text = "Delete Login Info";
|
||||||
|
this.remove_login.UseVisualStyleBackColor = true;
|
||||||
|
this.remove_login.Click += new System.EventHandler(this.remove_login_Click);
|
||||||
|
//
|
||||||
|
// Form2
|
||||||
|
//
|
||||||
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||||
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
|
this.ClientSize = new System.Drawing.Size(321, 182);
|
||||||
|
this.Controls.Add(this.remove_login);
|
||||||
|
this.Controls.Add(this.select_login);
|
||||||
|
this.Controls.Add(this.textBox1);
|
||||||
|
this.Controls.Add(this.Logins);
|
||||||
|
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
||||||
|
this.MaximumSize = new System.Drawing.Size(337, 221);
|
||||||
|
this.MinimumSize = new System.Drawing.Size(337, 221);
|
||||||
|
this.Name = "Form2";
|
||||||
|
this.Text = "Saved Logins";
|
||||||
|
this.ResumeLayout(false);
|
||||||
|
this.PerformLayout();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private System.Windows.Forms.ListBox Logins;
|
||||||
|
private System.Windows.Forms.TextBox textBox1;
|
||||||
|
private System.Windows.Forms.Button select_login;
|
||||||
|
private System.Windows.Forms.Button remove_login;
|
||||||
|
}
|
||||||
|
}
|
||||||
97
OnePass/Form2.cs
Normal file
97
OnePass/Form2.cs
Normal file
@ -0,0 +1,97 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Data;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace OnePass
|
||||||
|
{
|
||||||
|
public partial class Form2 : Form
|
||||||
|
{//
|
||||||
|
public string site { get; set; }
|
||||||
|
public string login { get; set; }
|
||||||
|
public bool opt6 { get; set; }
|
||||||
|
public bool opt5 { get; set; }
|
||||||
|
public bool opt4 { get; set; }
|
||||||
|
public bool opt3 { get; set; }
|
||||||
|
public bool opt2 { get; set; }
|
||||||
|
public bool opt1 { get; set; }
|
||||||
|
public int length { get; set; }
|
||||||
|
public int cycle { get; set; }
|
||||||
|
public bool state { get; set; }
|
||||||
|
public string path { get; }
|
||||||
|
List<string> files = new List<string>();
|
||||||
|
public Form2()
|
||||||
|
{
|
||||||
|
path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "OnePassData\\");
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
public void init()
|
||||||
|
{
|
||||||
|
Logins.Items.Clear();
|
||||||
|
files.Clear();
|
||||||
|
string[] _files = Directory.GetFiles(path);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
for (int i = 0; i < _files.Length; i++)
|
||||||
|
{
|
||||||
|
files.Add(_files[i]);
|
||||||
|
BinaryReader reader = new BinaryReader(File.Open(_files[i], FileMode.Open));
|
||||||
|
site = new string(reader.ReadChars(reader.ReadByte()));
|
||||||
|
login = new string(reader.ReadChars(reader.ReadByte()));
|
||||||
|
Logins.Items.Add(site + ": " + login);
|
||||||
|
reader.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
MessageBox.Show(e.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void close(bool s=true)
|
||||||
|
{
|
||||||
|
state = s;
|
||||||
|
Visible = false;
|
||||||
|
}
|
||||||
|
private void select_login_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
BinaryReader reader = new BinaryReader(File.Open(files[Logins.SelectedIndex],FileMode.Open));
|
||||||
|
|
||||||
|
site = reader.ReadString();
|
||||||
|
login = reader.ReadString();
|
||||||
|
cycle = reader.ReadInt32();
|
||||||
|
length = reader.ReadInt32();
|
||||||
|
opt1 = reader.ReadBoolean();
|
||||||
|
opt2 = reader.ReadBoolean();
|
||||||
|
opt3 = reader.ReadBoolean();
|
||||||
|
opt4 = reader.ReadBoolean();
|
||||||
|
opt5 = reader.ReadBoolean();
|
||||||
|
opt6 = reader.ReadBoolean();
|
||||||
|
reader.Dispose();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message);
|
||||||
|
close(false);
|
||||||
|
}
|
||||||
|
close(true);
|
||||||
|
}
|
||||||
|
private void remove_login_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (Logins.SelectedIndex < 0) return;
|
||||||
|
DialogResult dialogResult = MessageBox.Show("Are you sure you want to remove: " + files[Logins.SelectedIndex], "Delete?", MessageBoxButtons.YesNo);
|
||||||
|
if (dialogResult == DialogResult.Yes)
|
||||||
|
{
|
||||||
|
File.Delete(files[Logins.SelectedIndex]);
|
||||||
|
init();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
1522
OnePass/Form2.resx
Normal file
1522
OnePass/Form2.resx
Normal file
File diff suppressed because it is too large
Load Diff
@ -55,11 +55,20 @@
|
|||||||
<Compile Include="Form1.Designer.cs">
|
<Compile Include="Form1.Designer.cs">
|
||||||
<DependentUpon>Form1.cs</DependentUpon>
|
<DependentUpon>Form1.cs</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="Form2.cs">
|
||||||
|
<SubType>Form</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="Form2.Designer.cs">
|
||||||
|
<DependentUpon>Form2.cs</DependentUpon>
|
||||||
|
</Compile>
|
||||||
<Compile Include="Program.cs" />
|
<Compile Include="Program.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
<EmbeddedResource Include="Form1.resx">
|
<EmbeddedResource Include="Form1.resx">
|
||||||
<DependentUpon>Form1.cs</DependentUpon>
|
<DependentUpon>Form1.cs</DependentUpon>
|
||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
|
<EmbeddedResource Include="Form2.resx">
|
||||||
|
<DependentUpon>Form2.cs</DependentUpon>
|
||||||
|
</EmbeddedResource>
|
||||||
<EmbeddedResource Include="Properties\Resources.resx">
|
<EmbeddedResource Include="Properties\Resources.resx">
|
||||||
<Generator>ResXFileCodeGenerator</Generator>
|
<Generator>ResXFileCodeGenerator</Generator>
|
||||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
@ -1 +1 @@
|
|||||||
a05b2efad1c492f69cfd9e73a7de2300da2b5b0d
|
ad2f261187cc44d5c3db8df71145224de824e6a7
|
||||||
|
|||||||
@ -11,10 +11,10 @@ C:\Users\rayam\source\repos\OnePass\OnePass\obj\Release\OnePass.pdb
|
|||||||
F:\VSCWorkspace\OnePass\OnePass\bin\Release\OnePass.exe.config
|
F:\VSCWorkspace\OnePass\OnePass\bin\Release\OnePass.exe.config
|
||||||
F:\VSCWorkspace\OnePass\OnePass\bin\Release\OnePass.exe
|
F:\VSCWorkspace\OnePass\OnePass\bin\Release\OnePass.exe
|
||||||
F:\VSCWorkspace\OnePass\OnePass\bin\Release\OnePass.pdb
|
F:\VSCWorkspace\OnePass\OnePass\bin\Release\OnePass.pdb
|
||||||
F:\VSCWorkspace\OnePass\OnePass\obj\Release\OnePass.csprojAssemblyReference.cache
|
|
||||||
F:\VSCWorkspace\OnePass\OnePass\obj\Release\OnePass.Form1.resources
|
F:\VSCWorkspace\OnePass\OnePass\obj\Release\OnePass.Form1.resources
|
||||||
F:\VSCWorkspace\OnePass\OnePass\obj\Release\OnePass.Properties.Resources.resources
|
F:\VSCWorkspace\OnePass\OnePass\obj\Release\OnePass.Properties.Resources.resources
|
||||||
F:\VSCWorkspace\OnePass\OnePass\obj\Release\OnePass.csproj.GenerateResource.cache
|
F:\VSCWorkspace\OnePass\OnePass\obj\Release\OnePass.csproj.GenerateResource.cache
|
||||||
F:\VSCWorkspace\OnePass\OnePass\obj\Release\OnePass.csproj.CoreCompileInputs.cache
|
F:\VSCWorkspace\OnePass\OnePass\obj\Release\OnePass.csproj.CoreCompileInputs.cache
|
||||||
F:\VSCWorkspace\OnePass\OnePass\obj\Release\OnePass.exe
|
F:\VSCWorkspace\OnePass\OnePass\obj\Release\OnePass.exe
|
||||||
F:\VSCWorkspace\OnePass\OnePass\obj\Release\OnePass.pdb
|
F:\VSCWorkspace\OnePass\OnePass\obj\Release\OnePass.pdb
|
||||||
|
F:\VSCWorkspace\OnePass\OnePass\obj\Release\OnePass.Form2.resources
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user