public void SetExitHandler(ExitHandler handler, IntPtr args) { _setExitHandlerFunction.Delegate(InstancePointer, handler, args); }
private static extern bool SetConsoleCtrlHandler(ExitHandler handler, bool add);
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); }
/// <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); }
/// <summary> /// Called for start the home service node. /// </summary> internal static void Start() { AvatarAccountManager.LoadAccounts(); ExitHandler.Initialize(); ServiceCore.Start(); }
/// <summary> /// Called for start the home service node. /// </summary> internal static void Start() { ExitHandler.Initialize(); ServiceCore.Start(); }
public virtual void OnExit(StateExitEventArgs e) { ExitHandler?.Invoke(this, e); }
private void Start() { ExitHandler = transform.parent.GetComponent <ExitHandler>(); }
public OnceJob(ExitHandler exit) { this.stopWorking = false; this.exit = exit; }
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; }