Skip to content

Commit

Permalink
Revert Assembly.GetExecutingAssembly workaround
Browse files Browse the repository at this point in the history
  • Loading branch information
Meivyn committed Jan 6, 2024
1 parent d07c5d4 commit 5ed3539
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 11 deletions.
6 changes: 2 additions & 4 deletions IPA.Injector/Injector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ internal static class Injector
private static Task? permissionFixTask;
//private static string otherNewtonsoftJson = null;

public static Assembly ExecutingAssembly => typeof(Injector).Assembly;

// ReSharper disable once UnusedParameter.Global
internal static void Main(string[] args)
{ // entry point for doorstop
Expand Down Expand Up @@ -143,8 +141,8 @@ private static void InstallBootstrapPatch()
{
var sw = Stopwatch.StartNew();

var cAsmName = ExecutingAssembly.GetName();
var managedPath = Path.GetDirectoryName(ExecutingAssembly.Location)!;
var cAsmName = Assembly.GetExecutingAssembly().GetName();
var managedPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)!;

var dataDir = new DirectoryInfo(managedPath).Parent!.Name;
var gameName = dataDir.Substring(0, dataDir.Length - 5);
Expand Down
2 changes: 1 addition & 1 deletion IPA.Injector/Updates.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ private static void InstallPendingSelfUpdates()
if (!File.Exists(path)) return;

var ipaVersion = new Version(FileVersionInfo.GetVersionInfo(path).FileVersion);
var selfVersion = Injector.ExecutingAssembly.GetName().Version;
var selfVersion = Assembly.GetExecutingAssembly().GetName().Version;

if (ipaVersion > selfVersion)
{
Expand Down
4 changes: 2 additions & 2 deletions IPA.Loader/Loader/LibLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ namespace IPA.Loader
{
internal class CecilLibLoader : BaseAssemblyResolver
{
private static readonly string CurrentAssemblyName = PluginLoader.ExecutingAssembly.GetName().Name;
private static readonly string CurrentAssemblyPath = PluginLoader.ExecutingAssembly.Location;
private static readonly string CurrentAssemblyName = Assembly.GetExecutingAssembly().GetName().Name;
private static readonly string CurrentAssemblyPath = Assembly.GetExecutingAssembly().Location;

public override AssemblyDefinition Resolve(AssemblyNameReference name, ReaderParameters parameters)
{
Expand Down
4 changes: 1 addition & 3 deletions IPA.Loader/Loader/PluginLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ internal partial class PluginLoader
{
internal static PluginMetadata SelfMeta = null!;

public static Assembly ExecutingAssembly => typeof(PluginLoader).Assembly;

internal static Task LoadTask() =>
TaskEx.Run(() =>
{
Expand Down Expand Up @@ -93,7 +91,7 @@ internal static void LoadMetadata()
{
var selfMeta = new PluginMetadata
{
Assembly = ExecutingAssembly,
Assembly = Assembly.GetExecutingAssembly(),
File = new FileInfo(Path.Combine(UnityGame.InstallPath, "IPA.exe")),
PluginType = null,
IsSelf = true
Expand Down
2 changes: 1 addition & 1 deletion IPA.Loader/Utilities/UnityGame.cs
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ public static string InstallPath
{
if (_installRoot == null)
_installRoot = Path.GetFullPath(
Path.Combine(Path.GetDirectoryName(PluginLoader.ExecutingAssembly.Location), "..", ".."));
Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "..", ".."));
return _installRoot;
}
}
Expand Down
Binary file modified LocalPackages/HarmonyX.2.11.0.nupkg
Binary file not shown.

0 comments on commit 5ed3539

Please sign in to comment.