Ejemplo n.º 1
0
        public void Start(ISServerDependencies dependencies, StartOptions args, int port)
        {
            if (Running)
            {
                throw new InvalidOperationException("Server already running");
            }

            ISLogger.EnableConsole = true;
            this.dependencies      = dependencies;
            ISLogger.Write("Starting server...");
            Running = true;

            try
            {
                clientMan = new ClientManager(16);
                startArgs = args;
                StartUdpHost(args, port);
                StartModules(args, dependencies);
                clientListener = new ISClientListener(port);
                AssignLocalEvents();
                SetDefaultHotkeys();
                clientMan.AddClient(ISServerSocket.Localhost);
                ClientConfig.ReloadClientConfigs(clientMan);
                Started?.Invoke(this, null);
            }
            catch (Exception ex)
            {
                ISLogger.Write("Failed to start server: " + ex.Message);
                Stop();
            }
        }
Ejemplo n.º 2
0
        private void StartModules(StartOptions args, ISServerDependencies dependencies)
        {
            cbManager   = args.HasArg(StartArguments.NoClipboard) ? new NullClipboardManager() : dependencies.ClipboardManager;
            dragDropMan = args.HasArg(StartArguments.NoDragDrop) ? new NullDragDropManager() : dependencies.DragDropManager;
            inputMan    = dependencies.InputManager;
            outMan      = dependencies.OutputManager;
            displayMan  = dependencies.DisplayManager;

            cbController    = new GlobalClipboardController(cbManager, clientMan);
            ddController    = new GlobalDragDropController(dragDropMan, clientMan);
            fileController  = new FileAccessController();
            inputController = new GlobalInputController(clientMan, inputMan, udpHost);

            cbManager.Start();
            dragDropMan.Start();
            inputMan.Start();
            outMan.Start();
            displayMan.Start();
        }