Exemple #1
0
        public bool SendCommand(Func <IGSCommand> builder)
        {
            IGSCommand command = builder.Invoke();

            command.ProgramName = _programName;
            return(_connector.SendCommand(command));
        }
Exemple #2
0
        private bool TestCommand(IGSCommand gSCommand, string pattern)
        {
            string command = gSCommand.GetCommand();

            command = RemoveWhitespaces(command);
            return(Regex.Match(command, pattern).Success);
        }
Exemple #3
0
        /// <returns>IsSended</returns>
        internal bool SendCommand(IGSCommand command)
        {
            Uri                 commandUri    = GetCommandUri(command);
            StringContent       stringContent = GetCommandContent(command);
            HttpResponseMessage result        = _httpClient.PostAsync(commandUri, stringContent).Result;

            if (result.StatusCode == HttpStatusCode.OK)
            {
                return(true);
            }

            LastResult = result.Content.ReadAsStringAsync().Result;

            return(false);
        }
Exemple #4
0
 public bool SendCommand(IGSCommand command)
 {
     command.ProgramName = _programName;
     return(_connector.SendCommand(command));
 }
Exemple #5
0
 private Uri GetCommandUri(IGSCommand command)
 {
     return(new Uri($"http://{_config.Address}/{command.Uri}"));
 }
Exemple #6
0
 private StringContent GetCommandContent(IGSCommand command)
 {
     return(new StringContent(command.GetCommand(), Encoding.UTF8, "application/json"));
 }