public void PreScriptLoad(KCModHelper helper) { if (!InteropClient.TryGetMod("SimpleDemo2", out modAssembly)) { return; } helper.Log("Successfully loaded SimpleDemo2"); }
public void PreScriptLoad(KCModHelper helper) { if (!InteropClient.TryGetMod("PatchMethods2", out modAssembly)) { return; } HarmonyInstance instance = HarmonyInstance.Create("PatchMethods2"); instance.Patch(modAssembly.GetType("Examples.PatchMethods.PatchMethods2.PatchMethods2").GetMethod("SceneLoaded"), prefix: new HarmonyMethod(typeof(PatchMethods1).GetMethod("PatchPrefix", Harmony.AccessTools.all))); }
public static void Main(string[] args) { Console.WriteLine("Application started."); var runtimeVersion = typeof(object).Assembly.GetCustomAttribute <AssemblyInformationalVersionAttribute>()?.InformationalVersion ?? "Unknown"; Console.WriteLine($"NetCoreAppVersion: {runtimeVersion}"); InteropClient.Run(args); }
public void PreScriptLoad(KCModHelper helper) { if (!InteropClient.TryGetMod("AccessFields2", out modAssembly)) { return; } Type fieldClass = modAssembly.GetType("Examples.AccessFields.AccessFields2.AccessFields2"); FieldInfo field = fieldClass.GetField("myString", Harmony.AccessTools.all); helper.Log((string)field.GetValue(null)); }
public void PreScriptLoad(KCModHelper helper) { if (!InteropClient.TryGetMod("CallMethods2", out modAssembly)) { return; } Type type = modAssembly.GetType("Examples.CallMethods.CallMethods2.CallMethods2"); MethodInfo method = type.GetMethod("AddSeventyThree", Harmony.AccessTools.all); helper.Log(((int)method.Invoke(null, new object[] { 56 })).ToString()); Func <int, int> delegateMethod = (Func <int, int>)Delegate.CreateDelegate(typeof(Func <int, int>), method); helper.Log(delegateMethod(56).ToString()); }
public void PreScriptLoad(KCModHelper helper) { if (!InteropClient.TryGetMod("UseClasses2", out modAssembly)) { return; } Type classType = modAssembly.GetType("Examples.UseClasses.UseClasses2.DemoClass"); MethodInfo logMessage = classType.GetMethod("LogMessage", Harmony.AccessTools.all); object instance = Activator.CreateInstance(classType); logMessage.Invoke(instance, new object[] { helper }); instance = Activator.CreateInstance(classType, new object[] { "Goodbye!" }); logMessage.Invoke(instance, new object[] { helper }); }
public static void Run(string[] args) { var parserResult = Parser.Default.ParseArguments <ClientOptions>(args) .WithNotParsed(errors => Environment.Exit(1)) .WithParsed(options => { Console.WriteLine("Use TLS: " + options.UseTls); Console.WriteLine("Use Test CA: " + options.UseTestCa); Console.WriteLine("Client type: " + options.ClientType); Console.WriteLine("Server host: " + options.ServerHost); Console.WriteLine("Server port: " + options.ServerPort); using (var interopClient = new InteropClient(options)) { interopClient.Run().GetAwaiter().GetResult(); } }); }
public async Task <string> RunTestAsync(string serverHost, int serverPort, string grpcWebMode, string testCase) { var clientOptions = new ClientOptions { TestCase = testCase, ServerHost = serverHost, ServerPort = serverPort, UseTls = false, GrpcWebMode = grpcWebMode }; var client = new InteropClient(clientOptions, _loggerFactory); try { await client.Run(); } catch (Exception ex) { _logger.LogError(ex, ex.Message); return(ex.ToString()); } return("Success"); }
public void Preload(KCModHelper helper) { InteropClient.Register("PatchMethods1"); }
public static void Main(string[] args) { InteropClient.Run(args); }
public void Preload(KCModHelper helper) { InteropClient.Register("AccessFields1"); }
public void Preload(KCModHelper helper) { InteropClient.Register("CallMethods2"); }
public void Preload(KCModHelper helper) { InteropClient.Register("SimpleDemo2"); }
public void Preload(KCModHelper helper) { InteropClient.Register("PatchMethods2"); name = "Elon Musk"; }
public void Preload(KCModHelper helper) { InteropClient.Register("UseClasses2"); }