Пример #1
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="BaseFilePath"></param>
        /// <param name="BaseUrl"></param>
        /// <param name="InputQueue"></param>
        /// <param name="HashedQueue"></param>
        /// <param name="FinishedQueue"></param>
        /// <param name="ErrorQueue"></param>
        public Worker(
            string BaseFilePath,
            string BaseUrl,
            PatchFileQueue InputQueue,
            PatchFileQueue HashedQueue,
            PatchFileQueue FinishedQueue,
            PatchFileQueue ErrorQueue)
        {
            // keep references
            baseFilePath  = BaseFilePath;
            baseUrl       = BaseUrl;
            queue         = InputQueue;
            queueHashed   = HashedQueue;
            queueFinished = FinishedQueue;
            queueErrors   = ErrorQueue;

            // create sha256 hasher
            sha256 = new Sha256();

            // create webclient for downloads
            webClient = new WebClientGzip();
            webClient.DownloadProgressChanged += OnWebClientDownloadProgressChanged;
            webClient.DownloadFileCompleted   += OnWebClientDownloadFileCompleted;

            // create thread
            thread = new Thread(ThreadProc);
            thread.IsBackground = true;
        }