Пример #1
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();
            }
        }
Пример #2
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