Exemple #1
0
        public async Task ReadThingNames(BufferBlock <string> queueToWrite, string storageName)
        {
            if (string.IsNullOrEmpty(storageName))
            {
                return;
            }

            try
            {
                if (storageName.EndsWith(".csv"))
                {
                    await _fileReaderAsync.ReadCsvFile(queueToWrite, storageName);
                }
                else
                {
                    await _fileReaderAsync.ReadFile(queueToWrite, storageName);
                }
            }
            catch (Exception ex)
            {
                _logger.Error(ex, "Async file reader throws exception.");
                throw;
            }
        }
        public IEnumerable <string> ReadThingNames(string storageName)
        {
            if (string.IsNullOrEmpty(storageName))
            {
                return(Enumerable.Empty <string>());
            }

            try
            {
                if (storageName.EndsWith(".csv"))
                {
                    return(_fileReaderAsync.ReadCsvFile(storageName));
                }
                else
                {
                    return(_fileReaderAsync.ReadFile(storageName));
                }
            }
            catch (Exception ex)
            {
                _logger.Error(ex, "Async file reader throws exception.");
                throw;
            }
        }