public static TypeRetourInterfaceRegistre TypeRetourMethodesInterfacesRegistres(XmlDocument doc, XmlNamespaceManager nsmgr, int i, int cmp) { XmlNodeList nodeList2; XmlElement root = doc.DocumentElement; List <string> ListeTypeRetourInterfacesRegistres = new List <string>(); if (MethodeInterfaceRegistre.NombreMethodesInterfacesRegistres(doc, nsmgr, i) != 0) { string xpath = @"// w:p [ w:pPr / w:pStyle [@w:val='Heading1']][4] /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]/ following-sibling::w:tbl / w:tr /w:tc [count(. | // w:p [ w:pPr / w:pStyle [@w:val='Heading1']][4] /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]/preceding-sibling:: w:tbl / w:tr /w:tc )= count(// w:p [ w:pPr / w:pStyle [@w:val='Heading1']][4] /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]/preceding-sibling:: w:tbl / w:tr /w:tc)]"; nodeList2 = root.SelectNodes(xpath, nsmgr); foreach (XmlNode isbn2 in nodeList2) { ListeTypeRetourInterfacesRegistres.Add(isbn2.InnerText); } } if (ListeTypeRetourInterfacesRegistres.Count < 4) { return(null); } return(new TypeRetourInterfaceRegistre(ListeTypeRetourInterfacesRegistres[2], ListeTypeRetourInterfacesRegistres[3])); }
/// <summary> /// Retourne la liste des interfaces de registre du fichier /// </summary> /// <param name="doc"></param> /// <param name="nsmgr"></param> /// <returns></returns> public static List <InterfaceRegistre> InterfacesRegistre(XmlDocument doc, XmlNamespaceManager nsmgr) { List <InterfaceRegistre> interfacesRegistre = new List <InterfaceRegistre>(); List <string> noms = NomsInterfacesRegistres(doc, nsmgr); for (int i = 0; i < NomsInterfacesRegistres(doc, nsmgr).Count; i++) { List <MethodeInterfaceRegistre> methodes = MethodeInterfaceRegistre.MethodesRegistres(doc, nsmgr, i); string descriptions = DescriptionsInterfacesRegistres(doc, nsmgr, i); if (MethodeInterfaceRegistre.NombreMethodesInterfacesRegistres(doc, nsmgr, i - 1) != 0) { interfacesRegistre.Add(new InterfaceRegistre(noms[i - 1], descriptions, methodes)); } if (MethodeInterfaceRegistre.NombreMethodesInterfacesRegistres(doc, nsmgr, i - 1) == 0) { interfacesRegistre.Add(new InterfaceRegistre(noms[i - 1], descriptions)); } } return(interfacesRegistre); }