From fb7574c58b4ee248112fd4b63b7fdd57d43d8ef4 Mon Sep 17 00:00:00 2001
From: Markus Quaritsch <markus.quaritsch@tugraz.at>
Date: Fri, 11 Nov 2016 07:55:12 +0100
Subject: [PATCH] better search for input data plugin

---
 VECTO/GUI/MainForm.resx |  6 ------
 VECTO/GUI/MainForm.vb   | 16 +++++++++++++++-
 2 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/VECTO/GUI/MainForm.resx b/VECTO/GUI/MainForm.resx
index 851f4024a3..1ab95c20be 100644
--- a/VECTO/GUI/MainForm.resx
+++ b/VECTO/GUI/MainForm.resx
@@ -205,9 +205,6 @@
         sDbhv9/4m+ZgnX1wey9Idfa/Y3WQPgGrg/QJWB2kj96I/gcOkiuMy/nVgwAAAABJRU5ErkJggg==
 </value>
   </data>
-  <metadata name="ToolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
-    <value>850, 12</value>
-  </metadata>
   <metadata name="ConMenFilelist.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
     <value>219, 14</value>
   </metadata>
@@ -226,9 +223,6 @@
   <metadata name="CmOpenFile.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
     <value>732, 12</value>
   </metadata>
-  <metadata name="ToolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
-    <value>850, 12</value>
-  </metadata>
   <metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     <value>49</value>
   </metadata>
diff --git a/VECTO/GUI/MainForm.vb b/VECTO/GUI/MainForm.vb
index 7f84390203..2ddc299a2e 100644
--- a/VECTO/GUI/MainForm.vb
+++ b/VECTO/GUI/MainForm.vb
@@ -40,6 +40,7 @@ Imports System.Text
 Imports System.Text.RegularExpressions
 Imports System.Threading
 Imports Microsoft.VisualBasic.FileIO
+Imports TUGraz.VectoCommon.Exceptions
 Imports TUGraz.VectoCommon.InputData
 Imports TUGraz.VectoCommon.Models
 Imports TUGraz.VectoCommon.OutputData
@@ -2014,7 +2015,20 @@ Imports VectoAuxiliaries
 			Return
 		End If
 		Try
-			PluginRegistry.Instance.GetExportPlugin("TUG.IVT.Vecto.XMLExport").ExportJob(JSONInputDataFactory.ReadJsonJob(f))
+			Dim input As IInputDataProvider = Nothing
+			If Path.GetExtension(f) = ".vecto" Then
+				input = JSONInputDataFactory.ReadJsonJob(f)
+			Else
+				For Each plugin As KeyValuePair(Of String, IInputDataPlugin) In PluginRegistry.Instance.GetInputDataPlugins()
+
+					If plugin.Value.CanHandleJob(f) Then
+						input = plugin.Value.ReadVectoJob(f)
+						Exit For
+					End If
+				Next
+			End If
+			If input Is Nothing Then Throw New VectoException("No InputDataProvider for file {0} found!", f)
+			PluginRegistry.Instance.GetExportPlugin("TUG.IVT.Vecto.XMLExport").ExportJob(input)
 		Catch ex As Exception
 			MsgBox("Exporting job failed: " + ex.Message)
 		End Try
-- 
GitLab