Example #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            XmlDocument doc = new XmlDocument();

            doc.Load(AppDomain.CurrentDomain.BaseDirectory + @"\Config.xml");
            XmlNode child = doc.SelectSingleNode("/Configurations");

            foreach (System.Xml.XmlNode n in child)
            {
                if (n.Attributes["id"].Value == "GC")
                {
                    for (int i = 0; i < n.ChildNodes.Count; i++)
                    {
                        switch (n.ChildNodes[i].Name)
                        {
                        case "key":
                            n.ChildNodes[i].InnerText = textBox1.Text;
                            break;
                        }
                    }
                }
            }
            doc.Save(AppDomain.CurrentDomain.BaseDirectory + @"\Config.xml");
            CLIENT_APP_PARAM.key = textBox1.Text;
            License.License l = new License.License();
            if (l.verifier_license(CLIENT_APP_PARAM.key, Environment.MachineName.ToUpper()))
            {
                ok = true;
                CLIENT_APP_PARAM.Fenetre_principale.licensefied = true;
                MessageBox.Show("Clé valid!, licence enregstrée");
                Close();
            }
            else
            {
                MessageBox.Show("Clé invalide!, licence inacceptée");
                ok = false;
            }
        }