Beispiel #1
0
        /// <summary>
        /// Add a new Download to the queue
        /// </summary>
        /// <param name="ircData">The irc command.</param>
        /// <param name="downloadDirectory">The download directory.</param>
        /// <param name="bot">The bot.</param>
        /// <param name="packageNumber">The package number.</param>
        /// <param name="client">The client.</param>
        /// <returns>The created Download.</returns>
        public Download StartDownload(string ircData, string downloadDirectory, string bot, string packageNumber, IrcClient client)
        {
            var download = new Download(ircData, downloadDirectory, bot, packageNumber, client, _tokenSource.Token);

            download.OnDccDebugMessage += (sender, args) => OnDccDebugMessage?.Invoke(sender, args);
            download.OnDccEvent        += (sender, args) => OnDccEvent?.Invoke(sender, args);

            _downloadQueue.TryAdd(download, 0, _tokenSource.Token);

            return(download);
        }
Beispiel #2
0
 /// <summary>
 /// Fires the event with the update about the download currently running
 /// </summary>
 /// <param name="statusin">the current status of the download</param>
 private void UpdateStatus(string statusin)
 {
     Status = statusin;
     OnDccEvent?.Invoke(this, new DCCEventArgs(this));
 }