public bool SendCommand(Func <IGSCommand> builder) { IGSCommand command = builder.Invoke(); command.ProgramName = _programName; return(_connector.SendCommand(command)); }
private bool TestCommand(IGSCommand gSCommand, string pattern) { string command = gSCommand.GetCommand(); command = RemoveWhitespaces(command); return(Regex.Match(command, pattern).Success); }
/// <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); }
public bool SendCommand(IGSCommand command) { command.ProgramName = _programName; return(_connector.SendCommand(command)); }
private Uri GetCommandUri(IGSCommand command) { return(new Uri($"http://{_config.Address}/{command.Uri}")); }
private StringContent GetCommandContent(IGSCommand command) { return(new StringContent(command.GetCommand(), Encoding.UTF8, "application/json")); }