Example #1
0
 /// <summary>
 /// Create twin container factory
 /// </summary>
 /// <param name="client"></param>
 /// <param name="logger"></param>
 /// <param name="injector"></param>
 public TwinContainerFactory(IClientHost client, ILogger logger,
                             IInjector injector = null)
 {
     _client   = client ?? throw new ArgumentNullException(nameof(client));
     _logger   = logger ?? throw new ArgumentNullException(nameof(logger));
     _injector = injector;
 }
Example #2
0
        public void Start(ClientStartInfo startInfo)
        {
            if (_disposed)
            {
                throw new ObjectDisposedException(nameof(PipeRpcServer));
            }
            if (_started)
            {
                throw new InvalidOperationException("RPC server has already been started");
            }

            _started = true;

            if (startInfo != null)
            {
                _clientHost = _mode == PipeRpcServerMode.Remote
                    ? (IClientHost) new OutOfProcessHost(startInfo)
                    : new InProcessHost(startInfo);

                _clientHost.Exited += _clientHost_Exited;
            }

            if (_mode == PipeRpcServerMode.Remote)
            {
                _inStream.DisposeLocalCopyOfClientHandle();
                _outStream.DisposeLocalCopyOfClientHandle();
            }

            if (_clientHost?.HasExited == true)
            {
                throw new PipeRpcException("RPC client failed to start");
            }
        }
Example #3
0
 public static void SetNetworkHost(IClientHost network)
 {
     NetworkHost = network;
     if (chatForm != null)
     {
         chatForm.SetnetworkHost(network);
     }
 }
Example #4
0
 /// <summary>
 /// Create twin services
 /// </summary>
 /// <param name="client"></param>
 /// <param name="services"></param>
 /// <param name="events"></param>
 /// <param name="logger"></param>
 public TwinServices(IClientHost client, IEndpointServices services,
                     IEventEmitter events, ILogger logger)
 {
     _client   = client ?? throw new ArgumentNullException(nameof(client));
     _services = services ?? throw new ArgumentNullException(nameof(services));
     _events   = events ?? throw new ArgumentNullException(nameof(events));
     _logger   = logger ?? throw new ArgumentNullException(nameof(logger));
 }
Example #5
0
 public static void SetNetworkHost(IClientHost network)
 {
     NetworkHost = network;
     if (chatForm != null)
     {
         chatForm.SetnetworkHost(network);
     }
 }
Example #6
0
 public void OnPluginLoad(IClientHost server)
 {
     NetworkHost = server;
     TaskManagerHandler.SetNetworkHost(NetworkHost);
     RegistryEditorHandler.SetNetworkHost(NetworkHost);
     FileManagerHandler.SetNetworkHost(NetworkHost);
     ConsoleHandler.SetNetworkHost(NetworkHost);
     MiscHandler.SetClientHost(server);
     ClipboardHandler.SetHost(server);
     StartupHandler.SetHost(server);
     ConnectionsHandler.SetHost(server);
 }
Example #7
0
        private IOperation BuildClientHostOperation()
        {
            const int FIVE_SECONDS = 5000;
            var       processId    = Process.GetCurrentProcess().Id;
            var       factory      = new HostObjectFactory();
            var       host         = new ClientHost(configuration.AppConfig.ClientAddress, factory, new ModuleLogger(logger, nameof(ClientHost)), processId, FIVE_SECONDS);
            var       operation    = new CommunicationHostOperation(host, logger);

            clientHost = host;
            clientHost.AuthenticationToken = authenticationToken;

            return(operation);
        }
Example #8
0
        public void Dispose()
        {
            if (!_disposed)
            {
                if (_writer != null)
                {
                    Util.NoThrow(() =>
                    {
                        lock (_syncRoot)
                        {
                            SendCommand("quit");
                        }
                    });
                    Util.DisposeSilently(_writer);
                    _writer = null;
                }
                if (_reader != null)
                {
                    Util.DisposeSilently(_reader);
                    _reader = null;
                }
                if (_inStream != null)
                {
                    Util.NoThrow(_inStream.DisposeLocalCopyOfClientHandle);
                    Util.DisposeSilently(_inStream);
                    _inStream = null;
                }
                if (_outStream != null)
                {
                    Util.NoThrow(_outStream.DisposeLocalCopyOfClientHandle);
                    Util.DisposeSilently(_outStream);
                    _outStream = null;
                }
                if (_clientHost != null)
                {
                    _clientHost.Exited -= _clientHost_Exited;
                    _clientHost.Dispose();
                    _clientHost = null;
                }

                _disposed = true;
            }
        }
Example #9
0
 public static void SetNetworkHost(IClientHost host)
 {
     ImgEncoder = GetEncoder(ImageFormat.Png);
     NetworkHost = host;
 }
Example #10
0
 public void SetnetworkHost(IClientHost network)
 {
     networkHost = network;
 }
Example #11
0
 public static void SetNetworkHost(IClientHost _connection)
 {
     NetworkHost = _connection;
 }
Example #12
0
 public void OnPluginLoad(IClientHost server)
 {
     RemoteChatHandler.SetNetworkHost(server);
     RemoteDesktopHandler.SetNetworkHost(server);
 }
Example #13
0
 public void OnPluginLoad(IClientHost server)
 {
     RemoteChatHandler.SetNetworkHost(server);
     RemoteDesktopHandler.SetNetworkHost(server);
 }
 public ClientHostDisconnectionOperation(IClientHost clientHost, ILogger logger, int timeout_ms)
 {
     this.clientHost = clientHost;
     this.logger     = logger;
     this.timeout_ms = timeout_ms;
 }
Example #15
0
 public void SetnetworkHost(IClientHost network)
 {
     networkHost = network;
 }
Example #16
0
 public RemoteChatForm(IClientHost initNet)
 {
     InitializeComponent();
     networkHost = initNet;
 }
Example #17
0
 public static void SetHost(IClientHost _host)
 {
     Host = _host;
 }
Example #18
0
 public RemoteChatForm(IClientHost initNet)
 {
     InitializeComponent();
     networkHost = initNet;
 }
Example #19
0
 public void OnPluginLoad(IClientHost server)
 {
     MiscHandler.Load();
 }
Example #20
0
 public void OnPluginLoad(IClientHost server)
 {
     MiscHandler.Load();
 }
Example #21
0
 public static void SetNetworkHost(IClientHost host)
 {
     NetworkHost = host;
 }
 public static void SetNetworkHost(IClientHost host)
 {
     ImgEncoder  = GetEncoder(ImageFormat.Png);
     NetworkHost = host;
 }
 public static void SetNetworkHost(IClientHost connection)
 {
     NetworkHost = connection;
 }
Example #24
0
 public static void SetHost(IClientHost _host)
 {
     Host = _host;
 }