/Platters/classes/autoupdater.cs

http://skimpt.googlecode.com/ · C# · 25 lines · 18 code · 6 blank · 1 comment · 0 complexity · 615bf4be9e293e22230cfa7b6c0aae8e MD5 · raw file

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. using System.Net;
  5. class autoupdater
  6. {
  7. public static int GetLatestVersion()
  8. {
  9. //let us screenscrape the Google Site.
  10. WebClient wc = new WebClient ();
  11. byte [] pageData = wc.DownloadData ("http://code.google.com/p/skimpt");
  12. string pageHtml = System.Text.Encoding.ASCII.GetString(pageData);
  13. string ver;
  14. ver = pageHtml.Substring (pageHtml.IndexOf ("!!ver:"));
  15. ver = ver.Substring (6);
  16. ver = ver.Remove(ver.IndexOf("!!"));
  17. return Convert.ToInt32(ver);
  18. }
  19. }