From 579ea3cb8c93dad8fb08cfd0b2febc6100e2b918 Mon Sep 17 00:00:00 2001 From: JenneJ Date: Tue, 8 Dec 2015 10:54:31 +0100 Subject: [PATCH] dont crash on missing controls --- app/BrainpoolXmlParser/BrainpoolXmlParser.exe.config | 6 +++--- app/BrainpoolXmlParser/Config.vb | 7 +++++++ app/BrainpoolXmlParser/Main.vb | 10 +++++++++- app/BrainpoolXmlParser/My Project/AssemblyInfo.vb | 4 ++-- 4 files changed, 21 insertions(+), 6 deletions(-) diff --git a/app/BrainpoolXmlParser/BrainpoolXmlParser.exe.config b/app/BrainpoolXmlParser/BrainpoolXmlParser.exe.config index e9edec4..1c5d5b0 100644 --- a/app/BrainpoolXmlParser/BrainpoolXmlParser.exe.config +++ b/app/BrainpoolXmlParser/BrainpoolXmlParser.exe.config @@ -17,10 +17,10 @@ - - + + - + diff --git a/app/BrainpoolXmlParser/Config.vb b/app/BrainpoolXmlParser/Config.vb index ccd53eb..4cf8006 100644 --- a/app/BrainpoolXmlParser/Config.vb +++ b/app/BrainpoolXmlParser/Config.vb @@ -19,6 +19,13 @@ Public Class AppConfig Return New ConfigValues(username, password, query, connstring, database) End Function + Public Shared Function GetVersion() + Dim assembly As System.Reflection.Assembly = System.Reflection.Assembly.GetExecutingAssembly() + Dim fvi As FileVersionInfo = FileVersionInfo.GetVersionInfo(assembly.Location) + Dim version As String = fvi.FileVersion + Return version + End Function + End Class Public Class ConfigValues diff --git a/app/BrainpoolXmlParser/Main.vb b/app/BrainpoolXmlParser/Main.vb index e50cdce..346fbd3 100644 --- a/app/BrainpoolXmlParser/Main.vb +++ b/app/BrainpoolXmlParser/Main.vb @@ -21,6 +21,7 @@ Module Main Private query As String Private config As ConfigValues + Private version As String Private marks As New List(Of Mark) Private props = New List(Of String) From { "RegistrationOfficeCode", @@ -46,8 +47,9 @@ Module Main logger = LogManager.GetLogger("Main") config = AppConfig.GetConfiguration() db = New DB(config.connstring, "DD_ECM") + version = AppConfig.GetVersion() - logger.Info("{0} started", My.Application.Info.Title) + logger.Info("{0} (Version {1}) started", My.Application.Info.Title, version) If Not Directory.Exists(DataDir) Then Directory.CreateDirectory(DataDir) @@ -118,6 +120,12 @@ Module Main Dim controlId = db.GetControlId(formId, prop) ' Wert für die aktuelle property holen Dim value = db.GetProperty(m, prop) + + If controlId = 0 Then + logger.Warn("Value NOT inserted - ControlId for Property {0} could not be found.") + Continue For + End If + ' Wert einfügen db.InsertValue(controlId, recordId, value) diff --git a/app/BrainpoolXmlParser/My Project/AssemblyInfo.vb b/app/BrainpoolXmlParser/My Project/AssemblyInfo.vb index 9b8883a..3981740 100644 --- a/app/BrainpoolXmlParser/My Project/AssemblyInfo.vb +++ b/app/BrainpoolXmlParser/My Project/AssemblyInfo.vb @@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices ' übernehmen, indem Sie "*" eingeben: ' - - + +