Guest User

Untitled

a guest
Jun 27th, 2013
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.92 KB | None | 0 0
  1. private void Form1_Load(object sender, EventArgs e)
  2. {
  3. updateClient();
  4. }
  5.  
  6. private void updateClient()
  7. {
  8. WebClient wc = new WebClient();
  9. try
  10. {
  11. //The UI contains v1.1, so this should go to the else.
  12. if (UI.Contains("v1.2"))
  13. {
  14. //Only if you need verification. Disabled most of the time.
  15. //MessageBox.Show("VHROC is running on the latest version.", "Up to Date", MessageBoxButtons.OK, MessageBoxIcon.Information);
  16. }
  17.  
  18. //Great, this pops up. at the same time the messagebox pops up, the catch appears.
  19. else
  20. {
  21.  
  22. if(Properties.Settings.Default.active == true)
  23. {
  24. if (MessageBox.Show("An update is available, would you like to update to version " + UI + "?", "New Version Available!", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
  25. {
  26.  
  27. System.Diagnostics.Process.Start(wc.DownloadString("http://files.enjin.com/98518/update.txt"));
  28.  
  29. }
  30. }
  31. }
  32.  
  33. }
  34. //Wait a minute, if something in the try doesn't work the catch appears and the inside of the try doesn't occur.
  35. //Why did the inside of the catch occur then. This used to work until recently, but I haven't changed this file.
  36. catch
  37. {
  38. 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);
  39. }
  40.  
  41. }
Advertisement
Add Comment
Please, Sign In to add comment