/* * Author: Tim Van Wassenhove * Update: 2004-04-06 15:26 * * This program queries the Scarlet.BE service and output your used volume. * The user string you can obtain by logging into http://mijn.scarlet.be, * and requesting to view the volume stats. user should be the value of logincrypt field. * */ using System; using System.Xml; class MainClass { private static string user = "69cbcafb3820fe01"; private static string url = "http://secure.scarlet.be:8080/servlet/volumemeter?username=" + user; public static void Main(string[] args) { Console.WriteLine("volume: "+GetVolume(url)); } private static int GetVolume(string url) { XmlTextReader reader = new XmlTextReader(url); string element = null; while (reader.Read()) { switch (reader.NodeType) { case XmlNodeType.Element: element = reader.Name; break; case XmlNodeType.Text: if (element.Equals("usedvolume")) { int waarde = int.Parse(reader.Value) / 1024; return waarde; } break; } } return -1; } }