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;
}
}