MES-ETL/ConsoleApp2/Services/JsvSource.cs

44 lines
1.3 KiB
C#
Raw Normal View History

2024-01-04 09:00:44 +08:00
using ConsoleApp2.Helpers;
2024-01-12 16:50:37 +08:00
using ConsoleApp2.HostedServices.Abstractions;
2023-12-28 15:18:03 +08:00
using Microsoft.Extensions.Logging;
using ServiceStack.Text;
2023-12-29 16:16:05 +08:00
namespace ConsoleApp2.Services;
2023-12-28 15:18:03 +08:00
2024-01-04 09:00:44 +08:00
/// <summary>
/// 读取Jsv格式文件
/// </summary>
[Obsolete]
2024-01-12 16:50:37 +08:00
public class JsvSource:IDataSource
2023-12-28 15:18:03 +08:00
{
2024-01-12 16:50:37 +08:00
private readonly string _inputDir;
2023-12-28 15:18:03 +08:00
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;
2024-01-12 16:50:37 +08:00
public JsvSource(string inputDir,string tableName, ILogger? logger = null)
2023-12-28 15:18:03 +08:00
{
2024-01-12 16:50:37 +08:00
_inputDir = inputDir;
_tableName = tableName;
2023-12-28 15:18:03 +08:00
_jsv = new JsvStringSerializer();
2024-01-12 16:50:37 +08:00
// _reader = new StreamReader(filePath);
//Headers = headers;
2023-12-28 15:18:03 +08:00
_logger = logger;
// _logger?.LogInformation("Reading file: {FilePath}", filePath);
2024-01-12 16:50:37 +08:00
//_tableName = DumpDataHelper.GetTableName(filePath);
2023-12-28 15:18:03 +08:00
}
2024-01-12 16:50:37 +08:00
public async Task DoEnqueue(Action<DataRecord> action)
2023-12-28 15:18:03 +08:00
{
}
2024-01-12 16:50:37 +08:00
public void Dispose()
2023-12-28 15:18:03 +08:00
{
_reader.Dispose();
}
}