Advertisement
Terr0rism

Axenta Updater Source

Feb 22nd, 2020
595
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.35 KB | None | 0 0
  1. using System;
  2. using System.Diagnostics;
  3. using System.IO;
  4. using xNet;
  5.  
  6. namespace AxentaUpdater
  7. {
  8.     // Token: 0x02000002 RID: 2
  9.     internal class Program
  10.     {
  11.         // Token: 0x06000001 RID: 1 RVA: 0x00002050 File Offset: 0x00000250
  12.         private Program()
  13.         {
  14.             string text = "";
  15.             Console.WriteLine("Checking for new version ...");
  16.             try
  17.             {
  18.                 using (HttpRequest httpRequest = new HttpRequest())
  19.                 {
  20.                     text = httpRequest.Get("https://www.axenta.co/latest", null).ToString();
  21.                 }
  22.             }
  23.             catch (Exception)
  24.             {
  25.                 Console.WriteLine("Couldn't contact release server.");
  26.                 Console.Read();
  27.                 Environment.Exit(0);
  28.             }
  29.             Console.WriteLine("Getting actual version ...");
  30.             FileVersionInfo fileVersionInfo = null;
  31.             try
  32.             {
  33.                 fileVersionInfo = FileVersionInfo.GetVersionInfo("Axenta.exe");
  34.             }
  35.             catch (Exception)
  36.             {
  37.                 Console.WriteLine("Couldn't find axenta binaries, downloading them.");
  38.                 this.downloadUpdate(text);
  39.             }
  40.             string text2 = string.Format("{0}.{1}.{2}.{3}", new object[]
  41.             {
  42.                 fileVersionInfo.FileMajorPart,
  43.                 fileVersionInfo.FileMinorPart,
  44.                 fileVersionInfo.FileBuildPart,
  45.                 fileVersionInfo.FilePrivatePart
  46.             });
  47.             Version v = new Version(text2);
  48.             Version v2 = new Version(text);
  49.             if (v < v2)
  50.             {
  51.                 this.downloadUpdate(text);
  52.             }
  53.             else
  54.             {
  55.                 Console.WriteLine("Version V" + text2 + " is up to date.");
  56.             }
  57.             Console.Read();
  58.         }
  59.  
  60.         // Token: 0x06000002 RID: 2 RVA: 0x00002190 File Offset: 0x00000390
  61.         private static void Main(string[] args)
  62.         {
  63.             new Program();
  64.         }
  65.  
  66.         // Token: 0x06000003 RID: 3 RVA: 0x00002198 File Offset: 0x00000398
  67.         private void downloadUpdate(string newVersion)
  68.         {
  69.             try
  70.             {
  71.                 Console.WriteLine("Update found " + newVersion + ", downloading it.");
  72.                 using (HttpRequest httpRequest = new HttpRequest())
  73.                 {
  74.                     httpRequest.Proxy = null;
  75.                     httpRequest.Post("https://www.axenta.co/update").ToFile("Axenta.part");
  76.                 }
  77.                 Console.WriteLine("Update downloaded, renaming files.");
  78.                 File.Delete("Axenta.exe");
  79.                 File.Move("Axenta.part", "Axenta.exe");
  80.                 Console.WriteLine("Update complete ! You can now press enter to exit.");
  81.                 Console.Read();
  82.                 Environment.Exit(0);
  83.             }
  84.             catch (Exception)
  85.             {
  86.                 Console.WriteLine("Couldn't download update.");
  87.                 Console.Read();
  88.                 Environment.Exit(0);
  89.             }
  90.         }
  91.     }
  92. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement