public void MyListAdd(HashItem item)
{
Action addToList = new Action(delegate
{
string r_msg = String.Empty;
APIResponse response = Execute(String.Format("MYLISTADD size={0}&ed2k={1}&viewed={2}&state={3}&edit={4}",
item.Size, item.Hash, Convert.ToInt32(item.Watched), item.State, Convert.ToInt32(item.Edit)));
switch (response.Code)
{
case RETURN_CODE.MYLIST_ENTRY_ADDED:
File(item);
r_msg = String.Format("Added {0} to mylist", item.Name);
break;
case RETURN_CODE.MYLIST_ENTRY_EDITED:
File(item);
r_msg = String.Format("Edited mylist entry for {0}", item.Name);
break;
case RETURN_CODE.FILE_ALREADY_IN_MYLIST: // TODO: add auto edit to options.
item.Edit = true;
MyListAdd(item);
return;
case RETURN_CODE.NO_SUCH_FILE:
r_msg = "Error! File not in database";
break;
}
AppendDebugLine(r_msg);
});
PrioritizedCommand(addToList);
}