Advertisement
ColinStroble

Untitled

Sep 6th, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.38 KB | None | 0 0
  1. ////////Paste this in anywhere in ur code//////
  2.  
  3. public static String GetHtmlStringWC(string url)
  4. {
  5. string htmlString = string.Empty;
  6.  
  7. try
  8. {
  9. using (WebClient webClient = new WebClient())
  10. {
  11. try
  12. {
  13. webClient.Headers["User-Agent"] = "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.15) Gecko/20110303 Firefox/3.6.15";
  14. WebProxy myProxy = new WebProxy();
  15. myProxy.IsBypassed(new Uri(url));
  16. webClient.Proxy = myProxy;
  17. htmlString = webClient.DownloadString(url);
  18. }
  19. catch (Exception ex)
  20. {
  21. throw;
  22. }
  23. finally
  24. {
  25. webClient.Dispose();
  26. }
  27. }
  28. }
  29. catch (WebException wex)
  30. {
  31. throw;
  32. }
  33. catch (Exception ex)
  34. {
  35. throw;
  36. }
  37. finally { }
  38.  
  39. return htmlString.Replace("\r", string.Empty).Replace("\n", string.Empty).Replace("\t", string.Empty);
  40. }
  41.  
  42.  
  43.  
  44.  
  45. //////Then paste this in the form load event (change the pastebin link to ur link)////////
  46.  
  47.  
  48. int version = 1;
  49. string contents = GetHtmlStringWC("https://pastebin.com/raw/9ExFnXLf");
  50.  
  51. Console.WriteLine(contents);
  52. {
  53.  
  54.  
  55. if (version.ToString() != contents)
  56. {
  57.  
  58. DialogResult result = MessageBox.Show("There is an update found, would you like to update?", "Updates", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
  59. if (result == DialogResult.Yes)
  60. {
  61. Process.Start("https://github.com/nuncahacks/Youtube-Downloader/raw/master/Yotube%20Downloader.exe");
  62. }
  63. if (result == DialogResult.No)
  64. {
  65. Application.Exit();
  66. }
  67.  
  68.  
  69. else
  70. {
  71.  
  72. MessageBox.Show("No updates found", "Updates", MessageBoxButtons.OK);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement