All pastes #401825 Raw Edit

Miscellany

public text v1 · immutable
·published 2007-03-19 15:09 UTC
rendered paste body
using System;
using System.Net;
using System.Xml;
using System.Globalization;
using System.Threading;

namespace ConsoleApplication9
{
	/// <summary>
	/// Summary description for Class1.
	/// </summary>
	class Class1
	{
		/// <summary>
		/// The main entry point for the application.
		/// </summary>
		[STAThread]
		static void Main(string[] args)
		{
			XmlTextReader reader = new XmlTextReader("test.ruckusdownload");
			WebClient Client = new WebClient();
			CultureInfo cultureInfo   = Thread.CurrentThread.CurrentCulture;
			TextInfo textInfo = cultureInfo.TextInfo;

			reader.ReadStartElement();

			string titleOfDownload="",artistOfDownload="",downloadURL="";

			while(reader.Read())
			{
				if (reader.NodeType == XmlNodeType.Element && reader.Name=="track")
				{
					reader.Read();
					if (reader.NodeType == XmlNodeType.Element && reader.Name=="title")
					{
						titleOfDownload=textInfo.ToTitleCase(textInfo.ToLower(reader.ReadElementString("title")));
					}
					if (reader.NodeType == XmlNodeType.Element && reader.Name=="artist")
					{
						artistOfDownload=reader.ReadElementString("artist");
					}

					for(int x=0; x<9; x++)
						reader.Read();

					if (reader.NodeType == XmlNodeType.Element && reader.Name=="downloadURL")
					{
						downloadURL=reader.ReadElementString("downloadURL");
					}
					Console.WriteLine("Currently Downloading: "+artistOfDownload+"-"+titleOfDownload+".wma");
					Client.DownloadFile("http://www.ruckus.com"+downloadURL, artistOfDownload+"-"+titleOfDownload+".wma");
				}
			}
			reader.Close();
		}
	}
}