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);
}
/// <summary> /// Adds completed hash item to mylist. /// </summary> private void FinishHash(HashItem item) { ppSize += item.Size; if (item.FromMPC) { m_aniDBAPI.MyListAdd(item); if (ConfigFile.Read("mpcShowOSD").ToBoolean() && m_mpcAPI != null && m_mpcAPI.isHooked) { m_mpcAPI.OSDShowMessage(String.Format("{0}: File marked as watched{1}", m_AppName, m_mpcAPI.CurrentFileName != item.Name ? String.Format(", ({0})", item.Name) : String.Empty)); } } else if (addToMyListCheckBox.IsChecked == true) { item.Watched = (bool)watchedCheckBox.IsChecked; item.State = stateComboBox.SelectedIndex; m_aniDBAPI.MyListAdd(item); } }