void XmlToTree(string xmlString)
        {
            gamesCollection.Unsplit();
            var oldCollection = new NesMenuCollection();

            oldCollection.AddRange(gamesCollection);
            var xml = new XmlDocument();

            xml.LoadXml(xmlString);
            gamesCollection.Clear();
            XmlToNode(xml, xml.SelectSingleNode("/Tree").ChildNodes, oldCollection, gamesCollection);
            // oldCollection has only unsorted (new) games
            if (oldCollection.Count > 0)
            {
                NesMenuFolder unsorted;
                var           unsorteds = from f in gamesCollection where f is NesMenuFolder && f.Name == Resources.FolderNameUnsorted select f;
                if (unsorteds.Count() > 0)
                {
                    unsorted = unsorteds.First() as NesMenuFolder;
                }
                else
                {
                    unsorted          = new NesMenuFolder(Resources.FolderNameUnsorted);
                    unsorted.Position = NesMenuFolder.Priority.Leftmost;
                    gamesCollection.Add(unsorted);
                }
                foreach (var game in oldCollection)
                {
                    unsorted.ChildMenuCollection.Add(game);
                }
                MessageBox.Show(this, Resources.NewGamesUnsorted, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            DrawTree();
        }
Exemple #2
0
        void XmlToTree(string xmlString)
        {
            GamesCollection.Unsplit();
            var oldCollection = new NesMenuCollection();

            oldCollection.AddRange(GamesCollection);
            var xml = new XmlDocument();

            xml.LoadXml(xmlString);
            GamesCollection.Clear();
            XmlToNode(xml, xml.SelectSingleNode("/Tree").ChildNodes, oldCollection, GamesCollection);
            // oldCollection has only unsorted (new) games
            if (oldCollection.Count > 0)
            {
                var unsorted = new NesMenuFolder(Resources.FolderNameUnsorted);
                unsorted.Position = NesMenuFolder.Priority.Leftmost;
                foreach (var game in oldCollection)
                {
                    unsorted.ChildMenuCollection.Add(game);
                }
                GamesCollection.Add(unsorted);
                MessageBox.Show(this, Resources.NewGamesUnsorted, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            DrawTree();
        }