public void LoadData() { patcherData = new PatcherData(); Directory.SetCurrentDirectory(WorkingPath); patcherData.Load(loadData("IR.exe"), loadData("PluginLoader.dll")); }
private bool callPatches(PatcherData patcherData) { checkIfAlreadyPatched(); logIRVersion(); var patches = new List <Type>(); patches.Add(typeof(AccessModifierPatch)); patches.Add(typeof(ProgramPatch)); //patches.Add(typeof(AgosGuiPatch)); patches.Add(typeof(ChatControllerPatch)); //patches.Add(typeof(ClientDeviceFactoryPatch)); //patches.Add(typeof(DeviceFactoryPatch)); //patches.Add(typeof(GameClientPatch)); //patches.Add(typeof(GameEditorPatch)); //patches.Add(typeof(GameMenuPatch)); patches.Add(typeof(GameServerPatch)); try { var irData = patcherData.IRData; var plData = patcherData.PLData; irData.AssemblyDef.Name.Name = "patchedIR"; patches.ForEach((patch) => executePatch(patch, patcherData)); saveAssembly(irData.AssemblyDef, "patchedIR.exe"); } catch (Exception exception) { Log.ErrorLine("An error occurred during launching"); Log.ErrorLine(exception.ToString()); return(false); } Log.InfoLine("Patching done"); return(true); }
protected Patch(PatcherData patcherData) { this.patcherData = patcherData; }
private void executePatch(Type patch, PatcherData patcherData) { Log.Info($"Applying {patch.Name} "); Activator.CreateInstance(patch, patcherData); Log.SuccessLine("done"); }