public void AddTorrent(Torrent torrent)
{
#region Information Contents
/* **Information[0-10] -- Music information**
*
* information[0] --> Artist
* information[1] --> Album
* information[2] --> AlbumType
* information[3] --> bitrate
* information[4] --> year
* information[5] --> physical format (CD,DVD,VINYL,WEB)
* information[6] --> bit format (MP3,FLAC)
*
* **Information[10-20] -- File Information**
*
* information[10] --> path
* information[11] --> file name
* information[12] --> birth
* information[13] --> destination path
* information[14] --> discard
* */
#endregion
try
{
string[] information = torrent.GetInformation();
DataRow row;
row = table.NewRow();
row["File"] = information[11];
row["Artist"] = information[0];
row["Album"] = information[1];
row["Save Structure"] = information[13];
row["Handled"] = false;
row["Error"] = (information[14] == "true") ? true : false;
row["Release Format"] = information[2];
row["Bitrate"] = information[3];
row["Year"] = information[4];
row["Physical Format"] = information[5];
row["Bit Format"] = information[6];
row["File Path"] = information[10];
row["Site Origin"] = (information[14] == "true") ? "Discarded" : information[12];
row["Processed"] = true;
string currentfilename = torrent.GetFileName();
lock (obj)
{
DataRow dr = table.Rows.Find(currentfilename);
if (dr != null)
table.Rows[table.Rows.IndexOf(dr)].Delete();
table.Rows.Add(row);
}
}
catch (Exception e)
{
DirectoryHandler.LogError(e.Message + "\n" + e.StackTrace);
}
}