Пример #1
0
        public void Start(int port)
        {
            if (Running)
            {
                throw new InvalidOperationException("Server already running");
            }

            try
            {
                Process.GetCurrentProcess().PriorityClass = ServerBasePriority;
            }catch (Exception ex)
            {
                ISLogger.Write("Cannot set process priority to {0}: {1}", ServerBasePriority, ex.Message);
            }


            ConnectedClient.LocalHost = new ConnectedClient(true);
            ISLogger.Write("Starting server...");
            ServerPort = port;
            clientMan  = new ClientManager(ServerDefaultMaxClients);
            clientMan.AddClient(ConnectedClient.LocalHost);
            tcpListener = new ClientListener();
            tcpListener.ClientConnected += TcpListener_ClientConnected;


            tcpListener.Start(port);


            SetConsoleText("Current client: localhost");

            //We need to determine which OS is being used
            OSHelper.Os os = OSHelper.GetOsVersion();

            switch (os.System)
            {
            case OSHelper.Platform.Windows:
            {
                inputMan    = new WindowsInputManager();
                curMonitor  = new WindowsCursorMonitor();
                outManager  = new WindowsOutputManager();
                procMonitor = new WindowsProcessMonitor();
                break;
            }

            default:
                throw new NotImplementedException();
            }
            inputMan.Start();

            curMonitor.Start();
            curMonitor.EdgeHit += LocalHost_EdgeHit;

            procMonitor.StartMonitoring();
            procMonitor.ProcessEnteredFullscreen += ProcMonitor_ProcessEnteredFullscreen;
            procMonitor.ProcessExitedFullscreen  += ProcMonitor_ProcessExitedFullscreen;
            Running = true;

            inputMan.InputReceived         += InputMan_InputReceived;
            inputMan.ClientHotkeyPressed   += InputMan_ClientHotkeyPressed;
            inputMan.FunctionHotkeyPressed += InputMan_FunctionHotkeyPressed;
            inputMan.ClipboardTextCopied   += InputMan_ClipboardTextCopied;

            LoadHotkeySettings();
        }
Пример #2
0
 public GlobalClipboardController(ClientManager clientManager, FileAccessController faController, SetClipboardDataDelegate setcb)
 {
     fileController        = faController;
     SetLocalClipboardData = setcb;
     clientMan             = clientManager;
 }