Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Net;
- public static int update = 0;
- public void OnUpdate()
- {
- if (update == 0)
- {
- if (UpdateChecker())
- update++;
- else
- update--;
- }
- }
- public override Version Version
- {
- get { return new Version(1, 1, 1); }
- }
- public bool UpdateChecker()
- {
- string raw;
- try
- {
- raw = new WebClient().DownloadString("https://github.com/Spectrewiz/Ticket-System/raw/master/README.txt");
- }
- catch (Exception e)
- {
- Log.Error(e.Message);
- return false;
- }
- string[] readme = raw.Split('\n');
- string[] download = readme[2].Split('-');
- Version version;
- if (!Version.TryParse(readme[0], out version)) return false;
- if (Version.CompareTo(version) >= 0) return false;
- Console.ForegroundColor = ConsoleColor.Yellow;
- Console.WriteLine("New Ticket System version: " + readme[0].Trim());
- Console.WriteLine("Download here: " + download[1].Trim());
- Console.ResetColor();
- Log.Info(string.Format("NEW VERSION: {0} | Download here: {1}", readme[0].Trim(), download[1].Trim()));
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement