BigLitho/Large.Lito.Database/Make3_Treko3D/Fingerprint/Irideprint.cs

66 lines
1.9 KiB
C#

using System;
using System.IO;
using System.Windows.Forms;
using ClassLibrary.Security;
namespace GetKey
{
public partial class Irideprint : Form
{
public Irideprint()
{
InitializeComponent();
}
private void btnGenFingerprint_Click(object sender, EventArgs e)
{
txtCPU.Text = FingerPrint.CPU;
txtBios.Text = FingerPrint.BIOS;
txtBase.Text = FingerPrint.Base;
txtFingerPrint.Text = FingerPrint.Default();
}
private void btnSave_Click(object sender, EventArgs e)
{
using (var sfd = new SaveFileDialog())
{
sfd.FileName = "Irideprint";
sfd.DefaultExt = "txt";
DialogResult result = sfd.ShowDialog();
if (result == DialogResult.OK && !string.IsNullOrWhiteSpace(sfd.FileName))
{
string fileName = sfd.FileName;
File.WriteAllText(fileName, txtFingerPrint.Text);
}
}
}
private void btnLoad_Click(object sender, EventArgs e)
{
using (var ofd = new OpenFileDialog())
{
DialogResult result = ofd.ShowDialog();
if (result == DialogResult.OK && !string.IsNullOrWhiteSpace(ofd.FileName))
{
string fileName = ofd.FileName;
string fingerPrint = File.ReadAllText(fileName);
txtFingerPrint.Text = fingerPrint;
}
}
}
private void btnTest_Click(object sender, EventArgs e)
{
bool equal = FingerPrint.Default().Equals(txtFingerPrint.Text);
if (equal)
{
MessageBox.Show("Irideprint is correct!");
} else
{
MessageBox.Show("Irideprint is wrong!");
}
}
}
}