CSV factoriy hinzugefügt
This commit is contained in:
9
CSVParser/AcceptedCSVFormats.cs
Normal file
9
CSVParser/AcceptedCSVFormats.cs
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
namespace CSVParser
|
||||||
|
{
|
||||||
|
public enum AcceptedCSVFormats
|
||||||
|
{
|
||||||
|
UVRELINING,
|
||||||
|
BLUELIGHT
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -42,8 +42,10 @@
|
|||||||
<Reference Include="System.Xml" />
|
<Reference Include="System.Xml" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Compile Include="AcceptedCSVFormats.cs" />
|
||||||
<Compile Include="BlueLight.cs" />
|
<Compile Include="BlueLight.cs" />
|
||||||
<Compile Include="CSVParser.cs" />
|
<Compile Include="CSVParser.cs" />
|
||||||
|
<Compile Include="CsvParserFactory.cs" />
|
||||||
<Compile Include="UVRelining.cs" />
|
<Compile Include="UVRelining.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|||||||
25
CSVParser/CsvParserFactory.cs
Normal file
25
CSVParser/CsvParserFactory.cs
Normal file
@@ -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));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -286,9 +286,10 @@ namespace SanSystem
|
|||||||
|
|
||||||
IEnumerable<string> files = Directory.EnumerateFiles(myPath, "*.csv", SearchOption.AllDirectories);
|
IEnumerable<string> files = Directory.EnumerateFiles(myPath, "*.csv", SearchOption.AllDirectories);
|
||||||
|
|
||||||
//List<UVcsvStrukture> struktures = HelpFunktion.ParseCSVFile(files.Last());
|
|
||||||
UVRelining uv = new UVRelining(files.Last());
|
IReadCSVData csvFile = null;
|
||||||
List<UVcsvStrukture> struktures = uv.ReadCSVStrukture();
|
csvFile = CsvParserFactory.ReadCSVFile(AcceptedCSVFormats.UVRELINING, files.Last());
|
||||||
|
List<UVcsvStrukture> struktures = csvFile.ReadCSVStrukture();
|
||||||
|
|
||||||
inliner.AnfangAushaertung = struktures.Select(x => x.Zeitstempel).Min();
|
inliner.AnfangAushaertung = struktures.Select(x => x.Zeitstempel).Min();
|
||||||
inliner.EndeAushaertung = struktures.Select(x => x.Zeitstempel).Max();
|
inliner.EndeAushaertung = struktures.Select(x => x.Zeitstempel).Max();
|
||||||
|
|||||||
Reference in New Issue
Block a user