Exemplo n.º 1
0
        // Читать пока файл не пуст
        public async Task ReadAsync(Models.File file, int sizeBufferReader, int sizeBufferWritter)
        {
            Data   data = new Data();
            Stream stream;
            var    buffer = _unityContainer.Resolve <IBuffer>();

            using (var reader = _unityContainer.Resolve <IReader>())
            {
                stream = _fileOpen.Open(file);
                reader.InitVariables(stream, sizeBufferReader, sizeBufferWritter);
                while ((data = await reader.ReadAsync()) != null)
                {
                    data.Path = file.Path;
                    await Task.Run(() =>
                    {
                        while (!buffer.TryEnqueue(data))
                        {
                            ;
                        }
                    });
                }
            }
        }
Exemplo n.º 2
0
 public Stream Open(Models.File f)
 {
     return(new FileStream(f.Path, FileMode.Open));
 }