public int AddId(string filename)
{
if (filename == null)
throw new ArgumentNullException("filename");
filename = EscapeString(filename);
MpdResponse response = this.getConnection().Exec("add", new string[] { filename });
if (response.IsError)
throw new MpdResponseException(response.ErrorCode, response.ErrorMessage);
if (response.Count != 1)
throw new InvalidMpdResponseException("Returned more than one line for command addid.");
string id = response["Id"];
if (id == null)
throw new InvalidMpdResponseException("Tag Id missing in response to command addid.");
int tryId = -1;
if (!int.TryParse(id, out tryId))
throw new InvalidMpdResponseException("Tag Id in response to command addid does not contain an number.");
return tryId;
}