コード例 #1
0
        public void Finalizer(int reason = 0)
        {
            logger_?.Trace("Enter Finalizer");
            try
            {
                tokenSource_?.Cancel();
                lock (context_)
                {
                    FinalizeContext();
                }
                UIThread.Finalizer();
            }
            catch (Exception e)
            {
                HmOutputPane.OutputW(Hidemaru.Hidemaru_GetCurrentWindowHandle(), e.ToString());
                logger_?.Error(e.ToString());
            }

            diagnosticsTask_ = null;
            hoverTask_       = null;
            didChangeTask_   = null;

            dasmr_      = null;
            openedFile_ = null;

            /*tokenSource_ = null;
             * context_ = null;*/

            iniFile_ = null;

            logger_?.Trace("Leave Finalizer");
            logger_ = null;

            GC.Collect();
        }
コード例 #2
0
        bool InitializeFrontEndServiceMain(string fileExtension, string currentSourceCodeDirectory)
        {
            if (!Directory.Exists(currentSourceCodeDirectory))
            {
                logger_.Error($"Directory not Found: currentSourceCodeDirectory={currentSourceCodeDirectory}");
                return(false);
            }
            var serverConfigFilename = iniFile_.FindServerConfig(fileExtension);

            if (string.IsNullOrEmpty(serverConfigFilename))
            {
                return(false);
            }
            if (!File.Exists(serverConfigFilename))
            {
                logger_.Error($"File not found. serverConfigFilename={serverConfigFilename}");
                return(false);
            }
            lock (context_)
            {
                if (!CreateWorkerMain(serverConfigFilename, currentSourceCodeDirectory))
                {
                    return(false);
                }
                UIThread.Invoke((MethodInvoker) delegate
                {
                    if (diagnosticsTask_ == null)
                    {
                        diagnosticsTask_ = new DiagnosticsTask(context_.worker, logger_, tokenSource_.Token);
                    }
                    const sbyte False = 0;
                    if ((hoverTask_ == null) && (context_.worker.ServerCapabilities.HoverProvider != False))
                    {
                        hoverTask_ = new HoverTask(this, context_.worker, logger_, tokenSource_.Token);
                    }
                    if (didChangeTask_ == null)
                    {
                        didChangeTask_ = new DidChangeTask(this, logger_, tokenSource_.Token);
                    }
                });
            }
            return(true);
        }