private void DownloadNext()
        {
            while (true)
            {
                if (_downloadQueue.Count == 0)
                {
                    return;
                }

                DownloadProcess downloadProcess = _downloadQueue.Dequeue();

                if (downloadProcess.HasExited)
                {
                    continue;
                }

                _currentDownloads.Add(downloadProcess);

                void DownloadFinished(object sender, EventArgs e)
                {
                    downloadProcess.Exited -= DownloadFinished;

                    _currentDownloads.Remove(downloadProcess);

                    DownloadNext();
                }

                downloadProcess.Exited += DownloadFinished;

                downloadProcess.Start();

                break;
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="args"></param>
        static void Main(string[] args)
        {
            var process = new DownloadProcess();

            process.SetMessageQueueProvider(new Lemon.Storage.Message.DefaultMessageQueueProvider());

            process.SetBlobClient(new Lemon.Storage.AzureBlobClient(ConfigurationManager.AppSettings["eas:storage"]));

            process.DispatchQueueName = ConfigurationManager.AppSettings["eas:normalize"];

            if (args.Length > 0 && args[0] == "onerror")
            {
                process.Start(ConfigurationManager.AppSettings["eas:onerror"]);
            }
            else
            {
                process.Start(ConfigurationManager.AppSettings["eas:download"]);
            }
        }