Browse Source

Try to port to MonoMod reorg

monomod-reorg
Meivyn 4 months ago
parent
commit
d07c5d4968
No known key found for this signature in database GPG Key ID: 8BDD3E48158B2F71
9 changed files with 30 additions and 20 deletions
  1. +6
    -7
      IPA.Injector/IPA.Injector.csproj
  2. +4
    -2
      IPA.Injector/Injector.cs
  3. +5
    -5
      IPA.Injector/Updates.cs
  4. +1
    -1
      IPA.Loader/IPA.Loader.csproj
  5. +3
    -3
      IPA.Loader/Loader/LibLoader.cs
  6. +3
    -1
      IPA.Loader/Loader/PluginLoader.cs
  7. +2
    -1
      IPA.Loader/Utilities/UnityGame.cs
  8. BIN
      LocalPackages/HarmonyX.2.11.0.nupkg
  9. +6
    -0
      nuget.config

+ 6
- 7
IPA.Injector/IPA.Injector.csproj View File

@ -90,19 +90,18 @@
<ProjectReference Include="..\SemVer\SemVer.csproj" />
</ItemGroup>
<Target Name="CopyDocumentation" BeforeTargets="Build">
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Message Text="Copying documentation" Importance="normal" />
<ItemGroup>
<ReferenceFiles Include="%(Reference.RelativeDir)%(Reference.Filename).xml" />
<XmlFiles Include="%(Reference.RelativeDir)%(Reference.Filename).xml"/>
</ItemGroup>
<Message Text="Copying documentation" />
<Copy SourceFiles="@(ReferenceFiles)" DestinationFolder="$(OutputPath)Libs" Condition="Exists('%(RootDir)%(Directory)%(Filename)%(Extension)')" />
</Target>
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Copy SourceFiles="@(XmlFiles)" DestinationFolder="$(OutputPath)" Condition="Exists('%(RootDir)%(Directory)%(Filename)%(Extension)')" />
<Message Text="Relocating" Importance="normal" />
<ItemGroup>
<SystemFiles Include="$(OutputPath)IPA.Injector.*" />
<SystemFiles Include="$(OutputPath)IPA.Loader.*" />
<SystemFiles Include="$(OutputPath)MonoMod.Backports.*" />
<SystemFiles Include="$(OutputPath)MonoMod.ILHelpers.*" />
<SystemFiles Include="$(OutputPath)AsyncBridge.*" />
<SystemFiles Include="$(OutputPath)System.*" />
<SystemFiles Include="$(OutputPath)Portable.System.*" />


+ 4
- 2
IPA.Injector/Injector.cs View File

@ -35,6 +35,8 @@ namespace IPA.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
@ -141,8 +143,8 @@ namespace IPA.Injector
{
var sw = Stopwatch.StartNew();
var cAsmName = Assembly.GetExecutingAssembly().GetName();
var managedPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)!;
var cAsmName = ExecutingAssembly.GetName();
var managedPath = Path.GetDirectoryName(ExecutingAssembly.Location)!;
var dataDir = new DirectoryInfo(managedPath).Parent!.Name;
var gameName = dataDir.Substring(0, dataDir.Length - 5);


+ 5
- 5
IPA.Injector/Updates.cs View File

@ -35,7 +35,7 @@ namespace IPA.Injector
if (!File.Exists(path)) return;
var ipaVersion = new Version(FileVersionInfo.GetVersionInfo(path).FileVersion);
var selfVersion = Assembly.GetExecutingAssembly().GetName().Version;
var selfVersion = Injector.ExecutingAssembly.GetName().Version;
if (ipaVersion > selfVersion)
{
@ -67,8 +67,8 @@ namespace IPA.Injector
private static void InstallPendingModUpdates()
{
var pendingDir = Path.Combine(UnityGame.InstallPath, "IPA", "Pending");
if (!Directory.Exists(pendingDir)) return;
if (!Directory.Exists(pendingDir)) return;
// there are pending updates, install
Updater.Info("Installing pending updates");
@ -99,7 +99,7 @@ namespace IPA.Injector
if (Directory.Exists(path = Path.Combine(pendingDir, "IPA")))
{
var dirs = new Stack<string>(20);
dirs.Push(path);
while (dirs.Count > 0)
@ -135,7 +135,7 @@ namespace IPA.Injector
Updater.Error(e);
}
}
foreach (var str in subDirs)
dirs.Push(str);
}


+ 1
- 1
IPA.Loader/IPA.Loader.csproj View File

@ -57,7 +57,7 @@
</PackageReference>-->
<PackageReference Include="Mono.Cecil" Version="0.11.5" />
<PackageReference Include="HarmonyX" Version="2.10.2" />
<PackageReference Include="HarmonyX" Version="2.11.0" />
<PackageReference Include="Hive.Versioning.Standalone" Version="0.1.0-gh846.1" />
<ProjectReference Include="..\SemVer\SemVer.csproj" />


+ 3
- 3
IPA.Loader/Loader/LibLoader.cs View File

@ -21,8 +21,8 @@ namespace IPA.Loader
{
internal class CecilLibLoader : BaseAssemblyResolver
{
private static readonly string CurrentAssemblyName = Assembly.GetExecutingAssembly().GetName().Name;
private static readonly string CurrentAssemblyPath = Assembly.GetExecutingAssembly().Location;
private static readonly string CurrentAssemblyName = PluginLoader.ExecutingAssembly.GetName().Name;
private static readonly string CurrentAssemblyPath = PluginLoader.ExecutingAssembly.Location;
public override AssemblyDefinition Resolve(AssemblyNameReference name, ReaderParameters parameters)
{
@ -215,7 +215,7 @@ namespace IPA.Loader
{ continue; }
catch (DirectoryNotFoundException)
{ continue; }
foreach (string str in subDirs)
if (dirValidator(str)) dirs.Push(str);


+ 3
- 1
IPA.Loader/Loader/PluginLoader.cs View File

@ -36,6 +36,8 @@ namespace IPA.Loader
{
internal static PluginMetadata SelfMeta = null!;
public static Assembly ExecutingAssembly => typeof(PluginLoader).Assembly;
internal static Task LoadTask() =>
TaskEx.Run(() =>
{
@ -91,7 +93,7 @@ namespace IPA.Loader
{
var selfMeta = new PluginMetadata
{
Assembly = Assembly.GetExecutingAssembly(),
Assembly = ExecutingAssembly,
File = new FileInfo(Path.Combine(UnityGame.InstallPath, "IPA.exe")),
PluginType = null,
IsSelf = true


+ 2
- 1
IPA.Loader/Utilities/UnityGame.cs View File

@ -1,5 +1,6 @@
#nullable enable
using IPA.Config;
using IPA.Loader;
using IPA.Utilities.Async;
using System;
using System.Diagnostics;
@ -142,7 +143,7 @@ namespace IPA.Utilities
{
if (_installRoot == null)
_installRoot = Path.GetFullPath(
Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "..", ".."));
Path.Combine(Path.GetDirectoryName(PluginLoader.ExecutingAssembly.Location), "..", ".."));
return _installRoot;
}
}


BIN
LocalPackages/HarmonyX.2.11.0.nupkg View File


+ 6
- 0
nuget.config View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="Local" value="LocalPackages" />
</packageSources>
</configuration>

Loading…
Cancel
Save