Ejemplo n.º 1
0
 public void SetExitHandler(ExitHandler handler, IntPtr args)
 {
     _setExitHandlerFunction.Delegate(InstancePointer, handler, args);
 }
Ejemplo n.º 2
0
 public void SetExitHandler(ExitHandler handler, IntPtr args)
 {
     _setExitHandlerFunction.Delegate(InstancePointer, handler, args);
 }
Ejemplo n.º 3
0
 private static extern bool SetConsoleCtrlHandler(ExitHandler handler, bool add);
Ejemplo n.º 4
0
        internal LanguageServer(
            Stream input,
            Stream output,
            ILspReciever reciever,
            IRequestProcessIdentifier requestProcessIdentifier,
            ILoggerFactory loggerFactory,
            ISerializer serializer,
            IServiceCollection services,
            IEnumerable <Assembly> assemblies,
            IEnumerable <InitializeDelegate> initializeDelegates,
            IEnumerable <InitializedDelegate> initializedDelegates)
        {
            var outputHandler = new OutputHandler(output, serializer);

            services.AddLogging();
            _reciever              = reciever;
            _serializer            = serializer;
            _supportedCapabilities = new SupportedCapabilities();
            _collection            = new HandlerCollection(_supportedCapabilities);
            _initializeDelegates   = initializeDelegates;
            _initializedDelegates  = initializedDelegates;

            services.AddSingleton <IOutputHandler>(outputHandler);
            services.AddSingleton(_collection);
            services.AddSingleton(_serializer);
            services.AddSingleton <OmniSharp.Extensions.JsonRpc.ISerializer>(_serializer);
            services.AddSingleton(requestProcessIdentifier);
            services.AddSingleton <OmniSharp.Extensions.JsonRpc.IReciever>(reciever);
            services.AddSingleton <ILspReciever>(reciever);
            services.AddSingleton(loggerFactory);

            services.AddJsonRpcMediatR(assemblies);
            services.AddTransient <IHandlerMatcher, TextDocumentMatcher>();
            services.AddSingleton <Protocol.Server.ILanguageServer>(this);
            services.AddSingleton <ILanguageServer>(this);
            services.AddTransient <IHandlerMatcher, ExecuteCommandMatcher>();
            services.AddTransient <IHandlerMatcher, ResolveCommandMatcher>();
            services.AddSingleton <ILspRequestRouter, LspRequestRouter>();
            services.AddSingleton <IRequestRouter>(_ => _.GetRequiredService <ILspRequestRouter>());
            services.AddSingleton <IResponseRouter, ResponseRouter>();
            services.AddTransient(typeof(IPipelineBehavior <,>), typeof(ResolveCommandPipeline <,>));

            var foundHandlers = services
                                .Where(x => typeof(IJsonRpcHandler).IsAssignableFrom(x.ServiceType) && x.ServiceType != typeof(IJsonRpcHandler))
                                .ToArray();

            // Handlers are created at the start and maintained as a singleton
            foreach (var handler in foundHandlers)
            {
                services.Remove(handler);

                if (handler.ImplementationFactory != null)
                {
                    services.Add(ServiceDescriptor.Singleton(typeof(IJsonRpcHandler), handler.ImplementationFactory));
                }
                else if (handler.ImplementationInstance != null)
                {
                    services.Add(ServiceDescriptor.Singleton(typeof(IJsonRpcHandler), handler.ImplementationInstance));
                }
                else
                {
                    services.Add(ServiceDescriptor.Singleton(typeof(IJsonRpcHandler), handler.ImplementationType));
                }
            }

            _serviceProvider = services.BuildServiceProvider();

            _requestRouter  = _serviceProvider.GetRequiredService <ILspRequestRouter>();
            _responseRouter = _serviceProvider.GetRequiredService <IResponseRouter>();
            _connection     = ActivatorUtilities.CreateInstance <Connection>(_serviceProvider, input);

            _exitHandler = new ExitHandler(_shutdownHandler);

            _disposable.Add(
                AddHandlers(this, _shutdownHandler, _exitHandler, new CancelRequestHandler(_requestRouter))
                );

            var handlers = _serviceProvider.GetServices <IJsonRpcHandler>().ToArray();

            _collection.Add(handlers);

            Document  = new LanguageServerDocument(_responseRouter);
            Client    = new LanguageServerClient(_responseRouter);
            Window    = new LanguageServerWindow(_responseRouter);
            Workspace = new LanguageServerWorkspace(_responseRouter);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Initializes a new instance of the State class with the specified
        /// number of events it will handle as well as its exit action.
        /// </summary>
        /// <param name="stateID">
        /// The State's ID.
        /// </param>
        /// <param name="exitHandler">
        /// The exit action.
        /// </param>
        public State(int stateIDt, ExitHandler exitHandler)
        {
            this.exitHandler = exitHandler;

            InitializeState(stateID);
        }
Ejemplo n.º 6
0
 /// <summary>
 ///     Called for start the home service node.
 /// </summary>
 internal static void Start()
 {
     AvatarAccountManager.LoadAccounts();
     ExitHandler.Initialize();
     ServiceCore.Start();
 }
Ejemplo n.º 7
0
 /// <summary>
 ///     Called for start the home service node.
 /// </summary>
 internal static void Start()
 {
     ExitHandler.Initialize();
     ServiceCore.Start();
 }
Ejemplo n.º 8
0
 public virtual void OnExit(StateExitEventArgs e)
 {
     ExitHandler?.Invoke(this, e);
 }
Ejemplo n.º 9
0
 private void Start()
 {
     ExitHandler = transform.parent.GetComponent <ExitHandler>();
 }
Ejemplo n.º 10
0
 public OnceJob(ExitHandler exit)
 {
     this.stopWorking = false;
     this.exit        = exit;
 }
Ejemplo n.º 11
0
    public void PrepareExits(DungeonRoom roomObject, ExitHandler exitHandler)
    {
        if (exitHandler == null)
        {
            exitHandler = roomObject.gameObject.GetComponentInChildren<ExitHandler>();

            if (exitHandler == null) { return; }
        }

        exitHandler.transform.parent = roomObject.transform;
        exitHandler.transform.localPosition = Vector2.zero;

        exitHandler.dungeonManager = dungeonManager;
        exitHandler.cameraManager = cameraManager;
        exitHandler.player = player;
    }