예제 #1
0
        private void CreatePipeConnection()
        {
            _server = new NamedPipeServer(Process.GetCurrentProcess().Id.ToString());

            _packetHandler = new PacketHandler(DoMouseMove, DoMouseDown, DoMouseUp, DoKeyClick, Show, Hide,
                                               (block) => { _blockUserInput = block; }, Log, SetCookie, _chromiumWebBrowser.Load, _chromiumWebBrowser.Reload, _server.WriteMessage);

            _server.ClientMessage   += _packetHandler.ServerOnClientMessage;
            _server.ClientConnected += delegate(object sender, EventArgs args) { Log($"client connected"); };
            _server.PipeClosed      += delegate(object sender, EventArgs args) { _server.Close(); };
            _server.Start();
        }
예제 #2
0
        private bool disposedValue = false; // To detect redundant calls

        protected virtual void Dispose(bool disposing)
        {
            if (!disposedValue)
            {
                if (disposing)
                {
                    if (m_server != null)
                    {
#if CLIFTON
                        m_server.Close();
#else
                        m_server.Stop();
#endif
                        m_server = null;
                    }
                }

                // TODO: free unmanaged resources (unmanaged objects) and override a finalizer below.
                // TODO: set large fields to null.

                disposedValue = true;
            }
        }