diff --git a/GCMM/GCMM.csproj b/GCMM/GCMM.csproj
index 9f0e30d..983c24e 100644
--- a/GCMM/GCMM.csproj
+++ b/GCMM/GCMM.csproj
@@ -2,7 +2,7 @@
WinExe
- net461
+ net472
true
false
favicon.ico
@@ -11,6 +11,7 @@
ExMods
A mod manager for Techblox. It automatically downloads and runs GCIPA and allows the user to install mods.
true
+ 8
@@ -32,6 +33,9 @@
+
+ ..\..\ref\TechbloxPreview_Data\Managed\UnityEngine.CoreModule.dll
+
diff --git a/GCMM/MainForm.cs b/GCMM/MainForm.cs
index 86a42e0..fd71e08 100644
--- a/GCMM/MainForm.cs
+++ b/GCMM/MainForm.cs
@@ -77,13 +77,6 @@ You may also want to verify the game's files in the launcher.
status.Text = resources.GetString("Status_Game_not_found");
return;
}
- if (Configuration.AutoPatch == AutoPatchingState.Unspecified)
- {
- Configuration.AutoPatch = AutoPatchingState.Disabled;
- if (DialogUtils.ShowYesNoQuestion(resources.GetString("Change_launch_settings_question"),
- resources.GetString("Change_launch_settings_title")))
- EnableDisableAutoPatchingWithDialog(true);
- }
DeleteEmptyPluginsDir(out bool pexists, out bool dexists);
if (!pexists && dexists)
unpatched.Checked = true; //It will call the event but that won't do anything
@@ -262,7 +255,7 @@ You may also want to verify the game's files in the launcher.
private async Task RefreshEverything(bool evenMods)
{
CheckIfPatched(); //Set from placeholder
- lastGameUpdateTime = await GetLastGameUpdateTime();
+ lastGameUpdateTime = GetGameVersionAsDate();
var mods = GetInstalledMods();
if (evenMods)
await GetAvailableMods();
diff --git a/GCMM/MainUtils.cs b/GCMM/MainUtils.cs
index ea7ddf9..33cb895 100644
--- a/GCMM/MainUtils.cs
+++ b/GCMM/MainUtils.cs
@@ -1,5 +1,4 @@
using System;
-using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.IO;
@@ -7,6 +6,8 @@ using System.Linq;
using System.Net;
using System.Threading.Tasks;
using System.Windows.Forms;
+using Microsoft.Win32;
+using Application = UnityEngine.Application;
namespace GCMM
{
@@ -28,50 +29,19 @@ namespace GCMM
}
}
- private bool EnableDisableAutoPatching(bool enable)
- {
- foreach (string file in Directory.EnumerateFiles(GamePath("")))
- File.Copy(file, Path.GetFileName(file), true);
- var toSymLink = new List {GamePath("\\MonoBleedingEdge")};
- Directory.CreateDirectory("TechbloxPreview_Data");
- toSymLink.AddRange(Directory.EnumerateDirectories(GamePath("\\TechbloxPreview_Data"))
- .Except(new[] {"Managed"}));
- foreach (string file in Directory.EnumerateFiles(GamePath("\\TechbloxPreview_Data")))
- File.Copy(file, "TechbloxPreview_Data\\" + Path.GetFileName(file), true);
- Directory.CreateDirectory("TechbloxPreview_Data\\Managed");
- foreach (string file in Directory.EnumerateFiles(GamePath("\\TechbloxPreview_Data\\Managed")))
- File.Copy(file, "TechbloxPreview_Data\\Managed\\" + Path.GetFileName(file), true);
- return toSymLink.Select(targetName => (sourceName: targetName.Replace(GamePath("\\"), ""), targetName))
- .Where(tuple => !Directory.Exists(tuple.sourceName))
- .All(tuple => SymLinks.CreateFolderSymbolicLink(tuple.sourceName, tuple.targetName));
- }
-
- public void EnableDisableAutoPatchingWithDialog(bool enable)
- {
- try
- {
- if (EnableDisableAutoPatching(enable))
- {
- DialogUtils.ShowInfo(resources.GetString("Change_launch_settings_done"),
- resources.GetString("Change_launch_settings_title"));
- Configuration.AutoPatch = enable ? AutoPatchingState.Enabled : AutoPatchingState.Disabled;
- }
- else
- DialogUtils.ShowError(resources.GetString("Change_launch_settings_error"),
- resources.GetString("Change_launch_settings_title"));
- }
- catch (Exception e)
- {
- DialogUtils.ShowError(resources.GetString("Change_launch_settings_error") + "\n\n" + e,
- resources.GetString("Change_launch_settings_title"));
- }
- }
-
public string GetGameFolder()
{
- string launcherConfig =
- Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData),
- "Techblox Launcher", "launcher_settings.ini");
+ using var key =
+ Registry.LocalMachine.OpenSubKey(
+ @"SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\Techblox Launcher") ??
+ Registry.LocalMachine.OpenSubKey(
+ @"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Techblox Launcher");
+ string launcherPath = key?.GetValue("DisplayIcon") is string launcherExecutable
+ ? Directory.GetParent(launcherExecutable)?.FullName
+ : null;
+ launcherPath ??= Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData),
+ "Techblox Launcher");
+ string launcherConfig = Path.Combine(launcherPath, "launcher_settings.ini");
if (!File.Exists(launcherConfig)) return null;
string path = File.ReadLines(launcherConfig)
.FirstOrDefault(line => line.StartsWith("133062..GAME_PATH="))
@@ -111,11 +81,11 @@ namespace GCMM
await CheckModUpdatesAsync();
Process.Start(command);
}
- if (Environment.OSVersion.Platform == PlatformID.Win32NT)
- Process.Start(new ProcessStartInfo(GamePath("\\" + GetExe()))
- {
- WorkingDirectory = GamePath("\\") //Mods are only loaded if the working directory is correct
- });
+ else if (Environment.OSVersion.Platform == PlatformID.Win32NT)
+ Process.Start(new ProcessStartInfo(GamePath("\\" + GetExe()))
+ {
+ WorkingDirectory = GamePath("\\") //Mods are only loaded if the working directory is correct
+ });
EndWork(false);
tcs.SetResult(null);
};
@@ -224,19 +194,9 @@ namespace GCMM
return false;
}
- public async Task GetLastGameUpdateTime()
+ public DateTime GetGameVersionAsDate()
{
- /*using (var client = GetClient())
- {
- string html = await client.DownloadStringTaskAsync("https://api.steamcmd.net/v1/info/1078000");
- var regex = new Regex("timeupdated:[^<]*([^<]*)");
- var match = regex.Match(html);
- if (!match.Success)
- return default;
- return new DateTime(1970, 1, 1).AddSeconds(long.Parse(match.Groups[1].Value));
- }*/
- //return new DateTime(2020, 12, 28);
- return default;
+ return Convert.ToDateTime(Application.version);
}
}
}
diff --git a/GCMM/SettingsForm.cs b/GCMM/SettingsForm.cs
index a044e62..ee72e6d 100644
--- a/GCMM/SettingsForm.cs
+++ b/GCMM/SettingsForm.cs
@@ -28,8 +28,6 @@ namespace GCMM
private void savebtn_Click(object sender, EventArgs e)
{
mainForm.Configuration.GamePath = gamelocation.Text;
- if (autopatching.Checked != autopatchingEnabled)
- mainForm.EnableDisableAutoPatchingWithDialog(autopatching.Checked);
mainForm.Configuration.Save();
Close();
}
diff --git a/GCMM/SymLinks.cs b/GCMM/SymLinks.cs
deleted file mode 100644
index 38a0dff..0000000
--- a/GCMM/SymLinks.cs
+++ /dev/null
@@ -1,14 +0,0 @@
-using System.Diagnostics;
-
-namespace GCMM
-{
- public class SymLinks
- {
- public static bool CreateFolderSymbolicLink(string source, string target)
- {
- var proc = Process.Start(new ProcessStartInfo("cmd.exe", $"/c mklink /J \"{source}\" \"{target}\""));
- proc?.WaitForExit();
- return proc?.ExitCode == 0;
- }
- }
-}
\ No newline at end of file