public bool PutLicense(
            string email, 
            string license, 
            string encrypted_license, 
            string encrypted_license_old,
            bool sendmail)
        {
            try
            {
                CryptoEditor.Common.CryptoEditorHttpPostHelper post =
                    new CryptoEditorHttpPostHelper(serviceAddress + "putlicense",
                                                   "application/x-www-form-urlencoded", profile);
                post.AddParameter("email", email);
                post.AddParameter("license", license);
                post.AddParameter("encrypted_license", encrypted_license);
                post.AddParameter("encrypted_license_old", (encrypted_license_old!=null)?encrypted_license_old:"");
                post.AddParameter("sendmail", (sendmail)?"yes":"no");

                string profileXml = post.Send();
                XmlDocument xml = new XmlDocument();
                xml.LoadXml(profileXml);

                XmlNodeList nodes = xml.GetElementsByTagName("error");
                if (nodes != null && nodes.Count > 0)
                {
                    // USER_DOES_NOT_EXIST
                    string error = nodes[0].InnerText;
                    if (error.Equals("USER_DOES_NOT_EXIST"))
                        MessageBox.Show("Invalid email or registration key", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                    else if (error.Equals("INVALID_PASSWORD"))
                        MessageBox.Show("This account already exist and the password does not match your current password.\n\rGo to 'Users/Change Password' to set the correct password.", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                    else
                        MessageBox.Show("Unknown error (PutLicense)", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Stop);

                    return false;
                }

                return true;
            }
            catch (WebException)
            {
                MessageBox.Show("An error occured while contacting the server", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (Exception)
            {
                MessageBox.Show("Server error!", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            return false;
        }
        public bool Save(string plugin, string data)
        {
            try
            {
                CryptoEditor.Common.CryptoEditorHttpPostHelper post =
                    new CryptoEditorHttpPostHelper(serviceAddress + "save",
                                                   "application/x-www-form-urlencoded", profile);
                post.AddParameter("email", profile.Email);
                post.AddParameter("license", profile.Key);
                post.AddParameter("plugin", plugin);
                post.AddParameter("data", data);

                string profileXml = post.Send();
                XmlDocument xml = new XmlDocument();
                xml.LoadXml(profileXml);

                XmlNodeList nodes = xml.GetElementsByTagName("error");
                if (nodes != null && nodes.Count > 0)
                {
                    // USER_DOES_NOT_EXIST
                    // USER_NOT_ACTIVATED
                    // USER_EXPIRED
                    string error = nodes[0].InnerText;
                    if (error.Equals("USER_DOES_NOT_EXIST"))
                    {
                        CryptoEditorGoToWebForm form = new CryptoEditorGoToWebForm("We are unable to locate your account. Visit our website to get your FREE registration key", "Account not activated");
                        form.ShowDialog();
                    }
                    if (error.Equals("USER_NOT_ACTIVATED"))
                    {
                        CryptoEditorGoToWebForm form = new CryptoEditorGoToWebForm("Your account is not activated. Visit our website to activate your account and get your FREE registration key", "Account not activated");
                        form.ShowDialog();
                    }
                    if (error.Equals("USER_EXPIRED"))
                    {
                        CryptoEditorGoToWebForm form = new CryptoEditorGoToWebForm("Your registration has expired. Visit our website to add more time to your subscription", "Account expired");
                        form.ShowDialog();
                    }
                    else
                        MessageBox.Show("Unknown error (PutLicense)", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Stop);

                    return false;
                }

                return true;
            }
            catch (WebException)
            {
                MessageBox.Show("An error occured while contacting the server", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (Exception)
            {
                MessageBox.Show("Server error!", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            return false;
        }
        public bool GetProfile(ref int status, ref DateTime expiration, ref string encrypted_license)
        {
            try
            {
                CryptoEditorHttpPostHelper post =
                    new CryptoEditorHttpPostHelper(serviceAddress+"getprofile",
                                                   "application/x-www-form-urlencoded", profile);
                post.AddParameter("email", profile.Email);
                string profileXml = post.Send();
                XmlDocument xml = new XmlDocument();
                xml.LoadXml(profileXml);

                XmlNodeList nodes = xml.GetElementsByTagName("error");
                if (nodes != null && nodes.Count > 0)
                {
                    // USER_DOES_NOT_EXIST
                    string error = nodes[0].InnerText;
                    if (error.Equals("USER_DOES_NOT_EXIST"))
                    {
                        CryptoEditorGoToWebForm form = new CryptoEditorGoToWebForm("We are unable to locate your account. Visit our website to get your FREE registration key", "Account not activated");
                        form.ShowDialog();
                    }
                    else
                        MessageBox.Show("Unknown error (GetProfile)", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Stop);

                    return false;
                }

                nodes = xml.GetElementsByTagName("status");
                status = (nodes[0].InnerText != null && nodes[0].InnerText.Length>0)?Convert.ToInt32(nodes[0].InnerText):0;

                nodes = xml.GetElementsByTagName("expiration");
                expiration = (nodes[0].InnerText != null && nodes[0].InnerText.Length>0)?DateTime.Parse(nodes[0].InnerText):new DateTime(1970,1,1);

                nodes = xml.GetElementsByTagName("encrypted_license");
                encrypted_license = (nodes[0].InnerText != null && nodes[0].InnerText.Length>0)?nodes[0].InnerText:"";

                return true;
            }
            catch(WebException)
            {
                MessageBox.Show("An error occured while contacting the server", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch(Exception)
            {
                MessageBox.Show("Server error!", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            return false;
        }