コード例 #1
0
        private async Task InputDataAsync()
        {
            var font = await Font.LoadFromFileAsync(_fontFilePath);

            using var reader = File.OpenText(_inputFilePath);
            while (!reader.EndOfStream)
            {
                var line = await reader.ReadLineAsync();

                var ascii = new AsciiLine(font, line);
                _output.AppendLine(ascii.ToString());
            }

            Status = PipelineStepStatus.Complited;
            ;
        }
コード例 #2
0
        private async Task ConvertDataAsync()
        {
            var font = await Font.LoadFromFileAsync(_fontFilePath);

            var isStatusPreviousStepComplited = false;

            while (true)
            {
                isStatusPreviousStepComplited = GetStatusPreviousStep(isStatusPreviousStepComplited);
                if (!_inputQueue.TryDequeue(out var result) && isStatusPreviousStepComplited)
                {
                    break;
                }
                if (result == null)
                {
                    continue;
                }
                var ascii = new AsciiLine(font, result.Data);
                _outputQueue.Enqueue(result.Position, ascii.ToString());
            }

            Status = PipelineStepStatus.Complited;
        }