Esempio n. 1
0
        //<installed-books version="3">
        //  <locale-membership>
        //     <locale name="EN-US">   <---- nodeLocale
        //        <book-list>
        //           <book ref="urn:852e209f-1bdd-1349-13ba-eed3c6d86c9f" vendorname="Microsoft" displayname=".NET Framework 4" source="http://b25ddepxvm17.redmond.corp.microsoft.com:202/catalogs/visualstudio11/en-us" kind="Microsoft" productname="" productgroupname="" path="\Visual Studio\Visual Studio 2011\Visual Studio 2011 Ultimate" />
        //           ..
        //        </book-list>
        //        <book-membership>
        //           <book ref="urn:852e209f-1bdd-1349-13ba-eed3c6d86c9f">
        //              <package ref="VISUAL_STUDIO_21800791_VS_100_EN-US_2" />
        //              ..
        //           </book>
        //           ..
        //        </book-membership>
        //     </locale>
        //     ...
        //  </locale-membership>
        //</installed-books>
        private void GetBookList(LocaleListItem localeItem, XmlNode nodeLocale)
        {
            // Get Book List

            XmlNode nodeBookList = nodeLocale.SelectSingleNode("//book-list");  // <locale name="EN-US"><book-list>
            if (nodeBookList == null || !nodeBookList.HasChildNodes)
                return;

            foreach (XmlNode n in nodeBookList.ChildNodes)
            {
                if (n.Name == "book" && n.Attributes["ref"] != null)    // <book ref="urn:852e209f-1bdd-1349-13ba-eed3c6d86c9f" ...
                {
                    BookListItem bookListItem = new BookListItem(n.Attributes["ref"].InnerXml);
                    if (n.Attributes["vendorname"] != null)
                        bookListItem.vendorname = n.Attributes["vendorname"].InnerXml;
                    if (n.Attributes["displayname"] != null)
                        bookListItem.displayname = n.Attributes["displayname"].InnerXml;
                    if (n.Attributes["source"] != null)
                        bookListItem.source = n.Attributes["source"].InnerXml;
                    if (n.Attributes["kind"] != null)
                        bookListItem.kind = n.Attributes["kind"].InnerXml;
                    if (n.Attributes["productname"] != null)
                        bookListItem.productname = n.Attributes["productname"].InnerXml;
                    if (n.Attributes["productgroupname"] != null)
                        bookListItem.productgroupname = n.Attributes["productgroupname"].InnerXml;
                    if (n.Attributes["path"] != null)
                        bookListItem.path = n.Attributes["path"].InnerXml;

                    localeItem.bookList.Add(bookListItem);
                }
            }

            // Get Book Packages

            XmlNode nodeBookMembership = nodeLocale.SelectSingleNode("//book-membership");   // <locale name="EN-US"><book-membership>
            if (nodeBookMembership == null || !nodeBookMembership.HasChildNodes)
                return;

            foreach (XmlNode nodeBook in nodeBookMembership.ChildNodes)
            {
                if (nodeBook.Name == "book" && nodeBook.Attributes["ref"] != null)  // <book ref="urn:852e209f-1bdd-1349-13ba-eed3c6d86c9f">
                {
                    String BookRef = nodeBook.Attributes["ref"].InnerXml;

                    //Build a package list
                    String[] packageList = new String[nodeBook.ChildNodes.Count];
                    int x = 0;
                    foreach (XmlNode nodePackage in nodeBook.ChildNodes)
                    {
                        packageList[x] = nodePackage.Attributes["ref"].InnerXml;    //  <book ..><package ref="VISUAL_STUDIO_21800791_VS_100_EN-US_2" />...
                        x++;
                    }

                    // Insert this list into the appropriate BookListItem that we created above
                    // First find the linkNode using the ref member

                    for (int i = 0; i < localeItem.bookList.Count; i++)
                    {
                        if (localeItem.bookList[i].ref_ == BookRef)
                        {
                            localeItem.bookList[i].packageList = packageList;
                            break;
                        }
                    }
                }
            }
        }
Esempio n. 2
0
        //<installed-books version="3">
        //  <locale-membership>
        //     <locale name="EN-US">   <---- nodeLocale
        //        <book-list>
        //           <book ref="urn:852e209f-1bdd-1349-13ba-eed3c6d86c9f" vendorname="Microsoft" displayname=".NET Framework 4" source="http://b25ddepxvm17.redmond.corp.microsoft.com:202/catalogs/visualstudio11/en-us" kind="Microsoft" productname="" productgroupname="" path="\Visual Studio\Visual Studio 2011\Visual Studio 2011 Ultimate" />
        //           ..
        //        </book-list>
        //        <book-membership>
        //           <book ref="urn:852e209f-1bdd-1349-13ba-eed3c6d86c9f">
        //              <package ref="VISUAL_STUDIO_21800791_VS_100_EN-US_2" />
        //              ..
        //           </book>
        //           ..
        //        </book-membership>
        //     </locale>
        //     ...
        //  </locale-membership>
        //</installed-books>

        private void GetBookList(LocaleListItem localeItem, XmlNode nodeLocale)
        {
            // Get Book List

            XmlNode nodeBookList = nodeLocale.SelectSingleNode("//book-list");  // <locale name="EN-US"><book-list>

            if (nodeBookList == null || !nodeBookList.HasChildNodes)
            {
                return;
            }

            foreach (XmlNode n in nodeBookList.ChildNodes)
            {
                if (n.Name == "book" && n.Attributes["ref"] != null)    // <book ref="urn:852e209f-1bdd-1349-13ba-eed3c6d86c9f" ...
                {
                    BookListItem bookListItem = new BookListItem(n.Attributes["ref"].InnerXml);
                    if (n.Attributes["vendorname"] != null)
                    {
                        bookListItem.vendorname = n.Attributes["vendorname"].InnerXml;
                    }
                    if (n.Attributes["displayname"] != null)
                    {
                        bookListItem.displayname = n.Attributes["displayname"].InnerXml;
                    }
                    if (n.Attributes["source"] != null)
                    {
                        bookListItem.source = n.Attributes["source"].InnerXml;
                    }
                    if (n.Attributes["kind"] != null)
                    {
                        bookListItem.kind = n.Attributes["kind"].InnerXml;
                    }
                    if (n.Attributes["productname"] != null)
                    {
                        bookListItem.productname = n.Attributes["productname"].InnerXml;
                    }
                    if (n.Attributes["productgroupname"] != null)
                    {
                        bookListItem.productgroupname = n.Attributes["productgroupname"].InnerXml;
                    }
                    if (n.Attributes["path"] != null)
                    {
                        bookListItem.path = n.Attributes["path"].InnerXml;
                    }

                    localeItem.bookList.Add(bookListItem);
                }
            }

            // Get Book Packages

            XmlNode nodeBookMembership = nodeLocale.SelectSingleNode("//book-membership");   // <locale name="EN-US"><book-membership>

            if (nodeBookMembership == null || !nodeBookMembership.HasChildNodes)
            {
                return;
            }

            foreach (XmlNode nodeBook in nodeBookMembership.ChildNodes)
            {
                if (nodeBook.Name == "book" && nodeBook.Attributes["ref"] != null)  // <book ref="urn:852e209f-1bdd-1349-13ba-eed3c6d86c9f">
                {
                    String BookRef = nodeBook.Attributes["ref"].InnerXml;

                    //Build a package list
                    String[] packageList = new String[nodeBook.ChildNodes.Count];
                    int      x           = 0;
                    foreach (XmlNode nodePackage in nodeBook.ChildNodes)
                    {
                        packageList[x] = nodePackage.Attributes["ref"].InnerXml;    //  <book ..><package ref="VISUAL_STUDIO_21800791_VS_100_EN-US_2" />...
                        x++;
                    }

                    // Insert this list into the appropriate BookListItem that we created above
                    // First find the linkNode using the ref member

                    for (int i = 0; i < localeItem.bookList.Count; i++)
                    {
                        if (localeItem.bookList[i].ref_ == BookRef)
                        {
                            localeItem.bookList[i].packageList = packageList;
                            break;
                        }
                    }
                }
            }
        }