feat: 实现 FOD 日志数据采集 CLI 应用
This commit is contained in:
@@ -36,10 +36,13 @@
|
||||
|
||||
## 3. 正则表达式
|
||||
|
||||
> **修正说明**:原设计稿正则只有2个忽略字段,实际格式有3个X(忽略字段),已修正。
|
||||
|
||||
```csharp
|
||||
// Parsers/PlossParser.cs
|
||||
// 格式: FOD-> (1) X X X (2) (3) ... (13),其中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+)$",
|
||||
@"^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
|
||||
);
|
||||
```
|
||||
@@ -82,7 +85,7 @@ public class PlossParser : IParser<PlossRecord>
|
||||
|
||||
public bool CanParse(string line) => PlossPattern.IsMatch(line);
|
||||
|
||||
public ParseResult<PlossRecord> Parse(string line, int lineNumber, Guid logFileId)
|
||||
public ParseResult<PlossRecord> Parse(string line, Guid scenarioId)
|
||||
{
|
||||
var match = PlossPattern.Match(line);
|
||||
if (!match.Success)
|
||||
@@ -97,8 +100,7 @@ public class PlossParser : IParser<PlossRecord>
|
||||
{
|
||||
var record = new PlossRecord
|
||||
{
|
||||
LogFileId = logFileId,
|
||||
LineNumber = lineNumber,
|
||||
ScenarioId = scenarioId,
|
||||
RxType = byte.Parse(match.Groups[1].Value),
|
||||
RxPower = short.Parse(match.Groups[2].Value),
|
||||
TxPower = short.Parse(match.Groups[3].Value),
|
||||
|
||||
Reference in New Issue
Block a user