Advertisement
DolphinX

AutoUpdater C# Source!

Dec 15th, 2019
400
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.14 KB | None | 0 0
  1. // hello skid i remade this so its a bit more light weight it might break more but idk and cba to test oof
  2.             try
  3.             {
  4.                 using (WebClient web = new WebClient()) // make new webclient
  5.                 {
  6.                    string weebs=  web.DownloadString("link to pastebin version here"); // find the current version
  7.                     if (weebs == "1.0.0.0")
  8.                     {
  9.                         Console.WriteLine($"Current Version Found! : {weebs} : Latests Version!"); // inform client that they are up to date
  10.                     }
  11.                     else // if the number in the pastebin changes
  12.                     {
  13.                         Console.WriteLine("Attempting to get update!");  
  14.                         web.DownloadFile("link to download", "file name"); // attempt to download  
  15.                          //hopefully exception below will catch for this ^^
  16.                     }
  17.                 }
  18.             }
  19.             catch (Exception ex) //returns exceptions so the programme wont break
  20.             {
  21.                 Console.WriteLine($"error(s) found: {ex.Message}");
  22.             }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement