Exemplo n.º 1
0
        public void Add(NodeContainer aParent, ItemDesc aDesc, ref UInt32 aNextId)
        {
            string containerKey  = iFactory.ContainerKey(aDesc.LibItem);
            string containerName = iFactory.ContainerName(aDesc.LibItem);

            if (string.IsNullOrEmpty(containerKey))
            {
                containerKey  = "Unknown";
                containerName = "Unknown";
            }

            NodeContainer container = aParent.Container(containerKey);

            if (container == null)
            {
                container = iFactory.Create(containerName, aDesc.LibItem, aNextId);
                aNextId++;
                aParent.Add(containerKey, container);
            }

            iChild.Add(container, aDesc, ref aNextId);
        }
Exemplo n.º 2
0
        public void Add(NodeContainer aParent, LibraryPlaylist aPlaylist, ref UInt32 aNextId)
        {
            // create the container for the playlist
            NodePlaylist playlist = new NodePlaylist(aPlaylist.Name, aNextId, null);

            aNextId++;

            // given that the ID (from the aNextId variable) is unique, it is easy to construct
            // a unique key for the playlist - having <playlistname><playlistid> ensures
            // uniqueness and alphabetical sorting
            aParent.Add(playlist.Name + playlist.Id.ToString(), playlist);

            // add all tracks
            foreach (long libItemId in aPlaylist.Items)
            {
                if (iItemDict.ContainsKey(libItemId))
                {
                    ItemDesc desc = iItemDict[libItemId];
                    NodeItem item = new NodeItem(aNextId, desc.Id, desc.LibItem);
                    aNextId++;
                    playlist.Add(item);
                }
            }
        }
Exemplo n.º 3
0
        public void Add(NodeContainer aParent, ItemDesc aDesc, ref UInt32 aNextId)
        {
            NodeItem item = iFactory.Create(aDesc, ref aNextId);

            aParent.Add(item);
        }