Exemplo n.º 1
0
        public Sandbox <TInterface, TObject> Build <TInterface, TObject>() where TObject : class, TInterface, new() where TInterface : class
        {
            Guard.IsInterface <TInterface>();

            var server  = new NamedPipeServer(new NamedPipedServerFactory(), _address);
            var sandbox = new Sandbox <TInterface, TObject>(server.Select(it => _serializer.Deserialize(it)), new PublishedMessagesFormatter(server, _serializer));

            sandbox.AddDisposeHandler(_template.Run(_address) ?? Disposable.Empty);

            return(sandbox);
        }
Exemplo n.º 2
0
        public SandboxClient Build()
        {
            var server = new NamedPipeServer(new NamedPipedClientFactory(), _address);

            _publisher = new PublishedMessagesFormatter(server, _serializer);
            _messages  = server.Select(it => _serializer.Deserialize(it));
            var client = new SandboxClient(_messages, _publisher);

            AppDomain.CurrentDomain.UnhandledException += CurrentDomainOnUnhandledException;
            client.AddDisposeHandler(Disposable.Create(() => AppDomain.CurrentDomain.UnhandledException -= CurrentDomainOnUnhandledException));
            return(client);
        }