Exemple #1
0
    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);
    }
Exemple #2
0
 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();
 }
Exemple #3
0
    public void SendMessage(PatcherIpcEnvelope envelope)
    {
        var json = IpcHelpers.Base64Encode(JsonConvert.SerializeObject(envelope, IpcHelpers.JsonSettings));

        this.rpcBuffer.RemoteRequest(Encoding.ASCII.GetBytes(json));
    }
Exemple #4
0
 public void TheServiceContractMustBeAnInterface() => new Action(() => new ServiceHostBuilder(IpcHelpers.ConfigureServices()).AddEndpoint <ValidationTests>().ValidateAndBuild()).ShouldThrow <ArgumentOutOfRangeException>().Message.ShouldStartWith("The contract must be an interface!");
Exemple #5
0
 public void TheCallbackContractMustBeAnInterface() => new Action(() => new NamedPipeClientBuilder <ISystemService, ValidationTests>("", IpcHelpers.ConfigureServices()).ValidateAndBuild()).ShouldThrow <ArgumentOutOfRangeException>().Message.ShouldStartWith("The contract must be an interface!");
Exemple #6
0
 public TestBase()
 {
     _guiThread.SynchronizationContext.Send(() => Thread.CurrentThread.Name = "GuiThread");
     _serviceProvider = IpcHelpers.ConfigureServices();
 }