private async Task <object> DispatchRemovePatch(string id, JObject data) { DeferContext context = new DeferContext(id, (targetId, targetType, name, args) => ContextIPC(targetId, targetType, name, args)); CoreDelegates coreDelegates = new CoreDelegates(ToExpando(context)); Dictionary <string, object> result = await Injector.Instance.RemovePatch(data, (ProgressDelegate)((int progress) => { }), coreDelegates); return(result); }
private async Task <object> DispatchToggleVIGO(string id, JObject data, bool value) { DeferContext context = new DeferContext(id, (targetId, targetType, name, args) => ContextIPC(targetId, targetType, name, args)); CoreDelegates coreDelegates = new CoreDelegates(ToExpando(context)); var progressDelegate = (ProgressDelegate)((int progress) => { }); return(value ? await Patches.VIGOPatch.Instance.ApplyPatch(data, progressDelegate, coreDelegates) : await Patches.VIGOPatch.Instance.RemovePatch(data, progressDelegate, coreDelegates)); }
private async Task <object> DispatchInstall(string id, JObject data) { var files = new List <string>(data["files"].Children().ToList().Select(input => input.ToString())); var stopPatterns = new List <string>(data["stopPatterns"].Children().ToList().Select(input => input.ToString())); var pluginPath = data["pluginPath"].ToString(); var scriptPath = data["scriptPath"].ToString(); dynamic choices; try { choices = data["fomodChoices"]; } catch (RuntimeBinderException) { choices = null; } DeferContext context = new DeferContext(id, (targetId, targetType, name, args) => ContextIPC(targetId, targetType, name, args)); CoreDelegates coreDelegates = new CoreDelegates(ToExpando(context)); return(await mInstaller.Install(files, stopPatterns, pluginPath, scriptPath, choices, (ProgressDelegate)((int progress) => { }), coreDelegates)); }
private async Task <object> DispatchToggleReflection(string id, JObject data, bool value) { DeferContext context = new DeferContext(id, (targetId, targetType, name, args) => ContextIPC(targetId, targetType, name, args)); CoreDelegates coreDelegates = new CoreDelegates(ToExpando(context)); var progressDelegate = (ProgressDelegate)((int progress) => { }); if (value) { Dictionary <string, object> isApplicable = await Patches.ReflectionPatch.Instance.IsPatchApplicable(data, coreDelegates); if (isApplicable ["Result"].ToString() == "False") { return(isApplicable); } return(await Patches.ReflectionPatch.Instance.ApplyPatch(data, progressDelegate, coreDelegates)); } else { return(await Patches.ReflectionPatch.Instance.RemovePatch(data, progressDelegate, coreDelegates)); } }