diff --git a/CSVParser/AcceptedCSVFormats.cs b/CSVParser/AcceptedCSVFormats.cs new file mode 100644 index 0000000..2a6bc39 --- /dev/null +++ b/CSVParser/AcceptedCSVFormats.cs @@ -0,0 +1,9 @@ +namespace CSVParser +{ + public enum AcceptedCSVFormats + { + UVRELINING, + BLUELIGHT + + } +} \ No newline at end of file diff --git a/CSVParser/CSVParser.csproj b/CSVParser/CSVParser.csproj index 27cfc6d..0b77404 100644 --- a/CSVParser/CSVParser.csproj +++ b/CSVParser/CSVParser.csproj @@ -42,8 +42,10 @@ + + diff --git a/CSVParser/CsvParserFactory.cs b/CSVParser/CsvParserFactory.cs new file mode 100644 index 0000000..dee5ce2 --- /dev/null +++ b/CSVParser/CsvParserFactory.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using SanShared; + +namespace CSVParser +{ + public static class CsvParserFactory + { + public static IReadCSVData ReadCSVFile(AcceptedCSVFormats csvFormat, string csvFile) + { + switch (csvFormat) + { + case AcceptedCSVFormats.UVRELINING: + return new UVRelining(csvFile); + case AcceptedCSVFormats.BLUELIGHT: + return new BlueLight(csvFile); + default: + throw new ArgumentOutOfRangeException(nameof(csvFormat)); + } + } + } +} diff --git a/SanSystem/UCInliner.cs b/SanSystem/UCInliner.cs index 7ebecfd..cff90c1 100644 --- a/SanSystem/UCInliner.cs +++ b/SanSystem/UCInliner.cs @@ -286,9 +286,10 @@ namespace SanSystem IEnumerable files = Directory.EnumerateFiles(myPath, "*.csv", SearchOption.AllDirectories); - //List struktures = HelpFunktion.ParseCSVFile(files.Last()); - UVRelining uv = new UVRelining(files.Last()); - List struktures = uv.ReadCSVStrukture(); + + IReadCSVData csvFile = null; + csvFile = CsvParserFactory.ReadCSVFile(AcceptedCSVFormats.UVRELINING, files.Last()); + List struktures = csvFile.ReadCSVStrukture(); inliner.AnfangAushaertung = struktures.Select(x => x.Zeitstempel).Min(); inliner.EndeAushaertung = struktures.Select(x => x.Zeitstempel).Max();