Guest User

Untitled

a guest
Jun 26th, 2013
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.63 KB | None | 0 0
  1.  
  2. private void Form1_Load(object sender, EventArgs e)
  3. {
  4. updateClient();
  5. }
  6.  
  7.  
  8. private void updateClient()
  9. {
  10. WebClient wc = new WebClient();
  11. try
  12. {
  13. string UI = wc.DownloadString("http://files.enjin.com/98518/version.txt");
  14.  
  15. if (UI.Contains("deactivate"))
  16. {
  17.  
  18. Properties.Settings.Default.active = false;
  19. }
  20. else
  21. {
  22. if (Properties.Settings.Default.active == false)
  23. {
  24. MessageBox.Show("Reactivating VHROC");
  25. //loginToolStripMenuItem.Visible = true;
  26. }
  27. }
  28.  
  29. if (Properties.Settings.Default.active == false)
  30. {
  31. MessageBox.Show("Deactivating VHROC");
  32. //loginToolStripMenuItem.Visible = false;
  33. Properties.Settings.Default.autoUserEnable = false;
  34. Properties.Settings.Default.CurrentUser = null;
  35. System.Diagnostics.Process.Start("http://vhr.enjin.com/vhroc");
  36. }
  37.  
  38. if (UI.Contains("v1.2"))
  39. {
  40. //Only if you need verification. Disabled most of the time.
  41. //MessageBox.Show("VHROC is running on the latest version.", "Up to Date", MessageBoxButtons.OK, MessageBoxIcon.Information);
  42. }
  43.  
  44. else
  45. {
  46.  
  47. if(Properties.Settings.Default.active == true)
  48. {
  49. if (MessageBox.Show("An update is available, would you like to update to version " + UI + "?", "New Version Available!", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
  50. {
  51.  
  52. System.Diagnostics.Process.Start(wc.DownloadString("http://files.enjin.com/98518/update.txt"));
  53.  
  54. }
  55. }
  56. }
  57.  
  58. }
  59.  
  60. catch
  61. {
  62. MessageBox.Show("For some reason the program cannot connect to VHR, this may be due to a couple of things:\n\n - Server Maintenance in which case you should try checking for updates in a couple of hours\n\n - You may not be connected to the internet.", "Update Check Failed", MessageBoxButtons.OK, MessageBoxIcon.Error);
  63. }
  64.  
  65. }
Advertisement
Add Comment
Please, Sign In to add comment