feat: 重构项目结构,添加 WPF 应用
- 将核心功能提取到 WCTDataMiner.Core 类库 - 添加 WCTDataMiner.Wpf 桌面应用 - 支持数据解析、导出、统计等功能 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
36
src/WCTDataMiner.Core/Parsers/IParser.cs
Normal file
36
src/WCTDataMiner.Core/Parsers/IParser.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
namespace WCTDataMiner.Core.Parsers;
|
||||
|
||||
/// <summary>
|
||||
/// 通用解析器接口
|
||||
/// </summary>
|
||||
public interface IParser<TRecord>
|
||||
{
|
||||
/// <summary>
|
||||
/// 判断是否可以解析该行
|
||||
/// </summary>
|
||||
bool CanParse(string line);
|
||||
|
||||
/// <summary>
|
||||
/// 解析日志行
|
||||
/// </summary>
|
||||
/// <param name="line">日志行内容</param>
|
||||
/// <param name="scenarioId">关联的测试场景ID</param>
|
||||
ParseResult<TRecord> Parse(string line, Guid scenarioId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 解析结果
|
||||
/// </summary>
|
||||
public record ParseResult<TRecord>
|
||||
{
|
||||
public bool IsSuccess { get; init; }
|
||||
public TRecord? Record { get; init; }
|
||||
public string? ErrorType { get; init; }
|
||||
public string? ErrorMessage { get; init; }
|
||||
|
||||
public static ParseResult<TRecord> Success(TRecord record) =>
|
||||
new() { IsSuccess = true, Record = record };
|
||||
|
||||
public static ParseResult<TRecord> Failure(string errorType, string errorMessage) =>
|
||||
new() { IsSuccess = false, ErrorType = errorType, ErrorMessage = errorMessage };
|
||||
}
|
||||
Reference in New Issue
Block a user