Exemplo n.º 1
0
        static void Main(string[] args)
        {
            string input = Console.ReadLine();

            while (!string.IsNullOrEmpty(input))
            {
                LanguageServiceEvent languageEvent = JsonConvert.DeserializeObject <LanguageServiceEvent>(input);

                LanguageServiceEvent response = null;
                switch (languageEvent.Command)
                {
                case "/autocomplete":
                    JToken data = JToken.Parse(Resources.AutoCompleteResponse);
                    response = new LanguageServiceResponse(languageEvent.ClientId, languageEvent.Command)
                    {
                        Body = data
                    };
                    response.Sequence = languageEvent.Sequence;
                    break;

                case "/updatebuffer":
                    response = new LanguageServiceResponse(languageEvent.ClientId, languageEvent.Command)
                    {
                        Body = JObject.FromObject(new { result = true })
                    };
                    response.Sequence = languageEvent.Sequence;
                    break;

                default:
                    break;
                }

                if (response != null)
                {
                    Console.WriteLine(JsonConvert.SerializeObject(response));
                }

                input = Console.ReadLine();
            }
        }
Exemplo n.º 2
0
 public async Task SendEvent(LanguageServiceEvent message)
 {
     await _processManager.Write(JsonConvert.SerializeObject(message));
 }
Exemplo n.º 3
0
 private void OnOutput(LanguageServiceEvent outputEvent)
 {
     _eventManager.Publish(outputEvent);
 }