Пример #1
0
        private void Initialize()
        {
            fileIndex      = -1;
            fileDistance   = -1;
            status         = Status.STOPPED;
            IsSubsExternal = false;

            try
            {
                if (vDecoder != null)
                {
                    vDecoder.Abort();
                }
                if (aDecoder != null)
                {
                    aDecoder.Abort();
                }
                if (sDecoder != null)
                {
                    sDecoder.Abort();
                }
                Thread.Sleep(40);
                if (torrent != null)
                {
                    torrent.Dispose(); torrent = null;
                }
            }
            catch (Exception) { }
        }
Пример #2
0
        private void BitSwarm_StatusChanged(object source, BitSwarm.StatusChangedArgs e)
        {
            if (InvokeRequired)
            {
                BeginInvoke(new Action(() => BitSwarm_StatusChanged(this, e)));
                return;
            }

            button1.Text = "Start";

            if (e.Status == 0)
            {
                string fileName = "";
                if (torrent.file.name != null)
                {
                    fileName = torrent.file.name;
                }
                if (torrent != null)
                {
                    torrent.Dispose(); torrent = null;
                }

                output.Text += "\r\n\r\nFinished at " + DateTime.Now.ToString("G", DateTimeFormatInfo.InvariantInfo);
                MessageBox.Show("Downloaded successfully!\r\n" + fileName);
            }
            else
            {
                output.Text += "\r\n\r\nStopped at " + DateTime.Now.ToString("G", DateTimeFormatInfo.InvariantInfo);

                if (e.Status == 2)
                {
                    output.Text += "\r\n\r\n" + "An error occurred :(\r\n\t" + e.ErrorMsg;
                    MessageBox.Show("An error occured :( \r\n" + e.ErrorMsg);
                }
            }

            if (torrent != null)
            {
                torrent.Dispose();
            }
        }
Пример #3
0
        public void Initialize()
        {
            Pause();

            fileIndex     = -1;
            fileIndexNext = -1;
            fileDistance  = -1;
            status        = Status.STOPPED;

            bitSwarm?.Dispose();
            torrent?.Dispose();
            bitSwarm = null;
            torrent  = null;
        }
Пример #4
0
        public void Dispose()
        {
            if (Disposed)
            {
                return;
            }

            Log("Stopped");

            player.decoder.Stop();
            player.decoder.demuxer.ioStream = null;
            bitSwarm?.Dispose();
            Torrent?.Dispose();
            bitSwarm            = null;
            Torrent             = null;
            sortedPaths         = null;
            downloadNextStarted = false;
            Disposed            = true;
        }