|
///////////////////////////////////////////////////////////////////////
//
// Audio Manager for the PRISMIQ Media Player
// Written by Bruce Waeyen
// Copyright (c) 2004. All Rights Reserved.
//
// This code may be used in compiled form in any way you desire. This
// file may be redistributed unmodified by any means PROVIDING it is
// not sold for profit without the authors written consent, and
// providing that this notice and the authors name and all copyright
// notices remains intact.
//
//
// This file is provided "as is" with no expressed or implied warranty.
// The author accepts no liability for any damage/loss of business that
// this product may cause.
//
//
//////////////////////////////////////////////////////////////////////
using System;
using System.Collections;
using System.Xml;
using System.Windows.Forms;
using ApplicationSettings;
namespace PrismiqServer
{
/// <summary>
///
/// </summary>
public class PlaylistHashTable : Hashtable
{
private XmlNode xmlNode;
private PlayList album;
private int nHash;
public PlaylistHashTable()
{
XmlDocument myDoc = new XmlDocument();
AppSettings Setting = new AppSettings();
string Playlist = Setting.GetString("MediaServer", "PlaylistXml",
"C:\\Program Files\\PRISMIQ\\MediaManager\\gui\\Playlist.xml");
try
{
myDoc.Load(Playlist);
}
catch
{
string Message = "Can not open\n" + Playlist;
MessageBox.Show(Message);
return;
}
xmlNode = myDoc.FirstChild;
nHash = 0;
FillNodes(xmlNode);
}
public void FillNodes(XmlNode xNode)
{
if (xNode != null)
{
if (xNode.HasChildNodes)
{
xNode = xNode.FirstChild;
while (xNode != null)
{
string s = xNode.Name;
if(xNode.Name == "playlist")
{
if(album != null)
{
if(album != null)
{
if(album.SongCount > 0) Add(nHash++,album);
}
}
album = new PlayList();
}
if(xNode.Name == "name")
{
album.Title = xNode.ChildNodes[0].Value;
}
if(xNode.Name == "entry")
{
album.AddSong(Convert.ToUInt32(xNode.ChildNodes[0].Value));
}
FillNodes(xNode);
xNode = xNode.NextSibling;
}
}
}
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.