Libmpc.MpcConnection.Exec C# (CSharp) Method

Exec() public method

Executes a simple command without arguments on the MPD server and returns the response.
If the command contains a space of a newline charakter.
public Exec ( string command ) : MpdResponse
command string The command to execute.
return MpdResponse
        public MpdResponse Exec(string command)
        {
            if (command == null)
            throw new ArgumentNullException("command");
              if (command.Contains(" "))
            throw new ArgumentException("command contains space");
              if (command.Contains("\n"))
            throw new ArgumentException("command contains newline");

              //if (m_Commands != null && !m_Commands.Contains(command))
              //  return new MpdResponse(new ReadOnlyCollection<string>(new List<string>()));

              try {
            this.CheckConnected();
            m_Mutex.WaitOne();
            m_SocketManager.WriteLine(command);

            MpdResponse res = this.readResponse();
            m_Mutex.ReleaseMutex();
            return res;
              }
              catch (Exception ex) {
            System.Diagnostics.Debug.WriteLine(string.Format("Exec: {0}", ex.Message));
            try {
              this.Disconnect();
            }
            catch (Exception) { }
            return new MpdResponse(new ReadOnlyCollection<string>(new List<string>()));
            //throw;
              }
        }

Same methods

MpcConnection::Exec ( string command, string argument ) : MpdResponse