<commit_before>﻿using System.IO;
using System.Net;
using System.Windows;
using System;

namespace PlanningMaker.Modele
{
    class MiseAJour
    {
        
        public void VerifierMAJ()
        {
            string message_MAJ, chaineVappli, chaineVnet;
            chaineVappli = GetVersionApplication();
            chaineVnet = GetDerniereVersion();
            if (chaineVnet.Substring(0, 6).CompareTo("Erreur") == 0)
            {
                message_MAJ = chaineVnet;
            }
            else
            {
                if (chaineVappli.CompareTo(chaineVnet) < 0)
                {
                    message_MAJ = "MAJ nécessaire" + " : votre version = " + chaineVappli
                        + " / dernière version = " + chaineVnet;
                }
                else message_MAJ = "NO MAJ" + " : votre version = " + chaineVappli
                        + " / dernière version = " + chaineVnet;
            }

            MessageBox.Show(message_MAJ);
        }

        private string GetVersionApplication()
        {
            return MainWindow.getNumeroVersion();
        }

        private string GetDerniereVersion()
        {
            string resultat;

            try
            {
                HttpWebRequest webReq = (HttpWebRequest)WebRequest.Create("http://code.google.com/p/emdt/wiki/Version");
                
                // test proxy à ajouter

                HttpWebResponse webResp = (HttpWebResponse)webReq.GetResponse();
                Stream oS = webResp.GetResponseStream();
                StreamReader oSReader = new StreamReader(oS, System.Text.Encoding.ASCII);
                resultat = oSReader.ReadToEnd();

                string chaineAvant = "La version courante du logiciel est : <ul><li>";
                string chaineApres = "</li></ul>";
                int longueurChaineVersion = resultat.LastIndexOf(chaineApres) -<commit_msg>Un simple espace en trop dans la chaîne texte, pas facile à voir. Bug des versions égales corrigé.<commit_after>﻿using System.IO;
using System.Net;
using System.Windows;
using System;

namespace PlanningMaker.Modele
{
    class MiseAJour
    {
        
        public void VerifierMAJ()
        {
            string message_MAJ, chaineVappli, chaineVnet;
            chaineVappli = GetVersionApplication();
            chaineVnet = GetDerniereVersion();

            if (chaineVnet.Substring(0, 6).CompareTo("Erreur") == 0)
            {
                message_MAJ = chaineVnet;
            }
            else
            {
                if (chaineVappli.CompareTo(chaineVnet) < 0)
                {
                    message_MAJ = "MAJ nécessaire" + " : votre version = " + chaineVappli
                        + " / dernière version = " + chaineVnet;
                }
                else message_MAJ = "NO MAJ" + " : votre version = " + chaineVappli
                        + " / dernière version = " + chaineVnet;
            }

            MessageBox.Show(message_MAJ);
        }

        private string GetVersionApplication()
        {
            return MainWindow.getNumeroVersion();
        }

        private string GetDerniereVersion()
        {
            string resultat;

            try
            {
                HttpWebRequest webReq = (HttpWebRequest)WebRequest.Create("http://code.google.com/p/emdt/wiki/Version");
                
                // test proxy à ajouter

                HttpWebResponse webResp = (HttpWebResponse)webReq.GetResponse();
                Stream oS = webResp.GetResponseStream();
                StreamReader oSReader = new StreamReader(oS, System.Text.Encoding.ASCII);
                resultat = oSReader.ReadToEnd();

                string chaineAvant = "La version courante du logiciel est : <ul><li>";
                string chaineApres = " </li></ul>";
                int longueurChaineVersion = resultat.LastIndexOf(chaineApres) -
{'fraction_non_alphanumeric': 0.08974686780874457, 'fraction_numerical': 0.002045512656609563, 'mean_word_length': 1.5669291338582678, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7465543', 'n_tokens_mistral': 1126, 'n_tokens_neox': 1041, 'n_words': 215}