Example #1
0
        static void Main()
        {
            Process[] proc = Process.GetProcessesByName(Application.ProductName);
            if (proc.Length > 1)
            {
                MessageBox.Show("应用程序已经打开...");
                Thread.Sleep(1000);
                Environment.Exit(1);
            }
            else
            {
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);

                fmain = new frmmain();
                vi    = new verifyInstall();
                string ds = Apphelper.GetCPUSerialNumber();
                if (Apphelper.IsRegistryKeyExist() && Apphelper.IsRegistryValueNameExist("name") && Apphelper.IsRegistryValueNameExist("passwd") && Apphelper.IsRegistryValueNameExist("hash"))
                {
                    string name      = Apphelper.getNameValue();
                    string passwd    = Apphelper.getPassValue();
                    string hashSaved = Apphelper.getHashValue();
                    string n_p       = ds + name + passwd;// "serversalessongSzamxkjsfp780208";
                    string hash      = Apphelper.GetSha1Hash(n_p);
                    if (!hashSaved.Equals(hash))
                    {
                        fmain.frmlit.dt = new DateTime(2008, 8, 21);

                        vi.StartPosition = FormStartPosition.CenterParent;
                        vi.ShowDialog();
                    }
                }
                else
                {
                    fmain.frmlit.dt = new DateTime(2008, 8, 21);
                    vi = new verifyInstall();
                    vi.StartPosition = FormStartPosition.CenterParent;
                    vi.ShowDialog();
                }



                skey = new softkeyyt();
                if (!getkey())
                {
                    Application.Exit(); return;
                }
                ;
                Application.Run(fmain);
            }
        }
Example #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            string na = name.Text;
            string pa = password.Text;

            if (Apphelper.verifyInstall(na, pa))
            {
                this.Dispose();
                this.Close();
            }
            else
            {
                this.Dispose();
                this.Close();
                //Application.Exit();
                System.Diagnostics.Process.GetCurrentProcess().Kill();
            }
        }
Example #3
0
 private void button3_Click(object sender, EventArgs e)
 {
     Apphelper.deleteValue();
     //Environment.Exit(0);
     System.Diagnostics.Process.GetCurrentProcess().Kill();
 }