Upgrade to Harmony v2.0.0

This commit is contained in:
NGnius (Graham) 2020-05-03 15:31:09 -04:00
parent f244eb9683
commit 1f35b2a434
22 changed files with 32 additions and 32 deletions

View file

@ -8,7 +8,7 @@ using System.Reflection;
using Svelto.ECS; using Svelto.ECS;
using RobocraftX.Common; using RobocraftX.Common;
using Harmony; using HarmonyLib;
namespace GamecraftModdingAPI.Blocks namespace GamecraftModdingAPI.Blocks
{ {

View file

@ -2,7 +2,7 @@ using System;
using System.Reflection; using System.Reflection;
using DataLoader; using DataLoader;
using Harmony; using HarmonyLib;
using RobocraftX.Blocks; using RobocraftX.Blocks;
using RobocraftX.Blocks.Ghost; using RobocraftX.Blocks.Ghost;
using RobocraftX.Blocks.Scaling; using RobocraftX.Blocks.Scaling;
@ -137,7 +137,7 @@ namespace GamecraftModdingAPI.Blocks
Logging.MetaDebugLog("Block entity factory injected."); Logging.MetaDebugLog("Block entity factory injected.");
} }
static MethodBase TargetMethod(HarmonyInstance instance) static MethodBase TargetMethod(Harmony instance)
{ {
return AccessTools.TypeByName("RobocraftX.CR.MachineEditing.PlaceBlockEngine").GetConstructors()[0]; return AccessTools.TypeByName("RobocraftX.CR.MachineEditing.PlaceBlockEngine").GetConstructors()[0];
} }

View file

@ -1,6 +1,6 @@
using System.Reflection; using System.Reflection;
using Harmony; using HarmonyLib;
using RobocraftX.Blocks; using RobocraftX.Blocks;
using RobocraftX.Blocks.Ghost; using RobocraftX.Blocks.Ghost;
using RobocraftX.Character.Camera; using RobocraftX.Character.Camera;
@ -65,7 +65,7 @@ namespace GamecraftModdingAPI.Blocks
Logging.MetaDebugLog("Requirements injected."); Logging.MetaDebugLog("Requirements injected.");
} }
static MethodBase TargetMethod(HarmonyInstance instance) static MethodBase TargetMethod(Harmony instance)
{ {
return AccessTools.TypeByName("RobocraftX.CR.MachineEditing.RemoveBlockEngine").GetConstructors()[0]; return AccessTools.TypeByName("RobocraftX.CR.MachineEditing.RemoveBlockEngine").GetConstructors()[0];
} }

View file

@ -5,7 +5,7 @@ using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Reflection; using System.Reflection;
using Harmony; using HarmonyLib;
using Svelto.Context; using Svelto.Context;
using Svelto.ECS; using Svelto.ECS;
using RobocraftX; using RobocraftX;
@ -33,7 +33,7 @@ namespace GamecraftModdingAPI.Commands
CommandManager.RegisterEngines(enginesRoot); CommandManager.RegisterEngines(enginesRoot);
} }
public static MethodBase TargetMethod(HarmonyInstance instance) public static MethodBase TargetMethod(Harmony instance)
{ {
return typeof(RobocraftX.GUI.CommandLine.CommandLineCompositionRoot).GetMethod("Compose").MakeGenericMethod(typeof(object)); return typeof(RobocraftX.GUI.CommandLine.CommandLineCompositionRoot).GetMethod("Compose").MakeGenericMethod(typeof(object));
//return func.Method; //return func.Method;

View file

@ -5,7 +5,7 @@ using System.Reflection;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using Harmony; using HarmonyLib;
using Svelto.ECS; using Svelto.ECS;
using RobocraftX.Common; using RobocraftX.Common;
using RobocraftX.StateSync; using RobocraftX.StateSync;
@ -37,7 +37,7 @@ namespace GamecraftModdingAPI.Events
} }
[HarmonyTargetMethod] [HarmonyTargetMethod]
public static MethodBase TargetMethod(HarmonyInstance harmonyInstance) public static MethodBase TargetMethod(Harmony harmonyInstance)
{ {
return AccessTools.Method(AccessTools.TypeByName("RobocraftX.StateSync.GameHostTransitionDeterministicGroupEngine"), "EndTransition"); return AccessTools.Method(AccessTools.TypeByName("RobocraftX.StateSync.GameHostTransitionDeterministicGroupEngine"), "EndTransition");
//.MakeGenericMethod(typeof(CosmeticEnginesSequenceBuildOrder), typeof(CosmeticEnginesSequenceSimOrder), typeof(DeterministicToCosmeticSyncBuildOrder), typeof(DeterministicToCosmeticSyncSimOrder)); //.MakeGenericMethod(typeof(CosmeticEnginesSequenceBuildOrder), typeof(CosmeticEnginesSequenceSimOrder), typeof(DeterministicToCosmeticSyncBuildOrder), typeof(DeterministicToCosmeticSyncSimOrder));

View file

@ -5,7 +5,7 @@ using System.Reflection;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using Harmony; using HarmonyLib;
using RobocraftX; using RobocraftX;
using Svelto.ECS; using Svelto.ECS;

View file

@ -4,7 +4,7 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using Harmony; using HarmonyLib;
using RobocraftX; using RobocraftX;
using GamecraftModdingAPI.Utility; using GamecraftModdingAPI.Utility;

View file

@ -5,7 +5,7 @@ using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Reflection; using System.Reflection;
using Harmony; using HarmonyLib;
using RobocraftX; using RobocraftX;
using RobocraftX.CR.MainGame; using RobocraftX.CR.MainGame;
using Svelto.ECS; using Svelto.ECS;

View file

@ -4,7 +4,7 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using Harmony; using HarmonyLib;
using RobocraftX; using RobocraftX;
using Svelto.ECS; using Svelto.ECS;

View file

@ -4,7 +4,7 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using Harmony; using HarmonyLib;
using RobocraftX; using RobocraftX;
using Svelto.ECS; using Svelto.ECS;

View file

@ -14,7 +14,7 @@
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Lib.Harmony" Version="1.2.0.1" /> <PackageReference Include="Lib.Harmony" Version="2.0.0.10" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Reference Include="Microsoft.CSharp" /> <Reference Include="Microsoft.CSharp" />

View file

@ -5,7 +5,7 @@ using RobocraftX.Multiplayer.Input;
using GamecraftModdingAPI.Blocks; using GamecraftModdingAPI.Blocks;
using GamecraftModdingAPI.Utility; using GamecraftModdingAPI.Utility;
using Harmony; using HarmonyLib;
namespace GamecraftModdingAPI.Inventory namespace GamecraftModdingAPI.Inventory
{ {

View file

@ -5,7 +5,7 @@ using RobocraftX.GUI;
using RobocraftX.GUI.Hotbar; using RobocraftX.GUI.Hotbar;
using Svelto.ECS; using Svelto.ECS;
using Harmony; using HarmonyLib;
using GamecraftModdingAPI.Blocks; using GamecraftModdingAPI.Blocks;
namespace GamecraftModdingAPI.Inventory namespace GamecraftModdingAPI.Inventory
@ -24,7 +24,7 @@ namespace GamecraftModdingAPI.Inventory
selectedBlockInt = selectedDBPartID; selectedBlockInt = selectedDBPartID;
} }
public static MethodBase TargetMethod(HarmonyInstance instance) public static MethodBase TargetMethod(Harmony harmonyInstance)
{ {
return PatchedMethod; return PatchedMethod;
} }

View file

@ -5,7 +5,7 @@ using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Reflection; using System.Reflection;
using Harmony; using HarmonyLib;
using GamecraftModdingAPI.Utility; using GamecraftModdingAPI.Utility;
using GamecraftModdingAPI.Events; using GamecraftModdingAPI.Events;
@ -19,7 +19,7 @@ namespace GamecraftModdingAPI
/// </summary> /// </summary>
public static class Main public static class Main
{ {
private static HarmonyInstance harmony; private static Harmony harmony;
public static bool IsInitialized { public static bool IsInitialized {
get { return harmony != null; } get { return harmony != null; }
@ -43,7 +43,7 @@ namespace GamecraftModdingAPI
} }
Logging.MetaDebugLog($"Patching Gamecraft"); Logging.MetaDebugLog($"Patching Gamecraft");
var currentAssembly = Assembly.GetExecutingAssembly(); var currentAssembly = Assembly.GetExecutingAssembly();
harmony = HarmonyInstance.Create(currentAssembly.GetName().Name); harmony = new Harmony(currentAssembly.GetName().Name);
harmony.PatchAll(currentAssembly); harmony.PatchAll(currentAssembly);
// init utility // init utility
Logging.MetaDebugLog($"Initializing Utility"); Logging.MetaDebugLog($"Initializing Utility");

View file

@ -7,7 +7,7 @@ using Svelto.DataStructures;
using Svelto.ECS; using Svelto.ECS;
using Svelto.ECS.Serialization; using Svelto.ECS.Serialization;
using Harmony; using HarmonyLib;
using GamecraftModdingAPI.Utility; using GamecraftModdingAPI.Utility;
namespace GamecraftModdingAPI.Persistence namespace GamecraftModdingAPI.Persistence

View file

@ -3,7 +3,7 @@
using RobocraftX.SaveAndLoad; using RobocraftX.SaveAndLoad;
using Svelto.ECS; using Svelto.ECS;
using Harmony; using HarmonyLib;
namespace GamecraftModdingAPI.Persistence namespace GamecraftModdingAPI.Persistence
{ {

View file

@ -9,7 +9,7 @@ using Svelto.ECS;
using Svelto.ECS.Serialization; using Svelto.ECS.Serialization;
using GamecraftModdingAPI.Utility; using GamecraftModdingAPI.Utility;
using Harmony; using HarmonyLib;
namespace GamecraftModdingAPI.Persistence namespace GamecraftModdingAPI.Persistence
{ {

View file

@ -1,7 +1,7 @@
using System; using System;
using System.Reflection; using System.Reflection;
using Harmony; using HarmonyLib;
// test // test
using Svelto.ECS; using Svelto.ECS;
using RobocraftX.Blocks; using RobocraftX.Blocks;
@ -24,7 +24,7 @@ namespace GamecraftModdingAPI.Tests
: IllusionPlugin.IEnhancedPlugin : IllusionPlugin.IEnhancedPlugin
#endif #endif
{ {
private static HarmonyInstance harmony { get; set; } private static Harmony harmony { get; set; }
public string[] Filter { get; } = new string[] { "Gamecraft", "GamecraftPreview" }; public string[] Filter { get; } = new string[] { "Gamecraft", "GamecraftPreview" };
@ -42,7 +42,7 @@ namespace GamecraftModdingAPI.Tests
public void OnApplicationStart() public void OnApplicationStart()
{ {
FileLog.Reset(); FileLog.Reset();
HarmonyInstance.DEBUG = true; Harmony.DEBUG = true;
GamecraftModdingAPI.Main.Init(); GamecraftModdingAPI.Main.Init();
Logging.MetaDebugLog($"Version group id {(uint)ApiExclusiveGroups.versionGroup}"); Logging.MetaDebugLog($"Version group id {(uint)ApiExclusiveGroups.versionGroup}");
// in case Steam is not installed/running // in case Steam is not installed/running

View file

@ -6,7 +6,7 @@ using System.Threading.Tasks;
using System.Reflection; using System.Reflection;
using Analytics; using Analytics;
using Harmony; using HarmonyLib;
using RobocraftX.Common; using RobocraftX.Common;
using Svelto.ECS; using Svelto.ECS;
@ -30,7 +30,7 @@ namespace GamecraftModdingAPI.Utility
return !DisableAnalytics; return !DisableAnalytics;
} }
public static MethodBase TargetMethod(HarmonyInstance instance) public static MethodBase TargetMethod(Harmony instance)
{ {
return typeof(Analytics.AnalyticsCompositionRoot).GetMethod("Compose").MakeGenericMethod(typeof(object)); return typeof(Analytics.AnalyticsCompositionRoot).GetMethod("Compose").MakeGenericMethod(typeof(object));
} }

View file

@ -5,7 +5,7 @@ using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using DataLoader; using DataLoader;
using Harmony; using HarmonyLib;
using RobocraftX; using RobocraftX;
using RobocraftX.Common.Utilities; using RobocraftX.Common.Utilities;
using RobocraftX.GUI; using RobocraftX.GUI;

View file

@ -4,7 +4,7 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using Harmony; using HarmonyLib;
using RobocraftX.FrontEnd; using RobocraftX.FrontEnd;
namespace GamecraftModdingAPI.Utility namespace GamecraftModdingAPI.Utility

View file

@ -4,7 +4,7 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using Harmony; using HarmonyLib;
using RobocraftX.Common; using RobocraftX.Common;
namespace GamecraftModdingAPI.Utility namespace GamecraftModdingAPI.Utility