From 44141e37e5e7483accf6d810445c3f6b2be71865 Mon Sep 17 00:00:00 2001 From: Husky Date: Mon, 22 Jul 2019 20:12:35 +0200 Subject: [PATCH] =?UTF-8?q?Kleine=20=C3=A4nderungen=20durchgef=C3=BChrt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CSVParser/BlueLight.cs | 7 +++++-- CSVParser/CSVParser.cs | 2 +- SanSystem/UCInliner.cs | 17 +++++++++++++---- 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/CSVParser/BlueLight.cs b/CSVParser/BlueLight.cs index 49355ac..5df45a6 100644 --- a/CSVParser/BlueLight.cs +++ b/CSVParser/BlueLight.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -21,6 +22,7 @@ namespace CSVParser double druck; int geschwindigkeit; + foreach (string partial in Input) { UVcsvStrukture strukture = new UVcsvStrukture(); @@ -28,8 +30,8 @@ namespace CSVParser string datum = parts[1]; string uhrzeit = parts[2]; - - if(!DateTime.TryParse(datum + " "+uhrzeit,out zeit)) + + if (!DateTime.TryParse(datum + " " + uhrzeit, out zeit)) throw new Exception("Konnte die datum uhrzeit nicht konventieren"); double.TryParse(parts[3].Replace('.', ','), out temperatur); @@ -44,6 +46,7 @@ namespace CSVParser result.Add(strukture); } return result; + } } } diff --git a/CSVParser/CSVParser.cs b/CSVParser/CSVParser.cs index 2810e9d..1ff6b78 100644 --- a/CSVParser/CSVParser.cs +++ b/CSVParser/CSVParser.cs @@ -19,7 +19,7 @@ namespace CSVParser { get { - if (!File.Exists(csvFile)) return null; + if (!File.Exists(csvFile)) throw new FileNotFoundException(csvFile); return File.ReadAllLines(csvFile); } } diff --git a/SanSystem/UCInliner.cs b/SanSystem/UCInliner.cs index 026ea15..d710bc2 100644 --- a/SanSystem/UCInliner.cs +++ b/SanSystem/UCInliner.cs @@ -226,12 +226,21 @@ namespace SanSystem IReadCSVData csvFile = null; + List struktures = 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(); + try + { + struktures = csvFile.ReadCSVStrukture(); + inliner.AnfangAushaertung = struktures.Select(x => x.Zeitstempel).Min(); + inliner.EndeAushaertung = struktures.Select(x => x.Zeitstempel).Max(); + } + catch(FileNotFoundException ex) + { + MessageBox.Show(string.Format("Datei {0} wurde nicht gefunden", ex.FileName)); + } + if (struktures == null) + return false; return makeGraphic.GetGraphics(struktures, destinationPath); }