44 lines
1.3 KiB
C#
44 lines
1.3 KiB
C#
using ConsoleApp2.Helpers;
|
|
using ConsoleApp2.HostedServices.Abstractions;
|
|
using Microsoft.Extensions.Logging;
|
|
using ServiceStack.Text;
|
|
|
|
namespace ConsoleApp2.Services;
|
|
|
|
/// <summary>
|
|
/// 读取Jsv格式文件
|
|
/// </summary>
|
|
[Obsolete]
|
|
public class JsvSource:IDataSource
|
|
{
|
|
private readonly string _inputDir;
|
|
private readonly JsvStringSerializer _jsv;
|
|
private readonly StreamReader _reader;
|
|
// ReSharper disable once PrivateFieldCanBeConvertedToLocalVariable
|
|
private readonly ILogger? _logger;
|
|
private readonly string _tableName;
|
|
|
|
public DataRecord Current { get; protected set; } = null!;
|
|
public string[]? Headers { get; }
|
|
public bool EndOfSource => _reader.EndOfStream;
|
|
|
|
public JsvSource(string inputDir,string tableName, ILogger? logger = null)
|
|
{
|
|
_inputDir = inputDir;
|
|
_tableName = tableName;
|
|
_jsv = new JsvStringSerializer();
|
|
// _reader = new StreamReader(filePath);
|
|
//Headers = headers;
|
|
_logger = logger;
|
|
// _logger?.LogInformation("Reading file: {FilePath}", filePath);
|
|
//_tableName = DumpDataHelper.GetTableName(filePath);
|
|
}
|
|
public async Task DoEnqueue(Action<DataRecord> action)
|
|
{
|
|
}
|
|
|
|
public void Dispose()
|
|
{
|
|
_reader.Dispose();
|
|
}
|
|
} |