private void btnSub_Click(object sender, EventArgs e)
 {
     if (ckKey(txtSet1.Text, txtSet2.Text) && txtName.Text != "")
     {
         //key manipulation
         string stuff   = "Key: " + txtSet1.Text + "-" + txtSet2.Text + "\nName: " + txtName.Text;
         string encrypt = encry("qwertyuioplmnbvcxzasdfghjk", stuff);
         FiCre  temp    = new FiCre();
         temp.write2Lic(encrypt);
         this.Close();
     }
     else
     {
         lblOutput.Text = "Error: Either name is empty or key is invalid.";
     }
 }//End button
Пример #2
0
        public Form1()
        {
            InitializeComponent();
            this.Text = "Recipe Program V0.5";
            FiCre asdf = new FiCre();

            asdf.DtaFldCre();
            asdf.chIfTableExists();

            KeyValidation temp = new KeyValidation();

            try
            {
                string mm = asdf.ReadLic();
                if (mm != "")
                {
                    string path         = @"Data\licence.rec";
                    string readFromFile = "";
                    using (StreamReader sr = File.OpenText(path))
                    {
                        string s = "";
                        while ((s = sr.ReadLine()) != null)
                        {
                            //Console.WriteLine(s);
                            readFromFile += s;
                        }
                    }//end using
                    string tester = temp.decry("qwertyuioplmnbvcxzasdfghjk", readFromFile);
                    if (tester.Contains("Error"))
                    {
                        temp.ShowDialog();
                    }
                    //else { MessageBox.Show(tester); }//debug
                }//end if
                else
                {
                    temp.ShowDialog();
                }
            }//End try
            catch
            {
                temp.ShowDialog();
            }
        }
Пример #3
0
        private void btnShowKey_Click(object sender, EventArgs e)
        {
            FiCre         asdf = new FiCre();
            KeyValidation temp = new KeyValidation();

            try
            {
                string mm = asdf.ReadLic();
                if (mm != "")
                {
                    string path         = @"Data\licence.rec";
                    string readFromFile = "";
                    using (StreamReader sr = File.OpenText(path))
                    {
                        string s = "";
                        while ((s = sr.ReadLine()) != null)
                        {
                            //Console.WriteLine(s);
                            readFromFile += s;
                        }
                    }//end using
                    string tester = temp.decry("qwertyuioplmnbvcxzasdfghjk", readFromFile);
                    if (tester.Contains("Error"))
                    {
                        temp.ShowDialog();
                    }
                    else
                    {
                        MessageBox.Show(tester);
                    }                                //debug
                }//end if
                else
                {
                    temp.ShowDialog();
                }
            }//End try
            catch
            {
                temp.ShowDialog();
            }
        } //End button