extract Configuration constructor
This commit is contained in:
parent
e071fdb09c
commit
95d49e62fb
@ -13,6 +13,7 @@ namespace BenchtopParser {
|
||||
}
|
||||
configLine.RemoveAt(0); // Remove random hex value
|
||||
configLine.RemoveAt(0); // Remove L column
|
||||
|
||||
if (configLine[0].StartsWith("Start,")) {
|
||||
// initialize programconfig
|
||||
current = new ProgramConfig();
|
||||
@ -38,7 +39,6 @@ namespace BenchtopParser {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
// Skip numbers, keep value
|
||||
var value = config[1];
|
||||
|
||||
@ -46,14 +46,7 @@ namespace BenchtopParser {
|
||||
var data = programnumber_group_data[2];
|
||||
if (data.StartsWith("=")) { continue; /* comment line */ }
|
||||
|
||||
var lineConfig = new Configuration();
|
||||
var nameValue = data.Split("=");
|
||||
|
||||
lineConfig.unit = configLine[1].Trim();
|
||||
lineConfig.type = configLine[2].Trim(); //a, c, f, i
|
||||
|
||||
lineConfig.name = nameValue[0].Trim();
|
||||
lineConfig.value = nameValue[1].Trim();
|
||||
var lineConfig = new Configuration(configLine, data);
|
||||
|
||||
// Deal with this group logic
|
||||
var group = programnumber_group_data[1];
|
||||
|
@ -19,5 +19,15 @@ namespace BenchtopParser {
|
||||
public String? type { get; set; }
|
||||
public String? unit { get; set; }
|
||||
|
||||
public Configuration(List<String> config, string data) {
|
||||
var nameValue = data.Split("=");
|
||||
name = nameValue[0].Trim();
|
||||
value = nameValue[1].Trim();
|
||||
|
||||
unit = config[1].Trim();
|
||||
type = config[2].Trim(); //a, c, f, i
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user