Пример #1
0
        /// <summary>
        /// Retourne la liste des Algorithmes des méthodes des mappers présents dans le fichier
        /// </summary>
        /// <param name="doc"></param>
        /// <param name="nsmgr"></param>
        /// <returns></returns>
        public static List <AlgorithmeMapper> AlgorithmesMethodesMappers(XmlDocument doc, XmlNamespaceManager nsmgr, int i, int cmp)
        {
            XmlNodeList   nodeList2;
            XmlElement    root = doc.DocumentElement;
            List <string> ListeAlgorithmesMethodesMappers = new List <string>();


            string xpath = @"// w:p [ w:pPr / w:pStyle [@w:val='Heading1']][6] /following:: w:p [ w:pPr / w:pStyle [@w:val='Heading2']][2] /following:: w:p [ w:pPr / w:pStyle [@w:val='Heading3']][" + i + "] /following:: w:p [ w:pPr / w:pStyle [@w:val='Heading4']][2] /following:: w:p [ w:pPr / w:pStyle [@w:val='Heading5']][" + (cmp + 1) + "] /following:: w:p [ w:pPr / w:pStyle [@w:val='Heading6']][4]/ following-sibling:: w:tbl / w:tr /w:tc  [count(. | // w:p [ w:pPr / w:pStyle [@w:val='Heading1']][6] /following:: w:p [ w:pPr / w:pStyle [@w:val='Heading2']][2] /following:: w:p [ w:pPr / w:pStyle [@w:val='Heading3']][" + i + "] /following:: w:p [ w:pPr / w:pStyle [@w:val='Heading4']][2] /following:: w:p [ w:pPr / w:pStyle [@w:val='Heading5']][" + (cmp + 2) + "]  / preceding-sibling::w:tbl / w:tr /w:tc)= count(// w:p [ w:pPr / w:pStyle [@w:val='Heading1']][6] /following:: w:p [ w:pPr / w:pStyle [@w:val='Heading2']][2] /following:: w:p [ w:pPr / w:pStyle [@w:val='Heading3']][" + i + "] /following:: w:p [ w:pPr / w:pStyle [@w:val='Heading4']][2] /following:: w:p [ w:pPr / w:pStyle [@w:val='Heading5']][" + (cmp + 2) + "]  / preceding-sibling::w:tbl / w:tr /w:tc)]";


            if (i == Mapper.NomsMappers(doc, nsmgr).Count&& cmp == MethodeMapper.NombreMethodesMappers(doc, nsmgr, i) - 1)
            {
                xpath = @"// w:p [ w:pPr / w:pStyle [@w:val='Heading1']][6] /following:: w:p [ w:pPr / w:pStyle [@w:val='Heading2']][2] /following:: w:p [ w:pPr / w:pStyle [@w:val='Heading3']][" + i + "] /following:: w:p [ w:pPr / w:pStyle [@w:val='Heading4']][2] /following:: w:p [ w:pPr / w:pStyle [@w:val='Heading5']][" + (cmp + 1) + "] /following:: w:p [ w:pPr / w:pStyle [@w:val='Heading6']][4]/ following-sibling:: w:tbl / w:tr /w:tc  [count(. | // w:p [ w:pPr / w:pStyle [@w:val='Heading1']][6] /following:: w:p [ w:pPr / w:pStyle [@w:val='Heading2']][2] /following:: w:p [ w:pPr / w:pStyle [@w:val='Heading3']][" + (i + 1) + "]  / preceding-sibling::w:tbl / w:tr /w:tc)= count(// w:p [ w:pPr / w:pStyle [@w:val='Heading1']][6] /following:: w:p [ w:pPr / w:pStyle [@w:val='Heading2']][2] /following:: w:p [ w:pPr / w:pStyle [@w:val='Heading3']][" + (i + 1) + "]  / preceding-sibling::w:tbl / w:tr /w:tc)]";
            }

            if (i < Mapper.NomsMappers(doc, nsmgr).Count&& cmp == MethodeMapper.NombreMethodesMappers(doc, nsmgr, i) - 1)
            {
                xpath = @"// w:p [ w:pPr / w:pStyle [@w:val='Heading1']][6] /following:: w:p [ w:pPr / w:pStyle [@w:val='Heading2']][2] /following:: w:p [ w:pPr / w:pStyle [@w:val='Heading3']][" + i + "] /following:: w:p [ w:pPr / w:pStyle [@w:val='Heading4']][2] /following:: w:p [ w:pPr / w:pStyle [@w:val='Heading5']][" + (cmp + 1) + "] /following:: w:p [ w:pPr / w:pStyle [@w:val='Heading6']][4]/ following-sibling:: w:tbl / w:tr /w:tc  [count(. | // w:p [ w:pPr / w:pStyle [@w:val='Heading1']][7]  / preceding-sibling::w:tbl / w:tr /w:tc)= count(// w:p [ w:pPr / w:pStyle [@w:val='Heading1']][7] / preceding-sibling::w:tbl / w:tr /w:tc)]";
            }

            nodeList2 = root.SelectNodes(xpath, nsmgr);

            foreach (XmlNode isbn2 in nodeList2)
            {
                ListeAlgorithmesMethodesMappers.Add(isbn2.InnerText.Trim());
            }

            if (ListeAlgorithmesMethodesMappers.Count < 6)
            {
                return(null);
            }


            return(ListeAAlgorithmes(ListeAlgorithmesMethodesMappers));
        }
        /// <summary>
        /// retourne la liste des parametres des methodes des mappers
        /// </summary>
        /// <param name="doc"></param>
        /// <param name="nsmgr"></param>
        /// <returns></returns>
        public static ParametreEntrantMapper ParametresMethodesMappers(XmlDocument doc, XmlNamespaceManager nsmgr, int i, int cmp)
        {
            XmlNodeList   nodeList2;
            XmlElement    root = doc.DocumentElement;
            List <string> ListeParametresMethodesMappers = new List <string>();


            if (MethodeMapper.NombreMethodesMappers(doc, nsmgr, i) != 0)
            {
                string xpath = @"// w:p [ w:pPr / w:pStyle [@w:val='Heading1']][6] /following:: w:p [ w:pPr / w:pStyle [@w:val='Heading2']][2] /following:: w:p [ w:pPr / w:pStyle [@w:val='Heading3']][" + i + "] /following:: w:p [ w:pPr / w:pStyle [@w:val='Heading4']][2] /following:: w:p [ w:pPr / w:pStyle [@w:val='Heading5']][" + (cmp + 1) + "] /following:: w:p [ w:pPr / w:pStyle [@w:val='Heading6']][2]/ following-sibling:: w:tbl / w:tr /w:tc  [count(. | // w:p [ w:pPr / w:pStyle [@w:val='Heading1']][6] /following:: w:p [ w:pPr / w:pStyle [@w:val='Heading2']][2] /following:: w:p [ w:pPr / w:pStyle [@w:val='Heading3']][" + i + "] /following:: w:p [ w:pPr / w:pStyle [@w:val='Heading4']][2] /following:: w:p [ w:pPr / w:pStyle [@w:val='Heading5']][" + (cmp + 1) + "] /following:: w:p [ w:pPr / w:pStyle [@w:val='Heading6']][3] / preceding-sibling::w:tbl / w:tr /w:tc)= count(// w:p [ w:pPr / w:pStyle [@w:val='Heading1']][6] /following:: w:p [ w:pPr / w:pStyle [@w:val='Heading2']][2] /following:: w:p [ w:pPr / w:pStyle [@w:val='Heading3']][" + i + "] /following:: w:p [ w:pPr / w:pStyle [@w:val='Heading4']][2] /following:: w:p [ w:pPr / w:pStyle [@w:val='Heading5']][" + (cmp + 1) + "] /following:: w:p [ w:pPr / w:pStyle [@w:val='Heading6']][3] / preceding-sibling::w:tbl / w:tr /w:tc)]";


                nodeList2 = root.SelectNodes(xpath, nsmgr);

                foreach (XmlNode isbn2 in nodeList2)
                {
                    ListeParametresMethodesMappers.Add(isbn2.InnerText.Trim());
                }
            }
            if (ListeParametresMethodesMappers.Count < 6)
            {
                return(null);
            }

            return(new ParametreEntrantMapper(ListeParametresMethodesMappers[3], ListeParametresMethodesMappers[4], ListeParametresMethodesMappers[5]));
        }
Пример #3
0
        /// <summary>
        /// Retourne la liste des mappers du fichier
        /// </summary>
        /// <param name="doc"></param>
        /// <param name="nsmgr"></param>
        /// <returns></returns>
        public static List <Mapper> Mappers(XmlDocument doc, XmlNamespaceManager nsmgr)
        {
            List <Mapper> services = new List <Mapper>();
            List <string> noms     = NomsMappers(doc, nsmgr);


            for (int i = 1; i < NomsMappers(doc, nsmgr).Count + 1; i++)
            {
                List <MethodeMapper> methodes = MethodeMapper.MethodesMappers(doc, nsmgr, i);

                string descriptions = DescriptionsMapper(doc, nsmgr, i);


                if (MethodeMapper.NombreMethodesMappers(doc, nsmgr, i) != 0)
                {
                    services.Add(new Mapper(noms[i - 1], descriptions, methodes));
                }

                if (MethodeMapper.NombreMethodesMappers(doc, nsmgr, i) == 0)
                {
                    services.Add(new Mapper(noms[i - 1], descriptions));
                }
            }
            return(services);
        }