Example #1
0
        public static bool LitXml(string path, string Username, string Password)
        {
            xdoc.Load(path); //emplacement de l'objet

            var username = xdoc.SelectSingleNode("//root/User" + Username);

            if (Password == Cryptage.UnprotectPassword(username.InnerText))
            {
                return(true);
            }

            return(false);
        }
Example #2
0
        public static void CreateUser(string path, string matricule, string mdp)
        {
            if (File.Exists(Android.OS.Environment.ExternalStorageDirectory + Java.IO.File.Separator + "PharmatrackXML" + Java.IO.File.Separator + "Config.xml"))
            {
                xdoc.Load(path);
                XmlNode rootNode = xdoc.SelectSingleNode("//root");

                XmlNode userNode = xdoc.CreateElement("User" + matricule);
                userNode.InnerText = Cryptage.ProtectPassword(mdp);
                rootNode.AppendChild(userNode);

                xdoc.Save(path);
            }
        }
Example #3
0
        public static void CreateXml(string path)
        {
            XmlNode docNode = xdoc.CreateXmlDeclaration("1.0", "UTF-8", null);

            xdoc.AppendChild(docNode);

            XmlNode rootNode = xdoc.CreateElement("root");

            xdoc.AppendChild(rootNode);

            XmlNode userNode = xdoc.CreateElement("Useradmin");

            userNode.InnerText = Cryptage.ProtectPassword("admin");
            rootNode.AppendChild(userNode);

            xdoc.Save(path);
        }
Example #4
0
        public static void EcritXml(string path, string Username, string Password)
        {
            xdoc.Load(path);     //emplacement de l'objet

            var username = xdoc.SelectSingleNode("//root/User" + Username);

            if (Cryptage.ProtectPassword(Password) == username.InnerText)
            {
                return;
            }

            username.InnerText = Cryptage.ProtectPassword(Password);

            //MessageBox.Show("Vous avez changé les paramètres de connexion");
            //sauvegarde
            xdoc.Save(path);
        }