feat: 重构项目结构,添加 WPF 应用

- 将核心功能提取到 WCTDataMiner.Core 类库
- 添加 WCTDataMiner.Wpf 桌面应用
- 支持数据解析、导出、统计等功能

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
ssss
2026-07-03 10:47:27 +08:00
parent 3dcd9f7c0b
commit d1a89cb86a
55 changed files with 659 additions and 87 deletions

View File

@@ -0,0 +1,62 @@
using System.Text.RegularExpressions;
using WCTDataMiner.Core.Models;
namespace WCTDataMiner.Core.Parsers;
/// <summary>
/// Ploss FOD日志解析器
/// 格式: FOD-> (1) X X X (2) (3) (4) (5) (6) (7) (8) (9) (10) (11) (12) (13)
/// 示例: FOD-> 4 2 1 127 10690 12013 35377 9904 1213 -2882 750 0 0 1 500 1
/// </summary>
public class PlossParser : IParser<PlossRecord>
{
// 格式说明有3个X忽略字段正则需要3个 \d+ 来匹配
private static readonly Regex PlossPattern = new(
@"^FOD->\s+(\d+)\s+\d+\s+\d+\s+\d+\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(-?\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)$",
RegexOptions.Compiled
);
public bool CanParse(string line) => PlossPattern.IsMatch(line);
public ParseResult<PlossRecord> Parse(string line, Guid scenarioId)
{
var match = PlossPattern.Match(line);
if (!match.Success)
{
return ParseResult<PlossRecord>.Failure(
"FORMAT_MISMATCH",
"Line does not match Ploss pattern"
);
}
try
{
var record = new PlossRecord
{
ScenarioId = scenarioId,
RxType = byte.Parse(match.Groups[1].Value),
RxPower = int.Parse(match.Groups[2].Value),
TxPower = int.Parse(match.Groups[3].Value),
Vcoil = int.Parse(match.Groups[4].Value),
Vin = int.Parse(match.Groups[5].Value),
Isns = int.Parse(match.Groups[6].Value),
Ploss = int.Parse(match.Groups[7].Value),
Threshold = int.Parse(match.Groups[8].Value),
TriggerCount = int.Parse(match.Groups[9].Value),
FodResult = int.Parse(match.Groups[10].Value),
ProtocolType = byte.Parse(match.Groups[11].Value),
PwmDuty = int.Parse(match.Groups[12].Value),
CoilIndex = byte.Parse(match.Groups[13].Value)
};
return ParseResult<PlossRecord>.Success(record);
}
catch (Exception ex)
{
return ParseResult<PlossRecord>.Failure(
"TYPE_CONVERSION",
$"Failed to convert field: {ex.Message}"
);
}
}
}