diff --git a/AlcatrazLauncher/AlcatrazLauncher.csproj b/AlcatrazLauncher/AlcatrazLauncher.csproj
index 90cbb853..f2ca0517 100644
--- a/AlcatrazLauncher/AlcatrazLauncher.csproj
+++ b/AlcatrazLauncher/AlcatrazLauncher.csproj
@@ -96,6 +96,7 @@
SignInToAlcatrazDialog.cs
+
Form
diff --git a/AlcatrazLauncher/Constants.cs b/AlcatrazLauncher/Constants.cs
index e7be2aa7..8396c9fe 100644
--- a/AlcatrazLauncher/Constants.cs
+++ b/AlcatrazLauncher/Constants.cs
@@ -47,5 +47,7 @@ public class Constants
public static string ConfigFilename =>"Alcatraz.json";
public static string NoProfile => "None";
public static string OfficialProfileKey => "UbiOfficial";
-}
+ public static string OrbitLoaderFilename => "ubiorbitapi_r2_loader.dll";
+ public static string OrbitLoaderSHA1 => "8F7CC25567F8996C0A5D082024E751EAD9430FF2"; // original checksum
+ }
}
diff --git a/AlcatrazLauncher/Helpers/FileChecksumHelper.cs b/AlcatrazLauncher/Helpers/FileChecksumHelper.cs
new file mode 100644
index 00000000..459c1449
--- /dev/null
+++ b/AlcatrazLauncher/Helpers/FileChecksumHelper.cs
@@ -0,0 +1,28 @@
+using System.IO;
+using System.Security.Cryptography;
+using System.Text;
+
+namespace AlcatrazLauncher.Helpers
+{
+ public static class FileChecksumHelper
+ {
+ public static string GetFileSHA1(string FileName)
+ {
+ using (FileStream fs = new FileStream(FileName, FileMode.Open))
+ using (BufferedStream bs = new BufferedStream(fs))
+ {
+ using (SHA1Managed sha1 = new SHA1Managed())
+ {
+ byte[] hash = sha1.ComputeHash(bs);
+ StringBuilder formatted = new StringBuilder(2 * hash.Length);
+ foreach (byte b in hash)
+ {
+ formatted.AppendFormat("{0:X2}", b);
+ }
+
+ return formatted.ToString();
+ }
+ }
+ }
+ }
+}
diff --git a/AlcatrazLauncher/Program.cs b/AlcatrazLauncher/Program.cs
index ed457995..2a61fd8a 100644
--- a/AlcatrazLauncher/Program.cs
+++ b/AlcatrazLauncher/Program.cs
@@ -1,4 +1,5 @@
-using Microsoft.Win32;
+using AlcatrazLauncher.Helpers;
+using Microsoft.Win32;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;
using System;
@@ -83,9 +84,30 @@ static void Main()
}
}
- if(GameInstallPath.Length > 0)
+ if (GameInstallPath.Length > 0)
+ {
+ var AlcatrazLoaderFullPath = Path.GetFullPath(Constants.OrbitLoaderFilename);
+ var OrbitLoaderFullPath = Path.Combine(GameInstallPath, Constants.OrbitLoaderFilename);
+ var OrbitLoaderBackupPath = Path.Combine(GameInstallPath, Constants.OrbitLoaderFilename + ".bak");
+
+ var orbitSha1 = File.Exists(OrbitLoaderFullPath) ? FileChecksumHelper.GetFileSHA1(OrbitLoaderFullPath) : "";
+
Directory.SetCurrentDirectory(GameInstallPath);
+ // check orbit loader
+ if(FileChecksumHelper.GetFileSHA1(AlcatrazLoaderFullPath) != orbitSha1)
+ {
+ if (File.Exists(OrbitLoaderFullPath) && orbitSha1 == Constants.OrbitLoaderSHA1)
+ {
+ File.Move(OrbitLoaderFullPath, OrbitLoaderBackupPath);
+ MessageBox.Show($"Backup created:\n\n{OrbitLoaderBackupPath}", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
+ }
+
+ // copy new loader file to game folder
+ File.Copy(AlcatrazLoaderFullPath, OrbitLoaderFullPath);
+ }
+ }
+
JsonConvert.DefaultSettings = () => new JsonSerializerSettings
{
Formatting = Formatting.Indented,