Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Diagnostics;
- using System.IO;
- using xNet;
- namespace AxentaUpdater
- {
- // Token: 0x02000002 RID: 2
- internal class Program
- {
- // Token: 0x06000001 RID: 1 RVA: 0x00002050 File Offset: 0x00000250
- private Program()
- {
- string text = "";
- Console.WriteLine("Checking for new version ...");
- try
- {
- using (HttpRequest httpRequest = new HttpRequest())
- {
- text = httpRequest.Get("https://www.axenta.co/latest", null).ToString();
- }
- }
- catch (Exception)
- {
- Console.WriteLine("Couldn't contact release server.");
- Console.Read();
- Environment.Exit(0);
- }
- Console.WriteLine("Getting actual version ...");
- FileVersionInfo fileVersionInfo = null;
- try
- {
- fileVersionInfo = FileVersionInfo.GetVersionInfo("Axenta.exe");
- }
- catch (Exception)
- {
- Console.WriteLine("Couldn't find axenta binaries, downloading them.");
- this.downloadUpdate(text);
- }
- string text2 = string.Format("{0}.{1}.{2}.{3}", new object[]
- {
- fileVersionInfo.FileMajorPart,
- fileVersionInfo.FileMinorPart,
- fileVersionInfo.FileBuildPart,
- fileVersionInfo.FilePrivatePart
- });
- Version v = new Version(text2);
- Version v2 = new Version(text);
- if (v < v2)
- {
- this.downloadUpdate(text);
- }
- else
- {
- Console.WriteLine("Version V" + text2 + " is up to date.");
- }
- Console.Read();
- }
- // Token: 0x06000002 RID: 2 RVA: 0x00002190 File Offset: 0x00000390
- private static void Main(string[] args)
- {
- new Program();
- }
- // Token: 0x06000003 RID: 3 RVA: 0x00002198 File Offset: 0x00000398
- private void downloadUpdate(string newVersion)
- {
- try
- {
- Console.WriteLine("Update found " + newVersion + ", downloading it.");
- using (HttpRequest httpRequest = new HttpRequest())
- {
- httpRequest.Proxy = null;
- httpRequest.Post("https://www.axenta.co/update").ToFile("Axenta.part");
- }
- Console.WriteLine("Update downloaded, renaming files.");
- File.Delete("Axenta.exe");
- File.Move("Axenta.part", "Axenta.exe");
- Console.WriteLine("Update complete ! You can now press enter to exit.");
- Console.Read();
- Environment.Exit(0);
- }
- catch (Exception)
- {
- Console.WriteLine("Couldn't download update.");
- Console.Read();
- Environment.Exit(0);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement