40 lines
1.3 KiB
C#
40 lines
1.3 KiB
C#
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Linq;
|
|||
|
using System.Text;
|
|||
|
using System.Threading.Tasks;
|
|||
|
|
|||
|
namespace BenchtopParser {
|
|||
|
public class HardwareCalibrationReport {
|
|||
|
public Dictionary<int, Transducer> Transducers = new();
|
|||
|
public int Indent = 45; // Default 26 from seeing files, overridden later in SetIndent for safety
|
|||
|
|
|||
|
/// Split the string, and clean up whitespace, returns the Name and Value
|
|||
|
public string[] SplitLine(string line) {
|
|||
|
return new[] {
|
|||
|
line[..Indent].Trim(),
|
|||
|
line[(Indent)..]
|
|||
|
};
|
|||
|
}
|
|||
|
public void SetIndent(string line) {
|
|||
|
const int endOfCurrentTransducerKey = 10; // "Transducer".Length calculation
|
|||
|
|
|||
|
int leadingSpaces = line.TakeWhile(c => c == ' ').Count();
|
|||
|
string restOfLine = line[(leadingSpaces + endOfCurrentTransducerKey)..];
|
|||
|
int additionalSpaces = restOfLine.TakeWhile(c => c == ' ').Count();
|
|||
|
Indent = leadingSpaces + endOfCurrentTransducerKey + additionalSpaces;
|
|||
|
string endOfLine = line[Indent..];
|
|||
|
Console.Write(endOfLine);
|
|||
|
}
|
|||
|
|
|||
|
public HardwareCalibrationReport()
|
|||
|
{
|
|||
|
|
|||
|
}
|
|||
|
public HardwareCalibrationReport(string fileText)
|
|||
|
{
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
}
|