public override void PatchStardew(string path = null) { InjectFarmhandCoreClasses(PatcherConstants.PassTwoPackageResult, PatcherConstants.PassOneFarmhandExe, PatcherConstants.FarmhandUiDll, PatcherConstants.FarmhandGameDll, PatcherConstants.FarmhandCharacterDll); var cecilContext = new CecilContext(PatcherConstants.PassTwoPackageResult, true); FarmhandAssemblies.Add(Assembly.LoadFrom(PatcherConstants.FarmhandUiDll)); FarmhandAssemblies.Add(Assembly.LoadFrom(PatcherConstants.FarmhandGameDll)); FarmhandAssemblies.Add(Assembly.LoadFrom(PatcherConstants.FarmhandCharacterDll)); HookApiEvents(cecilContext); HookOutputableApiEvents(cecilContext); HookApiFieldProtectionAlterations <HookAlterBaseFieldProtectionAttribute>(cecilContext); HookApiTypeProtectionAlterations <HookAlterProtectionAttribute>(cecilContext); HookApiVirtualAlterations <HookForceVirtualBaseAttribute>(cecilContext); HookMakeBaseVirtualCallAlterations <HookMakeBaseVirtualCallAttribute>(cecilContext); HookConstructionRedirectors <HookRedirectConstructorFromBaseAttribute>(cecilContext); HookConstructionToMethodRedirectors(cecilContext); HookGlobalRouting(cecilContext); Console.WriteLine("Second Pass Installation Completed"); path = path ?? PatcherConstants.FarmhandExe; cecilContext.WriteAssembly(path, true); }
/// <summary> /// /// </summary> /// <param name="path">Stardew EXE Path</param> public override void PatchStardew(string path = null) { path = path ?? PatcherConstants.StardewExe; InjectFarmhandCoreClasses(PatcherConstants.PassOnePackageResult, path, PatcherConstants.FarmhandDll, PatcherConstants.JsonLibrary); var cecilContext = new CecilContext(PatcherConstants.PassOnePackageResult, true); FarmhandAssemblies.Add(Assembly.LoadFrom(PatcherConstants.FarmhandDll)); HookApiEvents(cecilContext); HookOutputableApiEvents(cecilContext); HookApiFieldProtectionAlterations <HookAlterBaseFieldProtectionAttribute>(cecilContext); HookApiTypeProtectionAlterations <HookAlterProtectionAttribute>(cecilContext); HookApiVirtualAlterations <HookForceVirtualBaseAttribute>(cecilContext); HookMakeBaseVirtualCallAlterations <HookMakeBaseVirtualCallAttribute>(cecilContext); HookConstructionRedirectors <HookRedirectConstructorFromBaseAttribute>(cecilContext); HookConstructionToMethodRedirectors(cecilContext); Console.WriteLine("First Pass Installation Completed"); cecilContext.WriteAssembly(PatcherConstants.PassOneFarmhandExe, true); }