space fixing and switch loop changed a little

This commit is contained in:
atef 2023-12-18 08:14:35 +01:00
parent b13ff6efbe
commit 56d75a3e6c
1 changed files with 9 additions and 10 deletions

View File

@ -74,7 +74,7 @@ public static class Aggregator
} }
} }
private static AggregatedData CreateAverage(string myDirectory,long afterTimestamp,long beforeTimestamp) private static AggregatedData CreateAverage(String myDirectory, Int64 afterTimestamp, Int64 beforeTimestamp)
{ {
// Get all CSV files in the specified directory // Get all CSV files in the specified directory
var csvFiles = Directory.GetFiles(myDirectory, "*.csv"); var csvFiles = Directory.GetFiles(myDirectory, "*.csv");
@ -102,7 +102,6 @@ public static class Aggregator
var line = reader.ReadLine(); var line = reader.ReadLine();
var lines = line?.Split(';'); var lines = line?.Split(';');
// Assuming there are always three columns (variable name and its value) // Assuming there are always three columns (variable name and its value)
if (lines is { Length: 3 }) if (lines is { Length: 3 })
{ {
@ -112,15 +111,15 @@ public static class Aggregator
{ {
switch (variableName) switch (variableName)
{ {
case var _ when variableName is "/Battery/Soc" or "/AvgSoc" : case "/Battery/Soc" or "/AvgSoc":
socAverage.Add(value); socAverage.Add(value);
break; break;
case var _ when variableName is "/PvOnDc/Dc/Power" or "/AvgPvPower": case "/PvOnDc/Dc/Power" or "/AvgPvPower":
pvPowerAverage.Add(value); pvPowerAverage.Add(value);
break; break;
case var _ when variableName is "/Battery/Dc/Power" or "/BatteryPowerAverage": case "/Battery/Dc/Power" or "/BatteryPowerAverage":
batteryPowerAverage.Add(value); batteryPowerAverage.Add(value);
break; break;