format docs, move comments around
This commit is contained in:
parent
3a15e6454d
commit
d8fdf14ec7
@ -12,6 +12,4 @@ namespace BenchtopParser {
|
||||
return tv;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: normalize snake or pascal case
|
||||
}
|
@ -47,22 +47,24 @@ namespace BenchtopParser {
|
||||
public class Configuration {
|
||||
public String? name { get; set; }
|
||||
public String? value { get; set; }
|
||||
public String? type { get; set; }
|
||||
public String? unit { get; set; }
|
||||
|
||||
public String? type { get; set; } //possible values are: a, c, f, i. Which I presume are Array, Characters, Float, Integer
|
||||
|
||||
|
||||
public Configuration(List<String> config, String data) {
|
||||
String[] nameValue = data.Split("=");
|
||||
name = nameValue[0].Trim();
|
||||
value = nameValue[1].Trim();
|
||||
|
||||
unit = config[1].Trim();
|
||||
type = config[2].Trim(); //a, c, f, i
|
||||
type = config[2].Trim();
|
||||
}
|
||||
}
|
||||
|
||||
public class ProgramConfig {
|
||||
public Dictionary<String, Program> programs = new Dictionary<String, Program>();
|
||||
public ProgramConfig (String program_config_value) {
|
||||
public ProgramConfig(String program_config_value) {
|
||||
Program? current = null;
|
||||
|
||||
foreach (var line in program_config_value.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries)) {
|
||||
@ -119,5 +121,5 @@ namespace BenchtopParser {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ namespace BenchtopParser {
|
||||
|
||||
/// Split the string, and clean up whitespace, returns the Name and Value
|
||||
public String[] SplitLine(String line) {
|
||||
return new[] {
|
||||
return new[] {
|
||||
line[..indent].TrimEnd(),
|
||||
line[(indent + 1)..]
|
||||
};
|
||||
@ -23,7 +23,7 @@ namespace BenchtopParser {
|
||||
var restOfLine = line.Substring(endOfCurrentTransducerKey);
|
||||
var additionalSpaces = restOfLine.TakeWhile(c => c == ' ').Count();
|
||||
// length 1 based, remove 1, then add additional spaces
|
||||
this.indent = endOfCurrentTransducerKey - 1 + additionalSpaces;
|
||||
this.indent = endOfCurrentTransducerKey - 1 + additionalSpaces;
|
||||
}
|
||||
|
||||
public TransducerVerify(String transducer_verify_value) {
|
||||
@ -84,6 +84,6 @@ namespace BenchtopParser {
|
||||
public Transducer(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -4,9 +4,9 @@ namespace BenchtopParserTests {
|
||||
|
||||
[SetUp]
|
||||
public void Setup() {
|
||||
program_config_value = File.ReadAllText(
|
||||
Path.Combine(TestContext.CurrentContext.TestDirectory, @"TestFiles\Program Config.txt")
|
||||
);
|
||||
program_config_value = File.ReadAllText(
|
||||
Path.Combine(TestContext.CurrentContext.TestDirectory, @"TestFiles\Program Config.txt")
|
||||
);
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
@ -15,7 +15,6 @@ namespace BenchtopParserTests {
|
||||
Assert.That(tv.transducers[1].name, Is.EqualTo("CTS D34-442 115PSIA"));
|
||||
}
|
||||
|
||||
|
||||
[Test]
|
||||
public void Test_TransducerVerify_Throw_InvalidProgram() {
|
||||
Exception ex = Assert.Throws<Exception>(delegate { BenchtopParser.I28.Load_TransducerVerify("broken"); });
|
||||
|
Loading…
Reference in New Issue
Block a user