/// <summary> /// Function for read blocks from file and send its to process /// </summary> private void ThreadFunction() { try { WriteHeadersToResult(); while (!_fileSource.IsReadComplete() && _taskQueue.Error == null) { _taskQueue.AddTask(TaskCalcHashSha256.GetInstance()); } _taskQueue.StopQueue(); _taskQueue.WaitComplete(); } catch (Exception ex) { Error = ex; _taskQueue.StopQueue(); } finally { _taskQueue.GetStatistics(out TimeSpan time, out Dictionary <string, long> stat); OnSendCompleted(new SignWorkerCompletedArgs(time, stat, Error, _taskQueue.Error)); } }