示例#1
0
        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

            dataset.TorrentsTableRow row = data.TorrentsTable.NewTorrentsTableRow();
            string[] information = torrent.GetInformation();

            row.BeginEdit();
            row.File = information[11];
            row.Artist = information[0];
            row.Album = information[1];
            row.Save_Structure = information[13];
            row.Sent = false;
            row.Release_Format = information[2];
            row.Bit_Rate = 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[12];
            row.EndEdit();

            while (datasetbusy) System.Threading.Thread.Sleep(100);//sleep while changes are occuring..

            DataRow dr = data.TorrentsTable.Rows.Find(row.ID);
            while (dr != null)
            {
                row.ID++;
                dr = data.TorrentsTable.Rows.Find(row.ID);
            }

            data.TorrentsTable.AddTorrentsTableRow(row);
            musicadapter.Update(row);
        }
示例#2
0
        public void AddOtherTorrent(Torrent torrent)
        {
            string[] information = torrent.GetInformation();
            dataset.OthersTableRow row = data.OthersTable.NewOthersTableRow();

            row.File = information[11];
            row.File_Path = information[10];
            row.Save_Structure = information[13];
            row.Site_Origin = information[12];
            row.Sent = false;

            data.OthersTable.AddOthersTableRow(row);
        }