private void RemoteCallHandler(ulong msgId, byte[] payload) { var json = IpcHelpers.Base64Decode(Encoding.ASCII.GetString(payload)); Log.Information("[SHMEMRPC] IPC({0}): {1}", msgId, json); var msg = JsonConvert.DeserializeObject <PatcherIpcEnvelope>(json, IpcHelpers.JsonSettings); MessageReceived?.Invoke(msg); }
public EndpointTests() { _computingCallback = new ComputingCallback { Id = Guid.NewGuid().ToString() }; _systemCallback = new SystemCallback { Id = Guid.NewGuid().ToString() }; _serviceProvider = IpcHelpers.ConfigureServices(); _computingService = (ComputingService)_serviceProvider.GetService <IComputingService>(); _systemService = (SystemService)_serviceProvider.GetService <ISystemService>(); _host = new ServiceHostBuilder(_serviceProvider) .UseNamedPipes(new NamedPipeSettings(PipeName) { RequestTimeout = RequestTimeout }) .AddEndpoint <IComputingServiceBase>() .AddEndpoint <IComputingService, IComputingCallback>() .AddEndpoint <ISystemService, ISystemCallback>() .ValidateAndBuild(); _host.RunAsync(); _computingClient = ComputingClientBuilder().ValidateAndBuild(); _systemClient = CreateSystemService(); }
public void SendMessage(PatcherIpcEnvelope envelope) { var json = IpcHelpers.Base64Encode(JsonConvert.SerializeObject(envelope, IpcHelpers.JsonSettings)); this.rpcBuffer.RemoteRequest(Encoding.ASCII.GetBytes(json)); }
public void TheServiceContractMustBeAnInterface() => new Action(() => new ServiceHostBuilder(IpcHelpers.ConfigureServices()).AddEndpoint <ValidationTests>().ValidateAndBuild()).ShouldThrow <ArgumentOutOfRangeException>().Message.ShouldStartWith("The contract must be an interface!");
public void TheCallbackContractMustBeAnInterface() => new Action(() => new NamedPipeClientBuilder <ISystemService, ValidationTests>("", IpcHelpers.ConfigureServices()).ValidateAndBuild()).ShouldThrow <ArgumentOutOfRangeException>().Message.ShouldStartWith("The contract must be an interface!");
public TestBase() { _guiThread.SynchronizationContext.Send(() => Thread.CurrentThread.Name = "GuiThread"); _serviceProvider = IpcHelpers.ConfigureServices(); }