예제 #1
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);
        }
예제 #2
0
 /// <summary>
 /// BackEndを初期化する(非同期版)
 /// </summary>
 /// <param name="logFilename"></param>
 public void InitializeBackEndServiceAsync()
 {
     var _ = Task.Run(() => {
         try
         {
             if (InitializeBackEndServiceMain())
             {
                 return;
             }
             UIThread.Invoke((MethodInvoker) delegate
             {
                 Finalizer();
             });
         }catch (Exception e)
         {
             HmOutputPane.OutputW(Hidemaru.Hidemaru_GetCurrentWindowHandle(), e.ToString());
             logger_?.Error(e.ToString());
         }
     }, tokenSource_.Token);
 }