From f440e25b9bde78415ab5a6dc11d2f2e6cfa65656 Mon Sep 17 00:00:00 2001 From: Markus Quaritsch <markus.quaritsch@tugraz.at> Date: Tue, 25 Apr 2017 17:12:48 +0200 Subject: [PATCH] adding xml functionality (export json to xml, run xml jobs) to GUI --- .../VectoLegacyTests/VectoLegacyTests.csproj | 3 + VECTO.sln | 11 - VECTO/GUI/MainForm.Designer.vb | 1 - VECTO/GUI/MainForm.resx | 3 + VECTO/GUI/MainForm.vb | 173 ++++++++------- VECTO/GUI/XMLExportJobDialog.Designer.vb | 190 +++++++++++++++++ VECTO/GUI/XMLExportJobDialog.resx | 197 ++++++++++++++++++ VECTO/GUI/XMLExportJobDialog.vb | 79 +++++++ VECTO/GUI/XMLImportJobDialog.Designer.vb | 132 ++++++++++++ VECTO/GUI/XMLImportJobDialog.resx | 197 ++++++++++++++++++ VECTO/GUI/XMLImportJobDialog.vb | 27 +++ VECTO/MainModule.vb | 52 +---- VECTO/VECTO.vbproj | 26 +++ VECTO/app.config | 26 +-- VECTO/packages.config | 2 + .../VectoCommon/InputData/IImportPlugin.cs | 42 ---- .../VectoCommon/InputData/IInputDataPlugin.cs | 48 ----- .../VectoCommon/OutputData/IExportPlugin.cs | 44 ---- .../VectoCommon/Utils/PluginRegistry.cs | 97 --------- VectoCommon/VectoCommon/VectoCommon.csproj | 4 - VectoConsole/Program.cs | 91 ++++---- VectoConsole/VectoConsole.csproj | 1 + VectoCore/VectoCore/VectoCore.csproj | 8 +- 23 files changed, 996 insertions(+), 458 deletions(-) create mode 100644 VECTO/GUI/XMLExportJobDialog.Designer.vb create mode 100644 VECTO/GUI/XMLExportJobDialog.resx create mode 100644 VECTO/GUI/XMLExportJobDialog.vb create mode 100644 VECTO/GUI/XMLImportJobDialog.Designer.vb create mode 100644 VECTO/GUI/XMLImportJobDialog.resx create mode 100644 VECTO/GUI/XMLImportJobDialog.vb delete mode 100644 VectoCommon/VectoCommon/InputData/IImportPlugin.cs delete mode 100644 VectoCommon/VectoCommon/InputData/IInputDataPlugin.cs delete mode 100644 VectoCommon/VectoCommon/OutputData/IExportPlugin.cs delete mode 100644 VectoCommon/VectoCommon/Utils/PluginRegistry.cs diff --git a/Tools/VectoLegacyTests/VectoLegacyTests.csproj b/Tools/VectoLegacyTests/VectoLegacyTests.csproj index 219ddd1c5c..aa3807f1a8 100644 --- a/Tools/VectoLegacyTests/VectoLegacyTests.csproj +++ b/Tools/VectoLegacyTests/VectoLegacyTests.csproj @@ -59,6 +59,9 @@ <Name>VECTO</Name> </ProjectReference> </ItemGroup> + <ItemGroup> + <None Include="app.config" /> + </ItemGroup> <Choose> <When Condition="'$(VisualStudioVersion)' == '10.0' And '$(IsCodedUITest)' == 'True'"> <ItemGroup> diff --git a/VECTO.sln b/VECTO.sln index 17543096ea..5ae950a30c 100644 --- a/VECTO.sln +++ b/VECTO.sln @@ -54,8 +54,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VectoEngineeringAPITest", " EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Excel2XML", "..\VECTO_API\Excel2XML\Excel2XML.csproj", "{749F150A-F974-46DC-A1E2-F4153C54FC0D}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VectoXMLImportExport", "..\VECTO_API\VectoXMLPlugin\VectoXMLImportExport.csproj", "{9958E236-C4C6-49A2-A58D-EF9D646BA3C4}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VectoDB", "..\VECTO_API\VectoDB\VectoDB.csproj", "{2C58BA97-2954-4D19-920F-A24B78FC80A4}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VectoCore BugReportTests", "..\VECTO-Bugreports\BugReportTests\VectoCore BugReportTests.csproj", "{7C364099-9B85-473A-8A42-BBEBE4798FF5}" @@ -222,14 +220,6 @@ Global {749F150A-F974-46DC-A1E2-F4153C54FC0D}.Release|Any CPU.Build.0 = Release|Any CPU {749F150A-F974-46DC-A1E2-F4153C54FC0D}.Release|x64.ActiveCfg = Release|Any CPU {749F150A-F974-46DC-A1E2-F4153C54FC0D}.Release|x86.ActiveCfg = Release|Any CPU - {9958E236-C4C6-49A2-A58D-EF9D646BA3C4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {9958E236-C4C6-49A2-A58D-EF9D646BA3C4}.Debug|Any CPU.Build.0 = Debug|Any CPU - {9958E236-C4C6-49A2-A58D-EF9D646BA3C4}.Debug|x64.ActiveCfg = Debug|Any CPU - {9958E236-C4C6-49A2-A58D-EF9D646BA3C4}.Debug|x86.ActiveCfg = Debug|Any CPU - {9958E236-C4C6-49A2-A58D-EF9D646BA3C4}.Release|Any CPU.ActiveCfg = Release|Any CPU - {9958E236-C4C6-49A2-A58D-EF9D646BA3C4}.Release|Any CPU.Build.0 = Release|Any CPU - {9958E236-C4C6-49A2-A58D-EF9D646BA3C4}.Release|x64.ActiveCfg = Release|Any CPU - {9958E236-C4C6-49A2-A58D-EF9D646BA3C4}.Release|x86.ActiveCfg = Release|Any CPU {2C58BA97-2954-4D19-920F-A24B78FC80A4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {2C58BA97-2954-4D19-920F-A24B78FC80A4}.Debug|Any CPU.Build.0 = Debug|Any CPU {2C58BA97-2954-4D19-920F-A24B78FC80A4}.Debug|x64.ActiveCfg = Debug|Any CPU @@ -266,7 +256,6 @@ Global {41314A40-AB3E-4F43-B1A4-58443F4014F2} = {D29E62A2-CF08-469F-B29F-1B25DCB35386} {35FBDFEF-07E6-4E2C-8C18-4753266A6EDE} = {D29E62A2-CF08-469F-B29F-1B25DCB35386} {749F150A-F974-46DC-A1E2-F4153C54FC0D} = {351FF7E8-B56B-445E-8E98-A61E07C990DA} - {9958E236-C4C6-49A2-A58D-EF9D646BA3C4} = {D29E62A2-CF08-469F-B29F-1B25DCB35386} {2C58BA97-2954-4D19-920F-A24B78FC80A4} = {D29E62A2-CF08-469F-B29F-1B25DCB35386} {7C364099-9B85-473A-8A42-BBEBE4798FF5} = {CC93EA68-F3FE-4BCB-9292-1101F94A4D09} EndGlobalSection diff --git a/VECTO/GUI/MainForm.Designer.vb b/VECTO/GUI/MainForm.Designer.vb index 6d8bfa30a4..6d0a4f34c6 100644 --- a/VECTO/GUI/MainForm.Designer.vb +++ b/VECTO/GUI/MainForm.Designer.vb @@ -227,7 +227,6 @@ Partial Class MainForm Me.btnExportXML.TabIndex = 22 Me.btnExportXML.Text = "Export as XML" Me.btnExportXML.UseVisualStyleBackColor = True - Me.btnExportXML.Visible = False ' 'Label6 ' diff --git a/VECTO/GUI/MainForm.resx b/VECTO/GUI/MainForm.resx index 1ab95c20be..7a10cc6bc7 100644 --- a/VECTO/GUI/MainForm.resx +++ b/VECTO/GUI/MainForm.resx @@ -223,6 +223,9 @@ <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 a158592baf..ee13f693de 100644 --- a/VECTO/GUI/MainForm.vb +++ b/VECTO/GUI/MainForm.vb @@ -39,14 +39,19 @@ Imports TUGraz.VectoCore.InputData.FileIO.JSON Imports System.Text Imports System.Text.RegularExpressions Imports System.Threading +Imports System.Xml +Imports System.Xml.Linq Imports Microsoft.VisualBasic.FileIO Imports TUGraz.VectoCommon.Exceptions Imports TUGraz.VectoCommon.InputData Imports TUGraz.VectoCommon.Models Imports TUGraz.VectoCommon.OutputData Imports TUGraz.VectoCommon.Utils +Imports TUGraz.VectoCore.InputData.FileIO.XML.Declaration +Imports TUGraz.VectoCore.InputData.FileIO.XML.Engineering Imports TUGraz.VectoCore.OutputData Imports TUGraz.VectoCore.OutputData.FileIO +Imports TUGraz.VectoCore.Resources Imports TUGraz.VectoCore.Utils Imports VectoAuxiliaries @@ -55,7 +60,7 @@ Imports VectoAuxiliaries ''' </summary> ''' <remarks></remarks> - Public Class MainForm +Public Class MainForm Private _jobListView As FileListView Private _cycleListView As FileListView @@ -73,7 +78,7 @@ Imports VectoAuxiliaries #Region "SLEEP Control - Prevent sleep while VECTO is running" - Private Declare Function SetThreadExecutionState Lib "kernel32"(esFlags As Long) As Long + Private Declare Function SetThreadExecutionState Lib "kernel32" (esFlags As Long) As Long Private Shared Sub AllowSleepOff() #If Not PLATFORM = "x86" Then @@ -235,8 +240,8 @@ Imports VectoAuxiliaries LoadOptions() 'Resize columns ... after Loading the @file-lists - LvGEN.Columns(1).Width = - 2 - LvMsg.Columns(2).Width = - 2 + LvGEN.Columns(1).Width = -2 + LvMsg.Columns(2).Width = -2 'Initialize BackgroundWorker @@ -252,16 +257,6 @@ Imports VectoAuxiliaries 'Set mode (Batch/Standard) ModeUpdate() - DetectPlugins() - - 'Dim exportPlugins As Dictionary(Of String, String) = PluginRegistry.Instance.GetExportPluginList() - Dim exportPlugin As IExportPlugin = PluginRegistry.Instance.GetExportPlugin("TUG.IVT.Vecto.XMLExport") - btnExportXML.Visible = Not exportPlugin Is Nothing - - - Dim importPlugin As IImportPlugin = PluginRegistry.Instance.GetImportPlugin("TUG.IVT.Vecto.XMLImport") - btnImportXML.Visible = Not importPlugin Is Nothing - #If DEBUG Then Const LicCheck As Boolean = False @@ -527,7 +522,7 @@ Imports VectoAuxiliaries lastindx = LvGEN.SelectedIndices(LvGEN.SelectedItems.Count - 1) - For i = UBound(selIx) To 0 Step - 1 + For i = UBound(selIx) To 0 Step -1 LvGEN.Items.RemoveAt(selIx(i)) Next @@ -552,8 +547,7 @@ Imports VectoAuxiliaries x = New String() {""} Dim extensions As String = "vecto" - Dim inputDataExtensions As String() = - PluginRegistry.Instance.GetKnownInputExtensions().Select(Function(e) e.Substring(1)).ToArray() + Dim inputDataExtensions As String() = New String() {"xml"} If (inputDataExtensions.Any()) Then extensions = String.Join(",", extensions, String.Join(",", inputDataExtensions)) 'STANDARD/BATCH @@ -596,7 +590,7 @@ Imports VectoAuxiliaries Dim p As Integer Dim f As Integer Dim fList As String() - Dim fListDim As Integer = - 1 + Dim fListDim As Integer = -1 Dim listViewItem As ListViewItem 'If VECTO runs: Cancel operation (because Mode-change during calculation is not very clever) @@ -651,7 +645,7 @@ Imports VectoAuxiliaries listViewItem.Selected = True LvGEN.Items.Add(listViewItem) listViewItem.EnsureVisible() - lbFound: +lbFound: Next LvGEN.EndUpdate() @@ -948,7 +942,7 @@ Imports VectoAuxiliaries Status("Launching VECTO ...") JobFileList.Clear() JobFileList.AddRange( - From listViewItem As ListViewItem In LvGEN.CheckedItems.Cast (Of ListViewItem)() + From listViewItem As ListViewItem In LvGEN.CheckedItems.Cast(Of ListViewItem)() Select fFileRepl = FileRepl(listViewItem.SubItems(0).Text)) SetOptions() @@ -989,9 +983,9 @@ Imports VectoAuxiliaries mode = ExecutionMode.Declaration Else mode = ExecutionMode.Engineering - Physics.FuelDensity = Cfg.FuelDens.SI (Of KilogramPerCubicMeter)() _ + Physics.FuelDensity = Cfg.FuelDens.SI(Of KilogramPerCubicMeter)() _ 'New SI(Cfg.FuelDens).Kilo.Gramm.Per.Cubic.Dezi.Meter.Cast(Of KilogramPerCubicMeter)() - Physics.AirDensity = Cfg.AirDensity.SI (Of KilogramPerCubicMeter)() _ + Physics.AirDensity = Cfg.AirDensity.SI(Of KilogramPerCubicMeter)() _ 'New SI(Cfg.AirDensity).Kilo.Gramm.Per.Cubic.Meter.Cast(Of KilogramPerCubicMeter)() Physics.CO2PerFuelWeight = Cfg.Co2PerFc End If @@ -1001,45 +995,44 @@ Imports VectoAuxiliaries 'list of finished runs Dim finishedRuns As List(Of Integer) = New List(Of Integer) - Dim plugins As KeyValuePair(Of String, IInputDataPlugin)() = PluginRegistry.Instance.GetInputDataPlugins().ToArray() For Each jobFile As String In JobFileList Try sender.ReportProgress(0, New VectoProgress With {.Target = "ListBox", .Message = "Reading File " + jobFile, .Link = jobFile}) - If (Path.GetExtension(jobFile) = VectoCore.Configuration.Constants.FileExtensions.VectoJobFile) Then - Dim dataProvider As IInputDataProvider = JSONInputDataFactory.ReadJsonJob(jobFile) - Dim fileWriter As FileOutputWriter = New FileOutputWriter(jobFile) - - Dim runsFactory As SimulatorFactory = New SimulatorFactory(mode, dataProvider, fileWriter) - runsFactory.WriteModalResults = Cfg.ModOut - runsFactory.ModalResults1Hz = Cfg.Mod1Hz + Dim extension As String = Path.GetExtension(jobFile) + Dim input As IInputDataProvider = Nothing + Select Case extension + Case VectoCore.Configuration.Constants.FileExtensions.VectoJobFile + input = JSONInputDataFactory.ReadJsonJob(jobFile) + Case ".xml" + Dim xDocument As XDocument = xDocument.Load(jobFile) + Dim rootNode As String = If(xDocument Is Nothing, "", xDocument.Root.Name.LocalName) + Select Case rootNode + Case XMLNames.VectoInputEngineering + input = New XMLEngineeringInputDataProvider(jobFile, True) + Case XMLNames.VectoInputDeclaration + input = New XMLInputDataProvider(XmlReader.Create(jobFile), True) + End Select + End Select - For Each runId As Integer In jobContainer.AddRuns(runsFactory) - fileWriters.Add(runId, fileWriter) - Next - Else - Dim handled As Boolean = False - For Each entry As KeyValuePair(Of String, IInputDataPlugin) In plugins - If Not handled AndAlso entry.Value.CanHandleJob(jobFile) Then - Dim dataprovider As IInputDataProvider = entry.Value.ReadVectoJob(jobFile) - Dim fileWriter As FileOutputWriter = New FileOutputWriter(jobFile) - - Dim runsFactory As SimulatorFactory = New SimulatorFactory(mode, dataprovider, fileWriter) - runsFactory.WriteModalResults = Cfg.ModOut - runsFactory.ModalResults1Hz = Cfg.Mod1Hz - - For Each runId As Integer In jobContainer.AddRuns(runsFactory) - fileWriters.Add(runId, fileWriter) - Next - handled = True - End If - Next - If Not handled Then - sender.ReportProgress(0, - New VectoProgress With {.Target = "ListBoxError", .Message = "No Input Provider for job: " + jobFile}) - End If + If input Is Nothing Then + sender.ReportProgress(0, + New VectoProgress With {.Target = "ListBoxError", .Message = "No Input Provider for job: " + jobFile}) + Continue For End If + + Dim fileWriter As FileOutputWriter = New FileOutputWriter(jobFile) + + Dim runsFactory As SimulatorFactory = New SimulatorFactory(mode, input, fileWriter) + runsFactory.WriteModalResults = Cfg.ModOut + runsFactory.ModalResults1Hz = Cfg.Mod1Hz + + For Each runId As Integer In jobContainer.AddRuns(runsFactory) + fileWriters.Add(runId, fileWriter) + Next + + sender.ReportProgress(0, New VectoProgress With {.Target = "ListBox", .Message = "Finished Reading Data for job: " + jobFile}) @@ -1076,10 +1069,10 @@ Imports VectoAuxiliaries Dim sumProgress As Double = progress.Sum(Function(pair) pair.Value.Progress) Dim duration As Double = (DateTime.Now() - start).TotalSeconds - sender.ReportProgress(Convert.ToInt32((sumProgress*100.0)/progress.Count), + sender.ReportProgress(Convert.ToInt32((sumProgress * 100.0) / progress.Count), New VectoProgress With {.Target = "Status", .Message = _ - String.Format("Duration: {0:0}s, Current Progress: {1:P} ({2})", duration, sumProgress/progress.Count, + String.Format("Duration: {0:0}s, Current Progress: {1:P} ({2})", duration, sumProgress / progress.Count, String.Join(", ", progress.Select(Function(pair) String.Format("{0,4:P}", pair.Value.Progress))))}) Dim justFinished As Dictionary(Of Integer, JobContainer.ProgressEntry) = @@ -1103,7 +1096,7 @@ Imports VectoAuxiliaries .Message = String.Format("{0,-60} {1,8:P} {2,10:F2}s - {3}", String.Format("{0} {1} {2}", progressEntry.Value.RunName, progressEntry.Value.CycleName, progressEntry.Value.RunSuffix), - progressEntry.Value.Progress, progressEntry.Value.ExecTime/1000.0, + progressEntry.Value.Progress, progressEntry.Value.ExecTime / 1000.0, IIf(progressEntry.Value.Success, "Success", "Aborted"))}) If (Not progressEntry.Value.Success) Then sender.ReportProgress(100, @@ -1397,9 +1390,9 @@ Imports VectoAuxiliaries ToolStripProgBarJob.Value = .ProgJobInt - If .ProgOverallStartInt > - 1 Then + If .ProgOverallStartInt > -1 Then ToolStripProgBarOverall.Value = - CInt(.ProgOverallStartInt + (.PgroOverallEndInt - .ProgOverallStartInt)*.ProgJobInt/100) + CInt(.ProgOverallStartInt + (.PgroOverallEndInt - .ProgOverallStartInt) * .ProgJobInt / 100) End If End With @@ -1716,7 +1709,7 @@ Imports VectoAuxiliaries _mainForm.LvMsg.Items.Insert(RowLim - 4, Space(ColLim - 30) & " " & Space(10) & "*| |*") End Select Exit Sub - LbRace: +LbRace: _pRbAlt = Not _pRbAlt @@ -1744,17 +1737,17 @@ Imports VectoAuxiliaries Abort() Exit Sub End If - _scr += 5*_diffLvl + _scr += 5 * _diffLvl End If _scr += _diffLvl _diffC += 1 'Erhöhe Schwierigkeitsgrad - If _diffC = (_diffLvl + 3)*4 Then + If _diffC = (_diffLvl + 3) * 4 Then _diffC = 0 _diffLvl += 1 - If _diffLvl > 2 And _diffLvl < 7 Then _mainForm.TmProgSec.Interval = 300 - (_diffLvl)*30 + If _diffLvl > 2 And _diffLvl < 7 Then _mainForm.TmProgSec.Interval = 300 - (_diffLvl) * 30 _scr += 100 Select Case _diffLvl Case 3 @@ -1838,10 +1831,10 @@ Imports VectoAuxiliaries _ctrls(RowLim + 1) = 0 _ctrlC += 1 If _ctrlC < _ctrlCl Then Exit Sub - Select Case CInt(Int((_ctrlRnd*Rnd()) + 1)) + Select Case CInt(Int((_ctrlRnd * Rnd()) + 1)) Case 1, 2 _ctrlC = 0 - x = CInt(Int((7*Rnd()) + 1)) + x = CInt(Int((7 * Rnd()) + 1)) _ctrls(RowLim + 1) = x End Select End Sub @@ -1884,7 +1877,7 @@ Imports VectoAuxiliaries s = s.Insert(_ctrls(RowLim + 1) + 1, "X") End If Select Case _xPanel - _pnls(RowLim) - Case - 1 + Case -1 s = Replace(s, "|", "\") Case 1 s = Replace(s, "|", "/") @@ -1896,15 +1889,15 @@ Imports VectoAuxiliaries _pnDirC += 1 If _pnDirC < _pnDirCl Then GoTo Lb1 _pnDirC = 0 - Select Case CInt(Int((_pnDirRnd*Rnd()) + 1)) + Select Case CInt(Int((_pnDirRnd * Rnd()) + 1)) Case 1 _pnDir = 1 Case 2 - _pnDir = - 1 + _pnDir = -1 Case Else _pnDir = 0 End Select - Lb1: +Lb1: _xPanel += _pnDir If _xPanel > ColLim Then _xPanel = ColLim @@ -1955,7 +1948,7 @@ Imports VectoAuxiliaries Dim builder As StringBuilder = New StringBuilder() For Each selectedItem As ListViewItem In LvMsg.SelectedItems builder.AppendLine(String.Join(", ", - selectedItem.SubItems.Cast (Of ListViewItem.ListViewSubItem).Select( + selectedItem.SubItems.Cast(Of ListViewItem.ListViewSubItem).Select( Function(item) item.Text))) Next Clipboard.SetText(builder.ToString()) @@ -1998,19 +1991,25 @@ Imports VectoAuxiliaries End If Try 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() + Dim extension As String = Path.GetExtension(f) + Select Case extension + Case ".vecto" + input = JSONInputDataFactory.ReadJsonJob(f) + Case ".xml" + Dim xDocument As XDocument = xDocument.Load(f) + Dim rootNode As String = If(xDocument Is Nothing, "", xDocument.Root.Name.LocalName) + Select Case rootNode + Case XMLNames.VectoInputEngineering + input = New XMLEngineeringInputDataProvider(f, True) + Case XMLNames.VectoInputDeclaration + input = New XMLInputDataProvider(XmlReader.Create(f), True) + End Select + End Select - 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) + + XMLExportJobDialog.Initialize(input) + XMLExportJobDialog.ShowDialog() Catch ex As Exception MsgBox("Exporting job failed: " + ex.Message) End Try @@ -2021,12 +2020,12 @@ Imports VectoAuxiliaries End Sub Private Sub btnImportXML_Click(sender As Object, e As EventArgs) Handles btnImportXML.Click - Try - Dim jobFile As String = PluginRegistry.Instance.GetImportPlugin("TUG.IVT.Vecto.XMLImport").ImportJob() - AddToJobListView(jobFile) - Catch ex As Exception - MsgBox("Importing job failed: " + ex.Message) - End Try + 'Try + ' Dim jobFile As String = PluginRegistry.Instance.GetImportPlugin("TUG.IVT.Vecto.XMLImport").ImportJob() + ' AddToJobListView(jobFile) + 'Catch ex As Exception + ' MsgBox("Importing job failed: " + ex.Message) + 'End Try End Sub Private Sub LvGEN_MouseClick(sender As Object, e As MouseEventArgs) Handles LvGEN.MouseClick diff --git a/VECTO/GUI/XMLExportJobDialog.Designer.vb b/VECTO/GUI/XMLExportJobDialog.Designer.vb new file mode 100644 index 0000000000..723ab9d9a6 --- /dev/null +++ b/VECTO/GUI/XMLExportJobDialog.Designer.vb @@ -0,0 +1,190 @@ +<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _ +Partial Class XMLExportJobDialog + Inherits System.Windows.Forms.Form + + 'Form overrides dispose to clean up the component list. + <System.Diagnostics.DebuggerNonUserCode()> _ + Protected Overrides Sub Dispose(ByVal disposing As Boolean) + Try + If disposing AndAlso components IsNot Nothing Then + components.Dispose() + End If + Finally + MyBase.Dispose(disposing) + End Try + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + <System.Diagnostics.DebuggerStepThrough()> _ + Private Sub InitializeComponent() + Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(XMLExportJobDialog)) + Me.lbVendor = New System.Windows.Forms.Label() + Me.tbVendor = New System.Windows.Forms.TextBox() + Me.btnExport = New System.Windows.Forms.Button() + Me.cbSingleFile = New System.Windows.Forms.CheckBox() + Me.label1 = New System.Windows.Forms.Label() + Me.btnBrowseOutputDir = New System.Windows.Forms.Button() + Me.tbJobfile = New System.Windows.Forms.TextBox() + Me.tbMode = New System.Windows.Forms.TextBox() + Me.lblJobfile = New System.Windows.Forms.Label() + Me.lblDstDir = New System.Windows.Forms.Label() + Me.tbDestination = New System.Windows.Forms.TextBox() + Me.lblMode = New System.Windows.Forms.Label() + Me.btnCancel = New System.Windows.Forms.Button() + Me.SuspendLayout() + ' + 'lbVendor + ' + Me.lbVendor.AutoSize = True + Me.lbVendor.Location = New System.Drawing.Point(10, 97) + Me.lbVendor.Name = "lbVendor" + Me.lbVendor.Size = New System.Drawing.Size(44, 13) + Me.lbVendor.TabIndex = 25 + Me.lbVendor.Text = "Vendor:" + ' + 'tbVendor + ' + Me.tbVendor.Location = New System.Drawing.Point(120, 94) + Me.tbVendor.Name = "tbVendor" + Me.tbVendor.Size = New System.Drawing.Size(231, 20) + Me.tbVendor.TabIndex = 24 + ' + 'btnExport + ' + Me.btnExport.Location = New System.Drawing.Point(276, 150) + Me.btnExport.Name = "btnExport" + Me.btnExport.Size = New System.Drawing.Size(75, 23) + Me.btnExport.TabIndex = 23 + Me.btnExport.Text = "Export" + Me.btnExport.UseVisualStyleBackColor = True + ' + 'cbSingleFile + ' + Me.cbSingleFile.AutoSize = True + Me.cbSingleFile.Location = New System.Drawing.Point(132, 121) + Me.cbSingleFile.Name = "cbSingleFile" + Me.cbSingleFile.Size = New System.Drawing.Size(15, 14) + Me.cbSingleFile.TabIndex = 22 + Me.cbSingleFile.UseVisualStyleBackColor = True + ' + 'label1 + ' + Me.label1.AutoSize = True + Me.label1.Location = New System.Drawing.Point(10, 121) + Me.label1.Name = "label1" + Me.label1.Size = New System.Drawing.Size(116, 13) + Me.label1.TabIndex = 21 + Me.label1.Text = "Output single XML File:" + ' + 'btnBrowseOutputDir + ' + Me.btnBrowseOutputDir.Location = New System.Drawing.Point(357, 65) + Me.btnBrowseOutputDir.Name = "btnBrowseOutputDir" + Me.btnBrowseOutputDir.Size = New System.Drawing.Size(75, 23) + Me.btnBrowseOutputDir.TabIndex = 20 + Me.btnBrowseOutputDir.Text = "Browse" + Me.btnBrowseOutputDir.UseVisualStyleBackColor = True + ' + 'tbJobfile + ' + Me.tbJobfile.Location = New System.Drawing.Point(120, 20) + Me.tbJobfile.Name = "tbJobfile" + Me.tbJobfile.ReadOnly = True + Me.tbJobfile.Size = New System.Drawing.Size(231, 20) + Me.tbJobfile.TabIndex = 19 + ' + 'tbMode + ' + Me.tbMode.Location = New System.Drawing.Point(120, 43) + Me.tbMode.Name = "tbMode" + Me.tbMode.ReadOnly = True + Me.tbMode.Size = New System.Drawing.Size(231, 20) + Me.tbMode.TabIndex = 18 + ' + 'lblJobfile + ' + Me.lblJobfile.AutoSize = True + Me.lblJobfile.Location = New System.Drawing.Point(10, 23) + Me.lblJobfile.Name = "lblJobfile" + Me.lblJobfile.Size = New System.Drawing.Size(58, 13) + Me.lblJobfile.TabIndex = 17 + Me.lblJobfile.Text = "Vecto Job:" + ' + 'lblDstDir + ' + Me.lblDstDir.AutoSize = True + Me.lblDstDir.Location = New System.Drawing.Point(10, 71) + Me.lblDstDir.Name = "lblDstDir" + Me.lblDstDir.Size = New System.Drawing.Size(87, 13) + Me.lblDstDir.TabIndex = 16 + Me.lblDstDir.Text = "Output Directory:" + ' + 'tbDestination + ' + Me.tbDestination.Location = New System.Drawing.Point(120, 68) + Me.tbDestination.Name = "tbDestination" + Me.tbDestination.Size = New System.Drawing.Size(231, 20) + Me.tbDestination.TabIndex = 15 + ' + 'lblMode + ' + Me.lblMode.AutoSize = True + Me.lblMode.Location = New System.Drawing.Point(10, 46) + Me.lblMode.Name = "lblMode" + Me.lblMode.Size = New System.Drawing.Size(68, 13) + Me.lblMode.TabIndex = 14 + Me.lblMode.Text = "Vecto Mode:" + ' + 'btnCancel + ' + Me.btnCancel.Location = New System.Drawing.Point(357, 150) + Me.btnCancel.Name = "btnCancel" + Me.btnCancel.Size = New System.Drawing.Size(75, 23) + Me.btnCancel.TabIndex = 13 + Me.btnCancel.Text = "Cancel" + Me.btnCancel.UseVisualStyleBackColor = True + ' + 'XMLExportJobDialog + ' + Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) + Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font + Me.ClientSize = New System.Drawing.Size(449, 185) + Me.Controls.Add(Me.lbVendor) + Me.Controls.Add(Me.tbVendor) + Me.Controls.Add(Me.btnExport) + Me.Controls.Add(Me.cbSingleFile) + Me.Controls.Add(Me.label1) + Me.Controls.Add(Me.btnBrowseOutputDir) + Me.Controls.Add(Me.tbJobfile) + Me.Controls.Add(Me.tbMode) + Me.Controls.Add(Me.lblJobfile) + Me.Controls.Add(Me.lblDstDir) + Me.Controls.Add(Me.tbDestination) + Me.Controls.Add(Me.lblMode) + Me.Controls.Add(Me.btnCancel) + Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon) + Me.Name = "XMLExportJobDialog" + Me.Text = "VECTO XML Export" + Me.ResumeLayout(False) + Me.PerformLayout() + + End Sub + Private WithEvents lbVendor As System.Windows.Forms.Label + Private WithEvents tbVendor As System.Windows.Forms.TextBox + Private WithEvents btnExport As System.Windows.Forms.Button + Private WithEvents cbSingleFile As System.Windows.Forms.CheckBox + Private WithEvents label1 As System.Windows.Forms.Label + Private WithEvents btnBrowseOutputDir As System.Windows.Forms.Button + Private WithEvents tbJobfile As System.Windows.Forms.TextBox + Private WithEvents tbMode As System.Windows.Forms.TextBox + Private WithEvents lblJobfile As System.Windows.Forms.Label + Private WithEvents lblDstDir As System.Windows.Forms.Label + Private WithEvents tbDestination As System.Windows.Forms.TextBox + Private WithEvents lblMode As System.Windows.Forms.Label + Private WithEvents btnCancel As System.Windows.Forms.Button +End Class diff --git a/VECTO/GUI/XMLExportJobDialog.resx b/VECTO/GUI/XMLExportJobDialog.resx new file mode 100644 index 0000000000..0feb0b2bd5 --- /dev/null +++ b/VECTO/GUI/XMLExportJobDialog.resx @@ -0,0 +1,197 @@ +<?xml version="1.0" encoding="utf-8"?> +<root> + <!-- + Microsoft ResX Schema + + Version 2.0 + + The primary goals of this format is to allow a simple XML format + that is mostly human readable. The generation and parsing of the + various data types are done through the TypeConverter classes + associated with the data types. + + Example: + + ... ado.net/XML headers & schema ... + <resheader name="resmimetype">text/microsoft-resx</resheader> + <resheader name="version">2.0</resheader> + <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> + <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> + <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> + <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> + <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> + <value>[base64 mime encoded serialized .NET Framework object]</value> + </data> + <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> + <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> + <comment>This is a comment</comment> + </data> + + There are any number of "resheader" rows that contain simple + name/value pairs. + + Each data row contains a name, and value. The row also contains a + type or mimetype. Type corresponds to a .NET class that support + text/value conversion through the TypeConverter architecture. + Classes that don't support this are serialized and stored with the + mimetype set. + + The mimetype is used for serialized objects, and tells the + ResXResourceReader how to depersist the object. This is currently not + extensible. For a given mimetype the value must be set accordingly: + + Note - application/x-microsoft.net.object.binary.base64 is the format + that the ResXResourceWriter will generate, however the reader can + read any of the formats listed below. + + mimetype: application/x-microsoft.net.object.binary.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.soap.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Soap.SoapFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.bytearray.base64 + value : The object must be serialized into a byte array + : using a System.ComponentModel.TypeConverter + : and then encoded with base64 encoding. + --> + <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> + <xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> + <xsd:element name="root" msdata:IsDataSet="true"> + <xsd:complexType> + <xsd:choice maxOccurs="unbounded"> + <xsd:element name="metadata"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" /> + </xsd:sequence> + <xsd:attribute name="name" use="required" type="xsd:string" /> + <xsd:attribute name="type" type="xsd:string" /> + <xsd:attribute name="mimetype" type="xsd:string" /> + <xsd:attribute ref="xml:space" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="assembly"> + <xsd:complexType> + <xsd:attribute name="alias" type="xsd:string" /> + <xsd:attribute name="name" type="xsd:string" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="data"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> + <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> + <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> + <xsd:attribute ref="xml:space" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="resheader"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" /> + </xsd:complexType> + </xsd:element> + </xsd:choice> + </xsd:complexType> + </xsd:element> + </xsd:schema> + <resheader name="resmimetype"> + <value>text/microsoft-resx</value> + </resheader> + <resheader name="version"> + <value>2.0</value> + </resheader> + <resheader name="reader"> + <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> + <resheader name="writer"> + <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> + <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> + <data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> + <value> + AAABAAEAICAAAAEAIACoEAAAFgAAACgAAAAgAAAAQAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP// + /wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP// + /wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP39 + /QLg6NsG/v7+Av///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP// + /wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP// + /wD+/v4B1uDQEIildi319/MQ////Af///wD///8A////AP///wD///8A////AP///wD///8A////AP// + /wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP// + /wD///8A////AP7+/gudtI5FRHEmhMbUvS7+/v4C////AP///wD///8A////AP///wD///8A////AP// + /wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP// + /wD///8A////AP///wD///8B7PDpJmOJS5s4aBnEjal8Wf39/A////8A////AP///wD///8A////AP// + /wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP// + /wD///8A////AP///wD///8A////AP7+/ga3ya0+PGsexzdnGO9Vfjut4OfcLP///wL///8A////AP// + /wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP// + /wD///8A////AP///wD///8A////AP///wD///8B+vv6Fn+ea3E2ZhfeN2cY/DhnGc+nvJpJ/v7+Cf// + /wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP// + /wD///8A////AP///wD///8A////AP///wD///8A////AP/+/gLU3s0vSHQstTZmF/Y2Zhf+NmYX6G2Q + V4zy9fAg////Af///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP// + /wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A/v7+DJqyilI1ZhbTNmYW/TZm + F/82Zhf5P20hwMDPtzj+/v4E////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP// + /wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wLr7+cpX4ZFpTVm + FfA2ZhX/NmYW/zZmFv42ZhfZh6N0ZPz9/BL+/v4B////AP///wD///8A////AP///wD///8A////AP// + /wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A/v7+B7TG + qEI6ahnMNmcV/DZnFf82ZhX/NmYV/zVlF/RPeTOw2+TWLf7+/gL///8A////AP///wD///8A////AP// + /wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP// + /wH4+vgZeppleTVmFOE2ZxX+NmcV/zZnFf82ZhX/NmYV/TZmFtGhuJNO/v7+Cv///wD///8A////AP// + /wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP// + /wD///8A/v7+As/byDBGcyi3NWYU9zVmFP82ZxX/NmcV/zZnFf82ZxX+NWYV7GeMT5fv8+0k////Af// + /wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP// + /wD///8A////AP///wD+/v4Mlq+FVDRlE9Q1ZhT9NWYU/zVmFP82ZxX/NmcV/zZnFf82ZxX7PWwdxbzM + sTz+/v4F////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP// + /wD///8A////AP///wD///8A////Auju5Stbg0GqNWUU8jVmFP81ZhT/NWYU/zVmFP82ZxX/NmcV/zZn + Ff41ZhTdgqBubfv8+hX///8B////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP// + /wD///8A////AP///wD///8A////AP///wD+/v4HscOlRThoGM41ZhT9NWYU/zVmFP81ZhT/NWYU/zVm + FP82ZxX/NmcV/zVmFPVLdy6z1+DQL/7+/gL///8A////AP///wD///8A////AP///wD///8A////AP// + /wD///8A////AP///wD///8A////AP///wD///8A////Afj59xt2l2F+NGUT4zVmFP41ZhT/NWYU/zVm + FP81ZhT/NWYU/zVmFP82ZxX/NmcV/TVmFdOctI1R/v7+C////wD///8A////AP///wD///8A////AP// + /wD///8A////AP///wD///8A////AP///wD///8A////AP///wD+/v4CzdnFMURxJbo1ZhT4NWYU/zVm + FP81ZhT/NWYU/zVmFP81ZhT/NWYU/zVmFP82ZxX/NWYU7mKISZ/s8ekn////Af///wD///8A////AP// + /wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP7+/gyUroNUNGUT1DVm + FP01ZhT/NWYU/zVmFP81ZhT/NWYU/zVmFP81ZhT/NWYU/zVmFP82ZxX8O2obybfIq0L+/v4I/v7+Av39 + /QL9/v0C/f79Av3+/QL9/v0C/f79Av3+/QL9/v0C/f79Av///wD///8A////AP///wD///8C5uziK1mB + Pqs0ZRPzNWYU/zVmFP81ZhT/NWYU/zVmFP81ZhT/NWYU/zVmFP81ZhT/NWYU/zZnFf41ZhThepplhNTe + zUPZ4tM12eLTNdni0zXZ4tM12eLTNdni1DXZ4tQ12eLUNdrj1DXa49U1////AP///wD///8A////AP7+ + /givwqJGN2cWzjVmFP01ZhT/NWYU/zVmFP81ZhT/NGYT/zVmFP41ZhT/NWYU/zVmFP81ZhT/NWYU/zZn + Ffg1ZhThRHImz0RxJspEcSfKRXEoykVyKMpFcinKRnMqykd0K8pIdCvKSXUsykt3Lsr///8A////AP// + /wD//v8B9vj1HXSWXoM0ZRPlNWYU/jVmFP81ZhT/NWYU/zVmFP82ZhX0U3w34DRlE/Q1ZhT/NWYU/zVm + FP81ZhT/NWYU/zZnFf42ZxX9NmYV/TZmFv02Zhf9NmYX/TdnGP03Zxj9OWgZ/TppGv06ahv9PGwd/f// + /wD///8A////AP7//gLK1sIyQnAkuzRlE/g1ZhT/NWYU/zVmFP81ZhT/NWYU+0dzKc2gt5GGP24g0zVm + FP01ZhT/NWYU/zVmFP81ZhT/NmcV/zZnFf82ZxX/NmYW/zZmF/82Zhf/N2cY/zdnGP84aBn/Omka/zpq + G/87axz/////AP///wD///8A/f79DY+qflc0ZRPVNWYU/TVmFP81ZhT/NWYU/zVmFP41ZRTraY1RluLp + 3k1fhkWnNGUT8TVmFP81ZhT/NWYU/zVmFP81ZhT/NmcV/zZnFf82ZhX/NmYW/zZmF/83Zxf/N2cY/zho + Gf85aRr/Omob/ztrHP////8A////AP///gLj6t8rVn88rDRlFPM1ZhT/NWYU/zVmFP81ZhT/NWYU/jRl + E9KWr4VN/f39F5CqflU0ZRPVNWYU/jVmFP81ZhT/NWYU/zVmFP82ZxX/NmcV/zZmFf82Zhb/NmYX/zZm + F/83Zxj/N2cY/zlpGv86ahv/O2sc/////wD///8A/v7+CKzAn0c3ZxbPNWYU/TVmFP81ZhT/NWYU/zVm + FP81ZhT9PWwdycPSujb+/v4EwtC4Nz1sHco1ZhT9NWYU/zVmFP81ZhT/NWYU/zZnFf82ZxX/NmYV/zZm + Fv82Zhf/NmYX/zdnGP83Zxj/OWka/zpqG/86ahv/////AP///wH1+PQecpRchjRlE+Y1ZhT+NWYU/zVm + FP81ZhT/NWYU/zVmFPZXgDyz6e7mLv///wPp7uYsWYE+rzVmFPQ1ZhT/NWYU/zVmFP81ZhT/NmcV/zZn + Ff82ZhT/NmYV/zZmF/82Zhf/N2cX/zdnGP85aRr/Omob/zpqG/////8A/v7+AsjVvzFBbyK6NGUU9jVm + FP01ZhT9NWYU/TVmFP01ZhT8NGUT3IGgbW78/PwW////Af39/RGJpXZiNGUT2DVmFPw1ZhT9NGUT/TVm + FP02ZxX9NmcV/TZmFf02ZhX9NmYX/TZmF/03Zxf9N2cY/ThoGf06aRr9Omob/f///wD9/v0Dj6p9LjZn + FaE2ZxXINmcVyjZnFco2ZxXKNmcVyjZnFck4aBijr8KiNP7+/gX///8A/v7+A7rKrzA7ahuiNmcVyTZn + Fco2ZxXKN2cWyjdoFso3aBbKN2gWyjdnF8o3ZxjKOGcZyjhoGco5aBrKOmobyjtrHMo8ax3K////APr7 + +gHB0LcMscSkKrHEpDWxxKQ1scSkNbHEpDWxxKQ1scSkNbTGqCru8uwM///+Af///wD///8A8/bxC7bH + qiqxxKQ1scSkNbHEpDWxxKQ1scSlNbHEpTWxxKU1scSlNbHEpTWxxKU1scSmNbLEpjWyxaY1s8WnNbPF + pzX5+vgA////AP///wD///8C////Av///wL///8C////Av///wL///8C////Av///wD///8A////AP// + /wD///8A////Av///wL///8C////Av///wL///8C////Av///wL///8C////Av///wL///8C////Av// + /wL///8C////Av///wD4+vcA+Pr3APj69wD9/fwA////APj69wD4+vcA+Pr3APj69wD4+vcA+fr4APn6 + +AD5+vgA+fr4APn7+QD6+/kA+/v6APv7+wD7/PsA/Pz8AP39/AD9/v0A/v/+APr6+gD6+voA+vr6APr6 + +gD6+voA////AP///wD///8A//////////////////v////z////8f////H////g////4P///8D////A + f///wH///4A///+AP///AD///wAf//8AH//+AA///gAP//wAB//8AAAA+AAAAPgAAAD4BAAA8A4AAPAO + AADgDgAA4B8AAOAfAAD///////////////8= +</value> + </data> +</root> \ No newline at end of file diff --git a/VECTO/GUI/XMLExportJobDialog.vb b/VECTO/GUI/XMLExportJobDialog.vb new file mode 100644 index 0000000000..8eebeeb9c7 --- /dev/null +++ b/VECTO/GUI/XMLExportJobDialog.vb @@ -0,0 +1,79 @@ +Imports System.IO +Imports System.Xml.Linq +Imports Microsoft.WindowsAPICodePack.Dialogs +Imports TUGraz.IVT.VectoXML.Writer +Imports TUGraz.VectoCommon.Exceptions +Imports TUGraz.VectoCommon.InputData +Imports TUGraz.VectoCommon.Models +Imports TUGraz.VectoCore.Models.Declaration + +Public Class XMLExportJobDialog + Private _mode As ExecutionMode + Private _data As IInputDataProvider + + Public Sub Initialize(data As IInputDataProvider) + Dim source As String + Dim allowSingleFile As Boolean + Dim eng As IEngineeringInputDataProvider = CType(data, IEngineeringInputDataProvider) + If (Not eng Is Nothing AndAlso Not eng.JobInputData().SavedInDeclarationMode) Then + source = eng.JobInputData().JobName + _mode = ExecutionMode.Engineering + allowSingleFile = True + Else + Dim decl As IDeclarationInputDataProvider = CType(data, IDeclarationInputDataProvider) + If (Not decl Is Nothing AndAlso decl.JobInputData().SavedInDeclarationMode) Then + source = decl.JobInputData().JobName + _mode = ExecutionMode.Declaration + allowSingleFile = False + Else + Throw New VectoException("Input data is neither declaration nor engineering mode!") + End If + End If + _data = data + tbJobfile.Text = source + tbMode.Text = If(_mode = ExecutionMode.Engineering, "Engineering Mode", "Declaration Mode") + cbSingleFile.Checked = True + cbSingleFile.Enabled = allowSingleFile + End Sub + + Private Sub btnBrowseOutputDir_Click(sender As Object, e As EventArgs) Handles btnBrowseOutputDir.Click + Dim dialog As CommonOpenFileDialog = New CommonOpenFileDialog() + dialog.IsFolderPicker = True + If (dialog.ShowDialog() = CommonFileDialogResult.Ok) Then + tbDestination.Text = Path.GetFullPath(dialog.FileName) + End If + End Sub + + Private Sub btnCancel_Click(sender As Object, e As EventArgs) Handles btnCancel.Click + Close() + End Sub + + Private Sub btnExport_Click(sender As Object, e As EventArgs) Handles btnExport.Click + If (String.IsNullOrWhiteSpace(tbDestination.Text) OrElse Not Directory.Exists(tbDestination.Text)) Then + MessageBox.Show("Output directory is invalid", "Invalid Output", MessageBoxButtons.OK) + Exit Sub + End If + + If (_mode = ExecutionMode.Engineering) Then + Dim engineeringData As IEngineeringInputDataProvider = CType(_data, IEngineeringInputDataProvider) + If (engineeringData Is Nothing OrElse engineeringData.JobInputData().SavedInDeclarationMode) Then + Throw New Exception("Input data is not in engineering mode!") + End If + Dim document As XDocument = + New XMLEngineeringWriter(tbDestination.Text, cbSingleFile.Checked, tbVendor.Text).GenerateVectoJob(engineeringData) + document.Save(Path.Combine(tbDestination.Text, engineeringData.JobInputData().JobName + ".xml")) + MessageBox.Show("Successfully exported") + Close() + Else + Dim declarationData As IDeclarationInputDataProvider = CType(_data, IDeclarationInputDataProvider) + If (declarationData Is Nothing OrElse Not declarationData.JobInputData().SavedInDeclarationMode) Then + Throw New Exception("Input data is not in declaration mode") + End If + Dim document As XDocument = + New XMLDeclarationWriter(tbDestination.Text, tbVendor.Text).GenerateVectoJob(declarationData) + document.Save(Path.Combine(tbDestination.Text, declarationData.JobInputData().JobName + ".xml")) + MessageBox.Show("Successfully exported") + Close() + End If + End Sub +End Class \ No newline at end of file diff --git a/VECTO/GUI/XMLImportJobDialog.Designer.vb b/VECTO/GUI/XMLImportJobDialog.Designer.vb new file mode 100644 index 0000000000..ecc7eb7dff --- /dev/null +++ b/VECTO/GUI/XMLImportJobDialog.Designer.vb @@ -0,0 +1,132 @@ +<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _ +Partial Class XMLImportJobDialog + Inherits System.Windows.Forms.Form + + 'Form overrides dispose to clean up the component list. + <System.Diagnostics.DebuggerNonUserCode()> _ + Protected Overrides Sub Dispose(ByVal disposing As Boolean) + Try + If disposing AndAlso components IsNot Nothing Then + components.Dispose() + End If + Finally + MyBase.Dispose(disposing) + End Try + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + <System.Diagnostics.DebuggerStepThrough()> _ + Private Sub InitializeComponent() + Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(XMLImportJobDialog)) + Me.btnClose = New System.Windows.Forms.Button() + Me.btnImport = New System.Windows.Forms.Button() + Me.btnBrowseOutput = New System.Windows.Forms.Button() + Me.btnBrowseJob = New System.Windows.Forms.Button() + Me.tbDestination = New System.Windows.Forms.TextBox() + Me.tbJobFile = New System.Windows.Forms.TextBox() + Me.label2 = New System.Windows.Forms.Label() + Me.label1 = New System.Windows.Forms.Label() + Me.SuspendLayout() + ' + 'btnClose + ' + Me.btnClose.Location = New System.Drawing.Point(391, 92) + Me.btnClose.Name = "btnClose" + Me.btnClose.Size = New System.Drawing.Size(75, 23) + Me.btnClose.TabIndex = 15 + Me.btnClose.Text = "Cancel" + Me.btnClose.UseVisualStyleBackColor = True + ' + 'btnImport + ' + Me.btnImport.Location = New System.Drawing.Point(310, 92) + Me.btnImport.Name = "btnImport" + Me.btnImport.Size = New System.Drawing.Size(75, 23) + Me.btnImport.TabIndex = 14 + Me.btnImport.Text = "Import" + Me.btnImport.UseVisualStyleBackColor = True + ' + 'btnBrowseOutput + ' + Me.btnBrowseOutput.Location = New System.Drawing.Point(345, 41) + Me.btnBrowseOutput.Name = "btnBrowseOutput" + Me.btnBrowseOutput.Size = New System.Drawing.Size(75, 23) + Me.btnBrowseOutput.TabIndex = 13 + Me.btnBrowseOutput.Text = "Browse" + Me.btnBrowseOutput.UseVisualStyleBackColor = True + ' + 'btnBrowseJob + ' + Me.btnBrowseJob.Location = New System.Drawing.Point(345, 12) + Me.btnBrowseJob.Name = "btnBrowseJob" + Me.btnBrowseJob.Size = New System.Drawing.Size(75, 23) + Me.btnBrowseJob.TabIndex = 12 + Me.btnBrowseJob.Text = "Browse" + Me.btnBrowseJob.UseVisualStyleBackColor = True + ' + 'tbDestination + ' + Me.tbDestination.Location = New System.Drawing.Point(105, 43) + Me.tbDestination.Name = "tbDestination" + Me.tbDestination.Size = New System.Drawing.Size(224, 20) + Me.tbDestination.TabIndex = 11 + ' + 'tbJobFile + ' + Me.tbJobFile.Location = New System.Drawing.Point(105, 14) + Me.tbJobFile.Name = "tbJobFile" + Me.tbJobFile.Size = New System.Drawing.Size(224, 20) + Me.tbJobFile.TabIndex = 10 + ' + 'label2 + ' + Me.label2.AutoSize = True + Me.label2.Location = New System.Drawing.Point(11, 46) + Me.label2.Name = "label2" + Me.label2.Size = New System.Drawing.Size(87, 13) + Me.label2.TabIndex = 9 + Me.label2.Text = "Output Directory:" + ' + 'label1 + ' + Me.label1.AutoSize = True + Me.label1.Location = New System.Drawing.Point(11, 17) + Me.label1.Name = "label1" + Me.label1.Size = New System.Drawing.Size(46, 13) + Me.label1.TabIndex = 8 + Me.label1.Text = "Job File:" + ' + 'XMLImportJobDialog + ' + Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) + Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font + Me.ClientSize = New System.Drawing.Size(480, 130) + Me.Controls.Add(Me.btnClose) + Me.Controls.Add(Me.btnImport) + Me.Controls.Add(Me.btnBrowseOutput) + Me.Controls.Add(Me.btnBrowseJob) + Me.Controls.Add(Me.tbDestination) + Me.Controls.Add(Me.tbJobFile) + Me.Controls.Add(Me.label2) + Me.Controls.Add(Me.label1) + Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon) + Me.Name = "XMLImportJobDialog" + Me.Text = "VECTO Import Job" + Me.ResumeLayout(False) + Me.PerformLayout() + + End Sub + Private WithEvents btnClose As System.Windows.Forms.Button + Private WithEvents btnImport As System.Windows.Forms.Button + Private WithEvents btnBrowseOutput As System.Windows.Forms.Button + Private WithEvents btnBrowseJob As System.Windows.Forms.Button + Private WithEvents tbDestination As System.Windows.Forms.TextBox + Private WithEvents tbJobFile As System.Windows.Forms.TextBox + Private WithEvents label2 As System.Windows.Forms.Label + Private WithEvents label1 As System.Windows.Forms.Label +End Class diff --git a/VECTO/GUI/XMLImportJobDialog.resx b/VECTO/GUI/XMLImportJobDialog.resx new file mode 100644 index 0000000000..0feb0b2bd5 --- /dev/null +++ b/VECTO/GUI/XMLImportJobDialog.resx @@ -0,0 +1,197 @@ +<?xml version="1.0" encoding="utf-8"?> +<root> + <!-- + Microsoft ResX Schema + + Version 2.0 + + The primary goals of this format is to allow a simple XML format + that is mostly human readable. The generation and parsing of the + various data types are done through the TypeConverter classes + associated with the data types. + + Example: + + ... ado.net/XML headers & schema ... + <resheader name="resmimetype">text/microsoft-resx</resheader> + <resheader name="version">2.0</resheader> + <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> + <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> + <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> + <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> + <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> + <value>[base64 mime encoded serialized .NET Framework object]</value> + </data> + <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> + <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> + <comment>This is a comment</comment> + </data> + + There are any number of "resheader" rows that contain simple + name/value pairs. + + Each data row contains a name, and value. The row also contains a + type or mimetype. Type corresponds to a .NET class that support + text/value conversion through the TypeConverter architecture. + Classes that don't support this are serialized and stored with the + mimetype set. + + The mimetype is used for serialized objects, and tells the + ResXResourceReader how to depersist the object. This is currently not + extensible. For a given mimetype the value must be set accordingly: + + Note - application/x-microsoft.net.object.binary.base64 is the format + that the ResXResourceWriter will generate, however the reader can + read any of the formats listed below. + + mimetype: application/x-microsoft.net.object.binary.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.soap.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Soap.SoapFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.bytearray.base64 + value : The object must be serialized into a byte array + : using a System.ComponentModel.TypeConverter + : and then encoded with base64 encoding. + --> + <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> + <xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> + <xsd:element name="root" msdata:IsDataSet="true"> + <xsd:complexType> + <xsd:choice maxOccurs="unbounded"> + <xsd:element name="metadata"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" /> + </xsd:sequence> + <xsd:attribute name="name" use="required" type="xsd:string" /> + <xsd:attribute name="type" type="xsd:string" /> + <xsd:attribute name="mimetype" type="xsd:string" /> + <xsd:attribute ref="xml:space" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="assembly"> + <xsd:complexType> + <xsd:attribute name="alias" type="xsd:string" /> + <xsd:attribute name="name" type="xsd:string" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="data"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> + <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> + <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> + <xsd:attribute ref="xml:space" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="resheader"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" /> + </xsd:complexType> + </xsd:element> + </xsd:choice> + </xsd:complexType> + </xsd:element> + </xsd:schema> + <resheader name="resmimetype"> + <value>text/microsoft-resx</value> + </resheader> + <resheader name="version"> + <value>2.0</value> + </resheader> + <resheader name="reader"> + <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> + <resheader name="writer"> + <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> + <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> + <data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> + <value> + AAABAAEAICAAAAEAIACoEAAAFgAAACgAAAAgAAAAQAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP// + /wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP// + /wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP39 + /QLg6NsG/v7+Av///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP// + /wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP// + /wD+/v4B1uDQEIildi319/MQ////Af///wD///8A////AP///wD///8A////AP///wD///8A////AP// + /wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP// + /wD///8A////AP7+/gudtI5FRHEmhMbUvS7+/v4C////AP///wD///8A////AP///wD///8A////AP// + /wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP// + /wD///8A////AP///wD///8B7PDpJmOJS5s4aBnEjal8Wf39/A////8A////AP///wD///8A////AP// + /wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP// + /wD///8A////AP///wD///8A////AP7+/ga3ya0+PGsexzdnGO9Vfjut4OfcLP///wL///8A////AP// + /wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP// + /wD///8A////AP///wD///8A////AP///wD///8B+vv6Fn+ea3E2ZhfeN2cY/DhnGc+nvJpJ/v7+Cf// + /wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP// + /wD///8A////AP///wD///8A////AP///wD///8A////AP/+/gLU3s0vSHQstTZmF/Y2Zhf+NmYX6G2Q + V4zy9fAg////Af///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP// + /wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A/v7+DJqyilI1ZhbTNmYW/TZm + F/82Zhf5P20hwMDPtzj+/v4E////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP// + /wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wLr7+cpX4ZFpTVm + FfA2ZhX/NmYW/zZmFv42ZhfZh6N0ZPz9/BL+/v4B////AP///wD///8A////AP///wD///8A////AP// + /wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A/v7+B7TG + qEI6ahnMNmcV/DZnFf82ZhX/NmYV/zVlF/RPeTOw2+TWLf7+/gL///8A////AP///wD///8A////AP// + /wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP// + /wH4+vgZeppleTVmFOE2ZxX+NmcV/zZnFf82ZhX/NmYV/TZmFtGhuJNO/v7+Cv///wD///8A////AP// + /wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP// + /wD///8A/v7+As/byDBGcyi3NWYU9zVmFP82ZxX/NmcV/zZnFf82ZxX+NWYV7GeMT5fv8+0k////Af// + /wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP// + /wD///8A////AP///wD+/v4Mlq+FVDRlE9Q1ZhT9NWYU/zVmFP82ZxX/NmcV/zZnFf82ZxX7PWwdxbzM + sTz+/v4F////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP// + /wD///8A////AP///wD///8A////Auju5Stbg0GqNWUU8jVmFP81ZhT/NWYU/zVmFP82ZxX/NmcV/zZn + Ff41ZhTdgqBubfv8+hX///8B////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP// + /wD///8A////AP///wD///8A////AP///wD+/v4HscOlRThoGM41ZhT9NWYU/zVmFP81ZhT/NWYU/zVm + FP82ZxX/NmcV/zVmFPVLdy6z1+DQL/7+/gL///8A////AP///wD///8A////AP///wD///8A////AP// + /wD///8A////AP///wD///8A////AP///wD///8A////Afj59xt2l2F+NGUT4zVmFP41ZhT/NWYU/zVm + FP81ZhT/NWYU/zVmFP82ZxX/NmcV/TVmFdOctI1R/v7+C////wD///8A////AP///wD///8A////AP// + /wD///8A////AP///wD///8A////AP///wD///8A////AP///wD+/v4CzdnFMURxJbo1ZhT4NWYU/zVm + FP81ZhT/NWYU/zVmFP81ZhT/NWYU/zVmFP82ZxX/NWYU7mKISZ/s8ekn////Af///wD///8A////AP// + /wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP7+/gyUroNUNGUT1DVm + FP01ZhT/NWYU/zVmFP81ZhT/NWYU/zVmFP81ZhT/NWYU/zVmFP82ZxX8O2obybfIq0L+/v4I/v7+Av39 + /QL9/v0C/f79Av3+/QL9/v0C/f79Av3+/QL9/v0C/f79Av///wD///8A////AP///wD///8C5uziK1mB + Pqs0ZRPzNWYU/zVmFP81ZhT/NWYU/zVmFP81ZhT/NWYU/zVmFP81ZhT/NWYU/zZnFf41ZhThepplhNTe + zUPZ4tM12eLTNdni0zXZ4tM12eLTNdni1DXZ4tQ12eLUNdrj1DXa49U1////AP///wD///8A////AP7+ + /givwqJGN2cWzjVmFP01ZhT/NWYU/zVmFP81ZhT/NGYT/zVmFP41ZhT/NWYU/zVmFP81ZhT/NWYU/zZn + Ffg1ZhThRHImz0RxJspEcSfKRXEoykVyKMpFcinKRnMqykd0K8pIdCvKSXUsykt3Lsr///8A////AP// + /wD//v8B9vj1HXSWXoM0ZRPlNWYU/jVmFP81ZhT/NWYU/zVmFP82ZhX0U3w34DRlE/Q1ZhT/NWYU/zVm + FP81ZhT/NWYU/zZnFf42ZxX9NmYV/TZmFv02Zhf9NmYX/TdnGP03Zxj9OWgZ/TppGv06ahv9PGwd/f// + /wD///8A////AP7//gLK1sIyQnAkuzRlE/g1ZhT/NWYU/zVmFP81ZhT/NWYU+0dzKc2gt5GGP24g0zVm + FP01ZhT/NWYU/zVmFP81ZhT/NmcV/zZnFf82ZxX/NmYW/zZmF/82Zhf/N2cY/zdnGP84aBn/Omka/zpq + G/87axz/////AP///wD///8A/f79DY+qflc0ZRPVNWYU/TVmFP81ZhT/NWYU/zVmFP41ZRTraY1RluLp + 3k1fhkWnNGUT8TVmFP81ZhT/NWYU/zVmFP81ZhT/NmcV/zZnFf82ZhX/NmYW/zZmF/83Zxf/N2cY/zho + Gf85aRr/Omob/ztrHP////8A////AP///gLj6t8rVn88rDRlFPM1ZhT/NWYU/zVmFP81ZhT/NWYU/jRl + E9KWr4VN/f39F5CqflU0ZRPVNWYU/jVmFP81ZhT/NWYU/zVmFP82ZxX/NmcV/zZmFf82Zhb/NmYX/zZm + F/83Zxj/N2cY/zlpGv86ahv/O2sc/////wD///8A/v7+CKzAn0c3ZxbPNWYU/TVmFP81ZhT/NWYU/zVm + FP81ZhT9PWwdycPSujb+/v4EwtC4Nz1sHco1ZhT9NWYU/zVmFP81ZhT/NWYU/zZnFf82ZxX/NmYV/zZm + Fv82Zhf/NmYX/zdnGP83Zxj/OWka/zpqG/86ahv/////AP///wH1+PQecpRchjRlE+Y1ZhT+NWYU/zVm + FP81ZhT/NWYU/zVmFPZXgDyz6e7mLv///wPp7uYsWYE+rzVmFPQ1ZhT/NWYU/zVmFP81ZhT/NmcV/zZn + Ff82ZhT/NmYV/zZmF/82Zhf/N2cX/zdnGP85aRr/Omob/zpqG/////8A/v7+AsjVvzFBbyK6NGUU9jVm + FP01ZhT9NWYU/TVmFP01ZhT8NGUT3IGgbW78/PwW////Af39/RGJpXZiNGUT2DVmFPw1ZhT9NGUT/TVm + FP02ZxX9NmcV/TZmFf02ZhX9NmYX/TZmF/03Zxf9N2cY/ThoGf06aRr9Omob/f///wD9/v0Dj6p9LjZn + FaE2ZxXINmcVyjZnFco2ZxXKNmcVyjZnFck4aBijr8KiNP7+/gX///8A/v7+A7rKrzA7ahuiNmcVyTZn + Fco2ZxXKN2cWyjdoFso3aBbKN2gWyjdnF8o3ZxjKOGcZyjhoGco5aBrKOmobyjtrHMo8ax3K////APr7 + +gHB0LcMscSkKrHEpDWxxKQ1scSkNbHEpDWxxKQ1scSkNbTGqCru8uwM///+Af///wD///8A8/bxC7bH + qiqxxKQ1scSkNbHEpDWxxKQ1scSlNbHEpTWxxKU1scSlNbHEpTWxxKU1scSmNbLEpjWyxaY1s8WnNbPF + pzX5+vgA////AP///wD///8C////Av///wL///8C////Av///wL///8C////Av///wD///8A////AP// + /wD///8A////Av///wL///8C////Av///wL///8C////Av///wL///8C////Av///wL///8C////Av// + /wL///8C////Av///wD4+vcA+Pr3APj69wD9/fwA////APj69wD4+vcA+Pr3APj69wD4+vcA+fr4APn6 + +AD5+vgA+fr4APn7+QD6+/kA+/v6APv7+wD7/PsA/Pz8AP39/AD9/v0A/v/+APr6+gD6+voA+vr6APr6 + +gD6+voA////AP///wD///8A//////////////////v////z////8f////H////g////4P///8D////A + f///wH///4A///+AP///AD///wAf//8AH//+AA///gAP//wAB//8AAAA+AAAAPgAAAD4BAAA8A4AAPAO + AADgDgAA4B8AAOAfAAD///////////////8= +</value> + </data> +</root> \ No newline at end of file diff --git a/VECTO/GUI/XMLImportJobDialog.vb b/VECTO/GUI/XMLImportJobDialog.vb new file mode 100644 index 0000000000..50c7dded4d --- /dev/null +++ b/VECTO/GUI/XMLImportJobDialog.vb @@ -0,0 +1,27 @@ +Imports System.IO +Imports Microsoft.WindowsAPICodePack.Dialogs + +Public Class XMLImportJobDialog + Private Sub btnBrowseJob_Click(sender As Object, e As EventArgs) Handles btnBrowseJob.Click + Dim dialog As OpenFileDialog = New OpenFileDialog() + If (dialog.ShowDialog() = DialogResult.OK) Then + tbJobFile.Text = Path.GetFullPath(dialog.FileName) + End If + End Sub + + Private Sub btnBrowseOutput_Click(sender As Object, e As EventArgs) Handles btnBrowseOutput.Click + Dim dialog As CommonOpenFileDialog = New CommonOpenFileDialog() + dialog.IsFolderPicker = True + If (dialog.ShowDialog() = CommonFileDialogResult.Ok) Then + tbDestination.Text = Path.GetFullPath(dialog.FileName) + End If + End Sub + + Private Sub btnClose_Click(sender As Object, e As EventArgs) Handles btnClose.Click + Close() + End Sub + + Private Sub btnImport_Click(sender As Object, e As EventArgs) Handles btnImport.Click + ' TODO! + End Sub +End Class \ No newline at end of file diff --git a/VECTO/MainModule.vb b/VECTO/MainModule.vb index ed21da1c77..ed8d20ddd8 100644 --- a/VECTO/MainModule.vb +++ b/VECTO/MainModule.vb @@ -64,55 +64,5 @@ Module MainModule Return filePath End Function - Public Sub DetectPlugins() - - Dim dllFileNames As String() - Dim Path As String = "." - 'If Directory.Exists(Path) Then - dllFileNames = Directory.GetFiles(Path, "*.dll") - - Dim assemblies As ICollection(Of Assembly) = New List(Of Assembly)(dllFileNames.Length) - For Each dllFile As String In dllFileNames - Dim an As AssemblyName = AssemblyName.GetAssemblyName(dllFile) - Dim assembly As Assembly = assembly.Load(an) - assemblies.Add(assembly) - Next - - Dim exportPluginType As Type = GetType(IExportPlugin) - Dim importPluginType As Type = GetType(IImportPlugin) - Dim inputDataPluginType As Type = GetType(IInputDataPlugin) - - For Each assembly As Assembly In assemblies - If assembly <> Nothing Then - Dim types As Type() = assembly.GetTypes() - - For Each type As Type In types - If type.IsInterface Or type.IsAbstract Then - Continue For - Else - If type.GetInterface(exportPluginType.FullName) <> Nothing Then - Dim plugin As IExportPlugin = TryCast(Activator.CreateInstance(type), IExportPlugin) - If Not plugin Is Nothing Then - PluginRegistry.Instance.RegisterPlugin(plugin) - End If - End If - If type.GetInterface(importPluginType.FullName) <> Nothing Then - Dim plugin As IImportPlugin = TryCast(Activator.CreateInstance(type), IImportPlugin) - If Not plugin Is Nothing Then - PluginRegistry.Instance.RegisterPlugin(plugin) - End If - End If - If type.GetInterface(inputDataPluginType.FullName) <> Nothing Then - Dim plugin As IInputDataPlugin = TryCast(Activator.CreateInstance(type), IInputDataPlugin) - If Not plugin Is Nothing Then - PluginRegistry.Instance.RegisterPlugin(plugin) - End If - End If - End If - Next - End If - Next - - 'End If - End Sub + End Module diff --git a/VECTO/VECTO.vbproj b/VECTO/VECTO.vbproj index 863e0ed076..0f05b243b0 100644 --- a/VECTO/VECTO.vbproj +++ b/VECTO/VECTO.vbproj @@ -136,6 +136,14 @@ <HintPath>..\packages\iTextSharp.5.5.9\lib\itextsharp.dll</HintPath> </Reference> <Reference Include="Microsoft.Build.Framework" /> + <Reference Include="Microsoft.WindowsAPICodePack, Version=1.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> + <SpecificVersion>False</SpecificVersion> + <HintPath>..\packages\Microsoft.WindowsAPICodePack.Core.1.1.0\lib\Microsoft.WindowsAPICodePack.dll</HintPath> + </Reference> + <Reference Include="Microsoft.WindowsAPICodePack.Shell, Version=1.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> + <SpecificVersion>False</SpecificVersion> + <HintPath>..\packages\Microsoft.WindowsAPICodePack.Shell.1.1.0\lib\Microsoft.WindowsAPICodePack.Shell.dll</HintPath> + </Reference> <Reference Include="Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> <HintPath>..\packages\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll</HintPath> @@ -172,6 +180,18 @@ </ItemGroup> <ItemGroup> <Compile Include="ApplicationEvents.vb" /> + <Compile Include="GUI\XMLExportJobDialog.Designer.vb"> + <DependentUpon>XMLExportJobDialog.vb</DependentUpon> + </Compile> + <Compile Include="GUI\XMLExportJobDialog.vb"> + <SubType>Form</SubType> + </Compile> + <Compile Include="GUI\XMLImportJobDialog.Designer.vb"> + <DependentUpon>XMLImportJobDialog.vb</DependentUpon> + </Compile> + <Compile Include="GUI\XMLImportJobDialog.vb"> + <SubType>Form</SubType> + </Compile> <Compile Include="Input Files\AdvancedAuxiliary.vb" /> <Compile Include="GUI\FileSignDialog.Designer.vb"> <DependentUpon>FileSignDialog.vb</DependentUpon> @@ -364,6 +384,12 @@ <EmbeddedResource Include="GUI\GearboxGearDialog.resx"> <DependentUpon>GearboxGearDialog.vb</DependentUpon> </EmbeddedResource> + <EmbeddedResource Include="GUI\XMLExportJobDialog.resx"> + <DependentUpon>XMLExportJobDialog.vb</DependentUpon> + </EmbeddedResource> + <EmbeddedResource Include="GUI\XMLImportJobDialog.resx"> + <DependentUpon>XMLImportJobDialog.vb</DependentUpon> + </EmbeddedResource> <EmbeddedResource Include="My Project\Resources.resx"> <Generator>VbMyResourcesResXFileCodeGenerator</Generator> <LastGenOutput>Resources.Designer.vb</LastGenOutput> diff --git a/VECTO/app.config b/VECTO/app.config index 99ee49a662..0b81d52e36 100644 --- a/VECTO/app.config +++ b/VECTO/app.config @@ -6,27 +6,21 @@ </configSections> <runtime> <loadFromRemoteSources enabled="true" /> + <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> + <dependentAssembly> + <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" /> + </dependentAssembly> + </assemblyBinding> </runtime> - <nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://www.nlog-project.org/schemas/NLog.xsd NLog.xsd" - autoReload="false" - throwExceptions="false" - internalLogLevel="Off" internalLogFile="c:\temp\nlog-internal.log"> + <nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.nlog-project.org/schemas/NLog.xsd NLog.xsd" autoReload="false" throwExceptions="false" internalLogLevel="Off" internalLogFile="c:\temp\nlog-internal.log"> <targets async="true"> <target xsi:type="Console" name="ConsoleLogger" error="true" /> <target name="WarningLogger" xsi:type="MethodCall" className="TUGraz.VECTO.MainForm, VECTO" methodName="LogMethod"> <parameter layout="${level}" /> <parameter layout="${message}" /> </target> - <target xsi:type="File" - name="LogFile" - fileName="${basedir}/logs/log.txt" - layout="${longdate} [${processid}:${threadid}@${machinename}] ${callsite:skipFrames=1} ${level:uppercase=true}: ${message} ${exception:format=tostring}" - keepFileOpen="false" - archiveFileName="${basedir}/logs/archive{#}.txt" - maxArchiveFiles="1" - archiveAboveSize="10000000" /> + <target xsi:type="File" name="LogFile" fileName="${basedir}/logs/log.txt" layout="${longdate} [${processid}:${threadid}@${machinename}] ${callsite:skipFrames=1} ${level:uppercase=true}: ${message} ${exception:format=tostring}" keepFileOpen="false" archiveFileName="${basedir}/logs/archive{#}.txt" maxArchiveFiles="1" archiveAboveSize="10000000" /> </targets> <rules> <logger name="TUGraz.VectoCore.Models.Simulation.Impl.SimulatorFactory" minlevel="Info" writeTo="LogFile" /> @@ -49,9 +43,7 @@ <add name="DefaultSwitch" value="Information" /> </switches> <sharedListeners> - <add name="FileLog" - type="Microsoft.VisualBasic.Logging.FileLogTraceListener, Microsoft.VisualBasic, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" - initializeData="FileLogWriter" /> + <add name="FileLog" type="Microsoft.VisualBasic.Logging.FileLogTraceListener, Microsoft.VisualBasic, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" initializeData="FileLogWriter" /> <!-- Auskommentierung des nachfolgenden Abschnitts aufheben und APPLICATION_NAME durch den Namen der Anwendung ersetzen, um in das Anwendungsereignisprotokoll zu schreiben --> <!--<add name="EventLog" type="System.Diagnostics.EventLogTraceListener" initializeData="APPLICATION_NAME"/> --> </sharedListeners> diff --git a/VECTO/packages.config b/VECTO/packages.config index e020718ee1..e3880a1239 100644 --- a/VECTO/packages.config +++ b/VECTO/packages.config @@ -1,6 +1,8 @@ <?xml version="1.0" encoding="utf-8"?> <packages> <package id="iTextSharp" version="5.5.9" targetFramework="net45" /> + <package id="Microsoft.WindowsAPICodePack.Core" version="1.1.0" targetFramework="net45" /> + <package id="Microsoft.WindowsAPICodePack.Shell" version="1.1.0" targetFramework="net45" /> <package id="Newtonsoft.Json" version="8.0.3" targetFramework="net45" /> <package id="NLog" version="4.2.3" targetFramework="net45" /> </packages> \ No newline at end of file diff --git a/VectoCommon/VectoCommon/InputData/IImportPlugin.cs b/VectoCommon/VectoCommon/InputData/IImportPlugin.cs deleted file mode 100644 index 3123ae94eb..0000000000 --- a/VectoCommon/VectoCommon/InputData/IImportPlugin.cs +++ /dev/null @@ -1,42 +0,0 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -namespace TUGraz.VectoCommon.InputData -{ - public interface IImportPlugin - { - string Key { get; } - - string Name { get; } - - string ImportJob(); - } -} \ No newline at end of file diff --git a/VectoCommon/VectoCommon/InputData/IInputDataPlugin.cs b/VectoCommon/VectoCommon/InputData/IInputDataPlugin.cs deleted file mode 100644 index 45e6e3b1ec..0000000000 --- a/VectoCommon/VectoCommon/InputData/IInputDataPlugin.cs +++ /dev/null @@ -1,48 +0,0 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using System.Threading; - -namespace TUGraz.VectoCommon.InputData -{ - public interface IInputDataPlugin - { - string Key { get; } - - string Name { get; } - - bool CanHandleJob(string filename); - - IInputDataProvider ReadVectoJob(string filename); - - string[] KnownExtensions { get; } - } -} \ No newline at end of file diff --git a/VectoCommon/VectoCommon/OutputData/IExportPlugin.cs b/VectoCommon/VectoCommon/OutputData/IExportPlugin.cs deleted file mode 100644 index 95d9f0dffb..0000000000 --- a/VectoCommon/VectoCommon/OutputData/IExportPlugin.cs +++ /dev/null @@ -1,44 +0,0 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using TUGraz.VectoCommon.InputData; - -namespace TUGraz.VectoCommon.OutputData -{ - public interface IExportPlugin - { - string Key { get; } - - string Name { get; } - - void ExportJob(IInputDataProvider data); - } -} \ No newline at end of file diff --git a/VectoCommon/VectoCommon/Utils/PluginRegistry.cs b/VectoCommon/VectoCommon/Utils/PluginRegistry.cs deleted file mode 100644 index 59f8986518..0000000000 --- a/VectoCommon/VectoCommon/Utils/PluginRegistry.cs +++ /dev/null @@ -1,97 +0,0 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using System; -using System.Collections.Generic; -using System.Linq; -using TUGraz.VectoCommon.InputData; -using TUGraz.VectoCommon.OutputData; - -namespace TUGraz.VectoCommon.Utils -{ - public class PluginRegistry - { - private static PluginRegistry _instance; - - private readonly Dictionary<string, IExportPlugin> _exportPlugins = new Dictionary<string, IExportPlugin>(); - private readonly Dictionary<string, IImportPlugin> _importPlugins = new Dictionary<string, IImportPlugin>(); - private readonly Dictionary<string, IInputDataPlugin> _inputDataPlugins = new Dictionary<string, IInputDataPlugin>(); - - public static PluginRegistry Instance - { - get { return _instance ?? (_instance = new PluginRegistry()); } - } - - public void RegisterPlugin(IExportPlugin plugin) - { - _exportPlugins.Add(plugin.Key, plugin); - } - - public void RegisterPlugin(IImportPlugin plugin) - { - _importPlugins.Add(plugin.Key, plugin); - } - - public void RegisterPlugin(IInputDataPlugin plugin) - { - _inputDataPlugins.Add(plugin.Key, plugin); - } - - public IExportPlugin GetExportPlugin(string key) - { - return _exportPlugins.ContainsKey(key) ? _exportPlugins[key] : null; - } - - public IImportPlugin GetImportPlugin(string key) - { - return _importPlugins.ContainsKey(key) ? _importPlugins[key] : null; - } - - public IEnumerable<KeyValuePair<string, IInputDataPlugin>> GetInputDataPlugins() - { - return _inputDataPlugins.Select(x => x).ToList(); - } - - public IInputDataPlugin GetInputDataPlugin(string key) - { - return _inputDataPlugins.ContainsKey(key) ? _inputDataPlugins[key] : null; - } - - public IEnumerable<string> GetKnownInputExtensions() - { - var retVal = new List<string>(); - foreach (var entry in _inputDataPlugins) { - retVal.AddRange(entry.Value.KnownExtensions); - } - return retVal; - } - } -} \ No newline at end of file diff --git a/VectoCommon/VectoCommon/VectoCommon.csproj b/VectoCommon/VectoCommon/VectoCommon.csproj index 9142f35b21..206f60c8d4 100644 --- a/VectoCommon/VectoCommon/VectoCommon.csproj +++ b/VectoCommon/VectoCommon/VectoCommon.csproj @@ -45,8 +45,6 @@ </ItemGroup> <ItemGroup> <Compile Include="InputData\DataSourceType.cs" /> - <Compile Include="InputData\IImportPlugin.cs" /> - <Compile Include="InputData\IInputDataPlugin.cs" /> <Compile Include="InputData\TableData.cs"> <SubType>Component</SubType> </Compile> @@ -70,7 +68,6 @@ <Compile Include="Models\OperatingPoint.cs" /> <Compile Include="Models\RetarderType.cs" /> <Compile Include="Models\VehicleCategory.cs" /> - <Compile Include="OutputData\IExportPlugin.cs" /> <Compile Include="OutputData\IOutputFileWriter.cs" /> <Compile Include="OutputData\IOutputPlugin.cs" /> <Compile Include="Properties\AssemblyInfo.cs" /> @@ -78,7 +75,6 @@ <Compile Include="Utils\EnumerableExtensionMethods.cs" /> <Compile Include="Utils\EnumHelper.cs" /> <Compile Include="Utils\IntExtensionMethods.cs" /> - <Compile Include="Utils\PluginRegistry.cs" /> <Compile Include="Utils\SI.cs" /> <Compile Include="Utils\StringExtensionMethods.cs" /> <Compile Include="Utils\Validation.cs" /> diff --git a/VectoConsole/Program.cs b/VectoConsole/Program.cs index c43997ec13..3ec189ce53 100644 --- a/VectoConsole/Program.cs +++ b/VectoConsole/Program.cs @@ -36,6 +36,8 @@ using System.IO; using System.Linq; using System.Reflection; using System.Threading; +using System.Xml; +using System.Xml.Linq; using NLog; using NLog.Config; using NLog.Targets; @@ -44,9 +46,12 @@ using TUGraz.VectoCommon.Models; using TUGraz.VectoCommon.Utils; using TUGraz.VectoCore.Configuration; using TUGraz.VectoCore.InputData.FileIO.JSON; +using TUGraz.VectoCore.InputData.FileIO.XML.Declaration; +using TUGraz.VectoCore.InputData.FileIO.XML.Engineering; using TUGraz.VectoCore.Models.Simulation.Impl; using TUGraz.VectoCore.OutputData; using TUGraz.VectoCore.OutputData.FileIO; +using TUGraz.VectoCore.Resources; using LogManager = NLog.LogManager; namespace VectoConsole @@ -187,38 +192,41 @@ Examples: return 1; } - DetectPlugins(); - var plugins = PluginRegistry.Instance.GetInputDataPlugins().ToArray(); foreach (var file in jobFiles) { WriteLine(@"Reading job: " + file); - if (Path.GetExtension(file) == Constants.FileExtensions.VectoJobFile) { - var dataProvider = JSONInputDataFactory.ReadJsonJob(file); - fileWriter = new FileOutputWriter(file); - var runsFactory = new SimulatorFactory(mode, dataProvider, fileWriter) { - ModalResults1Hz = args.Contains("-1Hz"), - WriteModalResults = args.Contains("-mod"), - ActualModalData = args.Contains("-act") - }; - - _jobContainer.AddRuns(runsFactory); - } else { - var handled = false; - foreach (var plugin in plugins) { - if (!handled && plugin.Value.CanHandleJob(file)) { - WriteLine("using plugin: " + plugin.Value.Name); - var dataProvider = plugin.Value.ReadVectoJob(file); - fileWriter = new FileOutputWriter(file); - var runsFactory = new SimulatorFactory(mode, dataProvider, fileWriter) { - ModalResults1Hz = args.Contains("-1Hz"), - WriteModalResults = args.Contains("-mod"), - ActualModalData = args.Contains("-act") - }; - - _jobContainer.AddRuns(runsFactory); - handled = true; + var extension = Path.GetExtension(file); + IInputDataProvider dataProvider = null; + switch (extension) { + case Constants.FileExtensions.VectoJobFile: + dataProvider = JSONInputDataFactory.ReadJsonJob(file); + break; + case ".xml": + var xDocument = XDocument.Load(file); + var rootNode = xDocument == null ? "" : xDocument.Root.Name.LocalName; + switch (rootNode) { + case "VectoInputEngineering": + dataProvider = new XMLEngineeringInputDataProvider(file, true); + break; + case "VectoInputDeclaration": + dataProvider = new XMLInputDataProvider(XmlReader.Create(file), true); + break; } - } + break; } + + if (dataProvider == null) { + WriteLine(string.Format(@"failed to read job: '{0}'", file)); + continue; + } + + fileWriter = new FileOutputWriter(file); + var runsFactory = new SimulatorFactory(mode, dataProvider, fileWriter) { + ModalResults1Hz = args.Contains("-1Hz"), + WriteModalResults = args.Contains("-mod"), + ActualModalData = args.Contains("-act") + }; + + _jobContainer.AddRuns(runsFactory); } WriteLine(); @@ -302,33 +310,6 @@ Examples: Console.ResetColor(); } - private static void DetectPlugins() - { - var assemblies = new List<Assembly>(); - var dllFileNames = Directory.GetFiles(".", "*.dll"); - foreach (var dllFileName in dllFileNames) { - var assemblyName = AssemblyName.GetAssemblyName(dllFileName); - var assembly = Assembly.Load(assemblyName); - assemblies.Add(assembly); - } - var inputDataPluginType = typeof(IInputDataPlugin); - foreach (var assembly in assemblies) { - if (assembly == null) { - continue; - } - var types = assembly.GetTypes(); - foreach (var type in types) { - if (type.IsInterface || type.IsAbstract || type.GetInterface(inputDataPluginType.FullName) == null) { - continue; - } - var plugin = (IInputDataPlugin)Activator.CreateInstance(type); - if (plugin != null) { - PluginRegistry.Instance.RegisterPlugin(plugin); - } - } - } - } - private static void DisplayWarnings() { if (_quiet) { diff --git a/VectoConsole/VectoConsole.csproj b/VectoConsole/VectoConsole.csproj index d26900aee6..082fd87fc7 100644 --- a/VectoConsole/VectoConsole.csproj +++ b/VectoConsole/VectoConsole.csproj @@ -60,6 +60,7 @@ <Reference Include="System" /> <Reference Include="System.Core" /> <Reference Include="System.Xml" /> + <Reference Include="System.Xml.Linq" /> </ItemGroup> <ItemGroup> <Compile Include="Program.cs" /> diff --git a/VectoCore/VectoCore/VectoCore.csproj b/VectoCore/VectoCore/VectoCore.csproj index 73355b9518..83ce376e64 100644 --- a/VectoCore/VectoCore/VectoCore.csproj +++ b/VectoCore/VectoCore/VectoCore.csproj @@ -190,6 +190,7 @@ <Compile Include="OutputData\ModFilter\ModalData1HzFilter.cs" /> <Compile Include="OutputData\XML\AbstractXMLWriter.cs" /> <Compile Include="OutputData\XML\AttributeMappings.cs" /> + <Compile Include="OutputData\XML\XMLDeclarationReport.cs" /> <Compile Include="OutputData\XML\XMLDeclarationWriter.cs" /> <Compile Include="OutputData\XML\XMLEngineeringWriter.cs" /> <Compile Include="Resources\XMLNames.Designer.cs" /> @@ -336,7 +337,9 @@ <Compile Include="Utils\XPathHelper.cs" /> </ItemGroup> <ItemGroup> - <EmbeddedResource Include="Resources\XMLNames.resx" /> + <EmbeddedResource Include="Resources\XMLNames.resx"> + <SubType>Designer</SubType> + </EmbeddedResource> <None Include="app.config" /> <None Include="packages.config" /> <EmbeddedResource Include="JsonKeys.resx"> @@ -409,6 +412,9 @@ <SubType>Designer</SubType> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </EmbeddedResource> + <EmbeddedResource Include="Resources\XSD\VectoOutput.xsd"> + <SubType>Designer</SubType> + </EmbeddedResource> </ItemGroup> <ItemGroup> <EmbeddedResource Include="Resources\Declaration\Report\4x2r.png" /> -- GitLab