Fixed gui issue
This commit is contained in:
parent
1e178d8644
commit
36b699b1d1
Binary file not shown.
@ -1,11 +1,54 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.IO;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
namespace OnePass
|
namespace OnePass
|
||||||
{
|
{
|
||||||
|
class ImageHolder
|
||||||
|
{
|
||||||
|
string site;
|
||||||
|
string login;
|
||||||
|
byte isize;
|
||||||
|
byte[] imagedata;
|
||||||
|
public ImageHolder(Bitmap img,string sitename,string login)
|
||||||
|
{
|
||||||
|
site = sitename;
|
||||||
|
this.login = login;
|
||||||
|
using (MemoryStream ms = new MemoryStream())
|
||||||
|
{
|
||||||
|
img.Save(ms, System.Drawing.Imaging.ImageFormat.Bmp);
|
||||||
|
imagedata = ms.ToArray();
|
||||||
|
isize = (byte)ms.Length;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public ImageHolder(string filename)
|
||||||
|
{
|
||||||
|
if (File.Exists(filename))
|
||||||
|
{
|
||||||
|
using (BinaryReader reader = new BinaryReader(File.Open(filename, FileMode.Open)))
|
||||||
|
{
|
||||||
|
site = reader.ReadString();
|
||||||
|
login = reader.ReadString();
|
||||||
|
isize = reader.ReadByte();
|
||||||
|
imagedata = reader.ReadBytes(isize);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public void tofile(string filename)
|
||||||
|
{
|
||||||
|
using (BinaryWriter bw = new BinaryWriter(File.Open(filename, FileMode.Open)))
|
||||||
|
{
|
||||||
|
bw.Write(site);
|
||||||
|
bw.Write(login);
|
||||||
|
bw.Write(isize);
|
||||||
|
bw.Write(imagedata);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
public partial class Form1 : Form
|
public partial class Form1 : Form
|
||||||
{
|
{
|
||||||
public Form1()
|
public Form1()
|
||||||
@ -115,6 +158,20 @@ 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 == "")
|
||||||
|
|||||||
Binary file not shown.
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