Exemplo n.º 1
0
        void OnTorrentReady(object sender, ReadyTorrentsEventArgs e)
        {
            HashSet <string> copySet = null;

            if (!string.IsNullOrWhiteSpace(this.Settings.CopyToPattern) && this.Settings.uTorrentAutoCopy)
            {
                copySet = new HashSet <string>();
                copySet.Add(this.Settings.CopyToPattern);
            }

            HashSet <string> moveSet = null;

            if (!string.IsNullOrWhiteSpace(this.Settings.MoveToPattern) && Settings.uTorrentAutoMove)
            {
                moveSet = new HashSet <string>();
                moveSet.Add(Settings.Default.MoveToPattern);
            }

            var scheduleForStopSeeding = this.Settings.uTorrentAutoMove && this.Settings.uTorrentAutoStopSeeding;

            foreach (var tf in e.TorrentFiles)
            {
                try
                {
                    this.OpenFileSystemItems(tf.LocalFileInfo.FullName, copySet, moveSet);

                    if (scheduleForStopSeeding)
                    {
                        tf.Remove();
                    }
                }
                catch (Exception ex)
                {
                    Trace.Write(ex.Message);
                }
            }
        }
Exemplo n.º 2
0
        void OnTorrentReady(object sender, ReadyTorrentsEventArgs e)
        {
            HashSet<string> copySet = null;
            if (!string.IsNullOrWhiteSpace(this.Settings.CopyToPattern) && this.Settings.uTorrentAutoCopy)
            {
                copySet = new HashSet<string>();
                copySet.Add(this.Settings.CopyToPattern);
            }

            HashSet<string> moveSet = null;
            if (!string.IsNullOrWhiteSpace(this.Settings.MoveToPattern) && Settings.uTorrentAutoMove)
            {
                moveSet = new HashSet<string>();
                moveSet.Add(Settings.Default.MoveToPattern);
            }

            var scheduleForStopSeeding = this.Settings.uTorrentAutoMove && this.Settings.uTorrentAutoStopSeeding;

            foreach (var tf in e.TorrentFiles)
            {
                try
                {
                    this.OpenFileSystemItems(tf.LocalFileInfo.FullName, copySet, moveSet);

                    if (scheduleForStopSeeding)
                    {
                        tf.Remove();
                    }
                }
                catch (Exception ex)
                {
                    Trace.Write(ex.Message);
                }
            }
        }