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;
}
}
}