CVS struktur erweitert

This commit is contained in:
Husky
2019-05-31 16:23:05 +02:00
parent 64d5932bde
commit 0c7724e5b7
10 changed files with 239 additions and 3 deletions

21
CSVParser/BlueLight.cs Normal file
View File

@@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SanShared;
namespace CSVParser
{
public class BlueLight : CSVParser
{
public BlueLight(string csvFile) : base(csvFile)
{
}
public override List<UVcsvStrukture> ReadCSVStrukture()
{
return null;
}
}
}

28
CSVParser/CSVParser.cs Normal file
View File

@@ -0,0 +1,28 @@
using SanShared;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CSVParser
{
public abstract class CSVParser : IReadCSVData
{
private string csvFile;
public CSVParser(string csvFile)
{
this.csvFile = csvFile;
}
public virtual string[] Input
{
get
{
if (!File.Exists(csvFile)) return null;
return File.ReadAllLines(csvFile);
}
}
public abstract List<UVcsvStrukture> ReadCSVStrukture();
}
}

View File

@@ -0,0 +1,56 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{3F79BD28-9BF6-4902-8977-41E9E71F8488}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>CSVParser</RootNamespace>
<AssemblyName>CSVParser</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="BlueLight.cs" />
<Compile Include="CSVParser.cs" />
<Compile Include="UVRelining.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\SanShared\SanShared.csproj">
<Project>{C949087E-20E1-4A17-B021-FAEAD363C1D8}</Project>
<Name>SanShared</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// Allgemeine Informationen über eine Assembly werden über die folgenden
// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
// die einer Assembly zugeordnet sind.
[assembly: AssemblyTitle("CSVParser")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("CSVParser")]
[assembly: AssemblyCopyright("Copyright © 2019")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Durch Festlegen von ComVisible auf FALSE werden die Typen in dieser Assembly
// für COM-Komponenten unsichtbar. Wenn Sie auf einen Typ in dieser Assembly von
// COM aus zugreifen müssen, sollten Sie das ComVisible-Attribut für diesen Typ auf "True" festlegen.
[assembly: ComVisible(false)]
// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird
[assembly: Guid("3f79bd28-9bf6-4902-8977-41e9e71f8488")]
// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten:
//
// Hauptversion
// Nebenversion
// Buildnummer
// Revision
//
// Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden,
// indem Sie "*" wie unten gezeigt eingeben:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

56
CSVParser/UVRelining.cs Normal file
View File

@@ -0,0 +1,56 @@
using SanShared;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CSVParser
{
public class UVRelining : CSVParser
{
public UVRelining(string csvFile) : base(csvFile)
{
}
/// <summary>
///
/// </summary>
/// <param name="csvFile"></param>
/// <returns></returns>
public override List<UVcsvStrukture> ReadCSVStrukture()
{
/*
* Die Geschwindigkeit wird in cm / sekunde angegeben
*/
List<UVcsvStrukture> result = new List<UVcsvStrukture>();
DateTime zeit;
double temperatur;
double druck;
int geschwindigkeit;
foreach (string pars in Input)
{
UVcsvStrukture uVcsvStrukture = new UVcsvStrukture();
string[] parts = pars.Split(',');
if (
parts[0].Equals("Group1") ||
parts[1].Equals("(END)") ||
parts[1].Equals("(START)")
) continue;
DateTime.TryParse(parts[0], out zeit);
double.TryParse(parts[1].Replace('.', ','), out temperatur);
double.TryParse(parts[2].Replace('.', ','), out druck);
int.TryParse(parts[3], out geschwindigkeit);
uVcsvStrukture.Zeitstempel = zeit;
uVcsvStrukture.Druck = druck;
uVcsvStrukture.Temperatur = temperatur;
uVcsvStrukture.Geschwindigkeit = geschwindigkeit;
result.Add(uVcsvStrukture);
}
return result;
}
}
}

24
SanShared/IReadCSVData.cs Normal file
View File

@@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SanShared
{
/// <summary>
///
/// </summary>
public interface IReadCSVData
{
/// <summary>
///
/// </summary>
/// <returns></returns>
List<UVcsvStrukture> ReadCSVStrukture();
/// <summary>
///
/// </summary>
string[] Input { get; }
}
}

View File

@@ -48,6 +48,7 @@
<Compile Include="ILanguage.cs" />
<Compile Include="IMakeProtokol.cs" />
<Compile Include="IProjekt.cs" />
<Compile Include="IReadCSVData.cs" />
<Compile Include="ITemperature.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="UVcsvStrukture.cs" />

View File

@@ -30,6 +30,6 @@ namespace SanShared
/// <summary>
/// Geschwindigkeit vom Eintrag
/// </summary>
public double Geschwindigkeit { get => geschwindigkeit; set => geschwindigkeit = value; }
public int Geschwindigkeit { get => geschwindigkeit; set => geschwindigkeit = value; }
}
}

View File

@@ -300,4 +300,12 @@
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PreBuildEvent>
</PreBuildEvent>
</PropertyGroup>
<PropertyGroup>
<PostBuildEvent>
</PostBuildEvent>
</PropertyGroup>
</Project>

View File

@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.27130.2026
# Visual Studio Version 16
VisualStudioVersion = 16.0.28803.156
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SanSystem", "SanSystem\SanSystem.csproj", "{C6546A88-8830-4EF2-B99C-B9183171F6EF}"
EndProject
@@ -27,6 +27,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BerichtGen", "BerichtGen\Be
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SchnittstelleImporterTests", "SchnittstelleImporterTests\SchnittstelleImporterTests.csproj", "{9264791A-9D57-4133-BE47-75721057DBBB}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CSVParser", "CSVParser\CSVParser.csproj", "{3F79BD28-9BF6-4902-8977-41E9E71F8488}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -77,6 +79,10 @@ Global
{9264791A-9D57-4133-BE47-75721057DBBB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9264791A-9D57-4133-BE47-75721057DBBB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9264791A-9D57-4133-BE47-75721057DBBB}.Release|Any CPU.Build.0 = Release|Any CPU
{3F79BD28-9BF6-4902-8977-41E9E71F8488}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3F79BD28-9BF6-4902-8977-41E9E71F8488}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3F79BD28-9BF6-4902-8977-41E9E71F8488}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3F79BD28-9BF6-4902-8977-41E9E71F8488}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE