public void BackupToTheWeb()
        {
            BackupService client = new BackupService();

            foreach (ICryptoEditor plugin in plugins)
            {
                if (plugin is CryptoEditorHome.CryptoEditorHome)
                    continue;

                CryptoXML xmlRoot = Encrypt(plugin);
                CryptoEditorServiceCodes ret = client.Save(CurrentProfile.Email, CurrentProfile.Key, plugin.GetType().ToString(), xmlRoot.OuterXml);

            }
        }
        public void Synchronize(string serverPassword)
        {
            if(CurrentProfile.Email.Length == 0 || CurrentProfile.Name.Length == 0)
            {
                MessageBox.Show(
                    "You must provide both a profile name and an email address in order to use web synchronization",
                    "Incomplete profile!", MessageBoxButtons.OK, MessageBoxIcon.Stop);

                return;
            }

            BackupService client = new BackupService();

            if (!CurrentProfile.PasswordValidated)
                return;

            foreach (ICryptoEditor plugin in plugins)
            {
                try
                {
                    if(plugin is CryptoEditorHome.CryptoEditorHome)
                        continue;

                    // Load the XML of that plugin from the web
                    string webData = client.Load(CurrentProfile.Email, CurrentProfile.Key, plugin.GetType().ToString());
                    if (webData == null || webData.Length == 0)
                    {
                        // The document does not exist on the server.
                        // This will happen only at the first synchro.
                        CryptoXML xmlEncrypted = Encrypt(plugin);
                        client.Save(CurrentProfile.Email, CurrentProfile.Key, plugin.GetType().ToString(), xmlEncrypted.OuterXml);
                        continue;
                    }

                    CryptoXML xmlWeb = new CryptoXML();
                    xmlWeb.LoadXml(webData);

                    string localData = plugin.Save();
                    CryptoXML xmlLocal = new CryptoXML();
                    if(localData != null)
                        xmlLocal.LoadXml(localData);

                    xmlWeb.Password = serverPassword;

            #if !NO_ENCRYPT
                    xmlWeb.Decrypt(plugin.EncryptionXPath, true);
            #endif
                    // At this point I have the two XML documents I want to synchronize
                    // It is important to work on the XML document at this level because
                    // we dont have access to the definition of the Item involved. The
                    // plugin is not forced to inherit its item from the framework's
                    // CryptoEditorPluginItem.

                    // Step 1
                    // Update the nodes that are found in both documents with the most
                    // recent version.
                    UpdateItems(xmlLocal, xmlWeb);

                    // Step 2
                    UpdateFolders(xmlLocal, xmlWeb);

                    // Step 3
                    // Fins all items and folders that are not present in both documents
                    UpdateMissingNodes(xmlLocal.DocumentElement, xmlWeb.DocumentElement);

                    // Delete all inactive nodes
                    DeleteInactiveNodes(xmlLocal.DocumentElement);

                    // Load the resulting XML into the plugin
                    plugin.Load(xmlLocal.OuterXml);

                    // Publish the resulting xml on the web ...
                    xmlWeb.Password = CurrentProfile.Password;
                    xmlWeb.Encrypt(plugin.EncryptionXPath, true);
                    client.Save(CurrentProfile.Email, CurrentProfile.Key, plugin.GetType().ToString(), xmlWeb.OuterXml);
                }
                finally
                {
                }
            }
        }
        // Should restore the data from the web and then re-initiate plugins
        public void RestoreFromTheWeb()
        {
            BackupService client = new BackupService();

            if (!CurrentProfile.PasswordValidated)
                return;

            foreach (ICryptoEditor plugin in plugins)
            {
                string data = client.Load(CurrentProfile.Email, CurrentProfile.Key, plugin.GetType().ToString());
                if(data == null)
                {
                    plugin.Load(data);
                    continue;
                }

                CryptoXML xmlRoot = new CryptoXML();
                xmlRoot.LoadXml(data);

                if (xmlRoot.DocumentElement.Name.Equals("CryptoEditorDefault"))
                {
                    // This is text only data or a not well formed XML document
                    xmlRoot.Decrypt("/*", true);
                    plugin.Load(xmlRoot.DocumentElement.InnerText);
                    continue;
                }

                xmlRoot.Password = CurrentProfile.Password;
            #if !NO_ENCRYPT
                xmlRoot.Decrypt(plugin.EncryptionXPath, true);
            #endif

                plugin.Load(xmlRoot.OuterXml);
            }
        }