Code development platform for open source projects from the European Union institutions :large_blue_circle: EU Login authentication by SMS has been phased out. To see alternatives please check here

Skip to content
Snippets Groups Projects
Commit 57bd2141 authored by Markus QUARITSCH's avatar Markus QUARITSCH
Browse files

refactoring XML reading: use version-specific reader classes, use ninject for...

refactoring XML reading: use version-specific reader classes, use ninject for loading correct classes
parent bc580c68
No related branches found
No related tags found
No related merge requests found
Showing
with 203 additions and 120 deletions
......@@ -3,4 +3,12 @@
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Ninject" publicKeyToken="c7192dc5380945e7" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.3.4.0" newVersion="3.3.4.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
\ No newline at end of file
......@@ -40,6 +40,7 @@ using System.Xml.Schema;
using TUGraz.VectoCommon.Hashing;
using TUGraz.VectoCore.Utils;
using TUGraz.VectoHashing;
using XmlDocumentType = TUGraz.VectoCore.Utils.XmlDocumentType;
namespace HashingCmd
{
......@@ -159,8 +160,7 @@ hashingcmd.exe
writer.Close();
if (_validateXML) {
new XMLValidator(XmlReader.Create(destination), null, ValidationCallBack).ValidateXML(XMLValidator.XmlDocumentType
.DeclarationComponentData);
new XMLValidator(XmlReader.Create(destination), null, ValidationCallBack).ValidateXML(XmlDocumentType.DeclarationComponentData);
WriteLine("Valid", ConsoleColor.Green);
}
......@@ -181,8 +181,8 @@ hashingcmd.exe
private static void ValidateFile(string filename)
{
new XMLValidator(XmlReader.Create(filename),null, ValidationCallBack).ValidateXML(
XMLValidator.XmlDocumentType.DeclarationJobData | XMLValidator.XmlDocumentType.CustomerReport |
XMLValidator.XmlDocumentType.ManufacturerReport | XMLValidator.XmlDocumentType.DeclarationComponentData);
XmlDocumentType.DeclarationJobData | XmlDocumentType.CustomerReport |
XmlDocumentType.ManufacturerReport | XmlDocumentType.DeclarationComponentData);
}
private static void ReadHashAction(string filename, VectoHash h)
......
......@@ -3,4 +3,12 @@
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Ninject" publicKeyToken="c7192dc5380945e7" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.3.4.0" newVersion="3.3.4.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
\ No newline at end of file
......@@ -46,7 +46,7 @@ namespace HashingTool.Util
_validator = new XMLValidator(xml, resultaction, validationErrorAction);
}
public Task<bool> ValidateXML(TUGraz.VectoCore.Utils.XMLValidator.XmlDocumentType docType)
public Task<bool> ValidateXML(TUGraz.VectoCore.Utils.XmlDocumentType docType)
{
var task = new Task<bool>(() => _validator.ValidateXML(docType));
task.Start();
......
......@@ -30,7 +30,6 @@
*/
using System;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.IO;
using System.Linq;
......@@ -43,9 +42,7 @@ using System.Xml.Schema;
using HashingTool.Helper;
using HashingTool.Util;
using HashingTool.ViewModel.UserControl;
using TUGraz.VectoCore.Utils;
using TUGraz.VectoHashing;
using TUGraz.VectoHashing.Impl;
namespace HashingTool.ViewModel
{
......@@ -172,7 +169,7 @@ namespace HashingTool.ViewModel
: e.ValidationEventArgs.Message,
e.ValidationEventArgs == null ? 0 : e.ValidationEventArgs.Exception.LineNumber)));
});
await validator.ValidateXML(XMLValidator.XmlDocumentType.DeclarationComponentData);
await validator.ValidateXML(TUGraz.VectoCore.Utils.XmlDocumentType.DeclarationComponentData);
}
if (ComponentDataValid != null && ComponentDataValid.Value) {
//var c14N = XMLHashProvider.DefaultCanonicalizationMethod.ToArray();
......
......@@ -41,6 +41,7 @@ using System.Xml.Schema;
using HashingTool.Helper;
using HashingTool.Util;
using TUGraz.VectoCore.Utils;
using XmlDocumentType = TUGraz.VectoCore.Utils.XmlDocumentType;
namespace HashingTool.ViewModel.UserControl
{
......@@ -282,7 +283,7 @@ namespace HashingTool.ViewModel.UserControl
: e.ValidationEventArgs.Message,
e.ValidationEventArgs == null ? 0 : e.ValidationEventArgs.Exception.LineNumber)));
});
await validator.ValidateXML(XMLValidator.XmlDocumentType.DeclarationComponentData | XMLValidator.XmlDocumentType.DeclarationJobData | XMLValidator.XmlDocumentType.CustomerReport | XMLValidator.XmlDocumentType.ManufacturerReport);
await validator.ValidateXML(XmlDocumentType.DeclarationComponentData | XmlDocumentType.DeclarationJobData | XmlDocumentType.CustomerReport | XmlDocumentType.ManufacturerReport);
} catch (Exception e) {
LogError(e.Message);
}
......
......@@ -3,4 +3,12 @@
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Ninject" publicKeyToken="c7192dc5380945e7" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.3.4.0" newVersion="3.3.4.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
\ No newline at end of file
......@@ -3,4 +3,12 @@
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Ninject" publicKeyToken="c7192dc5380945e7" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.3.4.0" newVersion="3.3.4.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
\ No newline at end of file
......@@ -75,7 +75,7 @@ Public Class EngineForm
Dim inputData As IEngineeringInputDataProvider = TryCast(JSONInputDataFactory.ReadJsonJob(jobFile),
IEngineeringInputDataProvider)
If (not inputData Is Nothing) Then
Dim gbx as IGearboxDeclarationInputData = inputData.JobInputData.Vehicle.GearboxInputData
Dim gbx as IGearboxDeclarationInputData = inputData.JobInputData.Vehicle.Components.GearboxInputData
gbxType = gbx.Type
End If
End If
......@@ -179,7 +179,7 @@ Public Class EngineForm
Dim inputData As IEngineeringInputDataProvider = TryCast(JSONInputDataFactory.ReadComponentData(file),
IEngineeringInputDataProvider)
engine = inputData.JobInputData.Vehicle.EngineInputData
engine = inputData.JobInputData.Vehicle.Components.EngineInputData
If Cfg.DeclMode <> engine.SavedInDeclarationMode Then
......
......@@ -240,8 +240,8 @@ Public Class GearboxForm
Dim inputData As IEngineeringInputDataProvider = TryCast(JSONInputDataFactory.ReadComponentData(file),
IEngineeringInputDataProvider)
Dim vehicle As IVehicleEngineeringInputData = inputData.JobInputData.Vehicle
Dim gearbox As IGearboxEngineeringInputData = vehicle.GearboxInputData
Dim axlegear As IAxleGearInputData = vehicle.AxleGearInputData
Dim gearbox As IGearboxEngineeringInputData = vehicle.Components.GearboxInputData
Dim axlegear As IAxleGearInputData = vehicle.Components.AxleGearInputData
_vehicleCategory = vehicleCategory
......@@ -810,7 +810,7 @@ Public Class GearboxForm
End If
Dim vehicle As IVehicleEngineeringInputData = inputData.JobInputData.Vehicle
'inputData = TryCast(JSONInputDataFactory.ReadComponentData(vectoJob.PathEng(False)), IEngineeringInputDataProvider)
Dim engine As IEngineEngineeringInputData = inputData.JobInputData.Vehicle.EngineInputData
Dim engine As IEngineEngineeringInputData = inputData.JobInputData.Vehicle.Components.EngineInputData
Dim engineFld As EngineFullLoadCurve = FullLoadCurveReader.Create(engine.FullLoadCurve)
......@@ -908,10 +908,10 @@ Public Class GearboxForm
End If
Dim rDyn As Meter = vehicle.DynamicTyreRadius
If rDyn.IsEqual(0) Then
If (vehicle.Axles.Count < 2) Then
If (vehicle.Components.AxleWheels.AxlesEngineering.Count < 2) Then
Return Nothing
End If
rdyn = vehicle.Axles.Where(Function(axle) axle.AxleType = AxleType.VehicleDriven) _
rdyn = vehicle.Components.AxleWheels.AxlesEngineering.Where(Function(axle) axle.AxleType = AxleType.VehicleDriven) _
.Select(Function(da) DeclarationData.Wheels.Lookup(da.Tyre.Dimension).DynamicTyreRadius) _
.Average()
End If
......@@ -1057,7 +1057,7 @@ Public Class GearboxForm
End If
Dim vehicle As IVehicleEngineeringInputData = inputData.JobInputData.Vehicle
Dim engine As IEngineEngineeringInputData = vehicle.EngineInputData
Dim engine As IEngineEngineeringInputData = vehicle.Components.EngineInputData
Dim engineFld As EngineFullLoadCurve = FullLoadCurveReader.Create(engine.FullLoadCurve)
If VectoJobForm.Visible AndAlso engine.IdleSpeed > 0 Then
......
......@@ -41,11 +41,14 @@ Imports System.Threading
Imports System.Xml
Imports System.Xml.Linq
Imports Microsoft.VisualBasic.FileIO
Imports Ninject
Imports TUGraz.VectoCommon.Exceptions
Imports TUGraz.VectoCommon.InputData
Imports TUGraz.VectoCommon.Models
Imports TUGraz.VectoCommon.Resources
Imports TUGraz.VectoCommon.Utils
Imports TUGraz.VectoCore
Imports TUGraz.VectoCore.InputData.FileIO.XML
Imports TUGraz.VectoCore.InputData.FileIO.XML.Declaration
Imports TUGraz.VectoCore.InputData.FileIO.XML.Engineering
Imports TUGraz.VectoCore.OutputData
......@@ -966,11 +969,13 @@ Imports TUGraz.VectoCore.Utils
Case ".xml"
Dim xDocument As XDocument = xDocument.Load(jobFile)
Dim rootNode As String = If(xDocument Is Nothing, "", xDocument.Root.Name.LocalName)
Dim kernel as IKernel = New StandardKernel(new VectoNinjectModule)
Dim xmlInputReader as IXMLInputDataReader = kernel.Get(Of IXMLInputDataReader)
Select Case rootNode
Case XMLNames.VectoInputEngineering
input = New XMLEngineeringInputDataProvider(jobFile, True)
Case XMLNames.VectoInputDeclaration
input = New XMLDeclarationInputDataProvider(XmlReader.Create(jobFile), True)
input = xmlInputReader.CreateDeclaration(XmlReader.Create(jobFile), True)
End Select
End Select
......@@ -2029,11 +2034,13 @@ Imports TUGraz.VectoCore.Utils
Case ".xml"
Dim xDocument As XDocument = xDocument.Load(f)
Dim rootNode As String = If(xDocument Is Nothing, "", xDocument.Root.Name.LocalName)
Dim kernel as IKernel = New StandardKernel(new VectoNinjectModule)
Dim xmlInputReader as IXMLInputDataReader = kernel.Get(Of IXMLInputDataReader)
Select Case rootNode
Case XMLNames.VectoInputEngineering
input = New XMLEngineeringInputDataProvider(f, True)
Case XMLNames.VectoInputDeclaration
input = New XMLDeclarationInputDataProvider(XmlReader.Create(f), True)
input = xmlInputReader.CreateDeclaration(XmlReader.Create(f), True)
End Select
End Select
......
......@@ -423,7 +423,7 @@ Public Class VectoJobForm
'Update Form
If inputData.JobInputData().EngineOnlyMode Then
TbENG.Text = GetRelativePath(inputData.JobInputData.EngineOnly.Source, _basePath)
TbENG.Text = GetRelativePath(inputData.JobInputData.EngineOnly.DataSource.SourceFile, _basePath)
CbEngOnly.Checked = True
Try
Dim sb As ICycleData
......@@ -440,9 +440,9 @@ Public Class VectoJobForm
CbEngOnly.Checked = False
CheckEngOnly()
'Files -----------------------------
TbVEH.Text = GetRelativePath(inputData.JobInputData.Vehicle.Source, _basePath)
TbENG.Text = GetRelativePath(inputData.JobInputData.Vehicle.EngineInputData.Source, _basePath)
TbGBX.Text = GetRelativePath(inputData.JobInputData.Vehicle.GearboxInputData.Source, _basePath)
TbVEH.Text = GetRelativePath(inputData.JobInputData.Vehicle.DataSource.SourceFile, _basePath)
TbENG.Text = GetRelativePath(inputData.JobInputData.Vehicle.Components.EngineInputData.DataSource.SourceFile, _basePath)
TbGBX.Text = GetRelativePath(inputData.JobInputData.Vehicle.Components.GearboxInputData.DataSource.SourceFile, _basePath)
'Start/Stop
Dim driver As IDriverEngineeringInputData = inputData.DriverInputData
......@@ -452,7 +452,7 @@ Public Class VectoJobForm
'AA-TB
'Try and Select any previously selected Auxiliary Type
Dim declarationInput As IDeclarationInputDataProvider = CType(inputData, IDeclarationInputDataProvider)
Dim auxInput As IAuxiliariesDeclarationInputData = declarationInput.JobInputData.Vehicle.AuxiliaryInputData()
Dim auxInput As IAuxiliariesDeclarationInputData = declarationInput.JobInputData.Vehicle.Components.AuxiliaryInputData
cboAdvancedAuxiliaries.SelectedIndex = 0
cboAdvancedAuxiliaries.Enabled = False
......@@ -472,7 +472,7 @@ Public Class VectoJobForm
If(driver.AccelerationCurve Is Nothing, "", GetRelativePath(driver.AccelerationCurve.Source, _basePath))
cboAdvancedAuxiliaries.Enabled = True
Dim auxInput As IAuxiliariesEngineeringInputData = inputData.JobInputData.Vehicle.AuxiliaryInputData()
Dim auxInput As IAuxiliariesEngineeringInputData = inputData.JobInputData.Vehicle.Components.AuxiliaryInputData
For Each item As AdvancedAuxiliary In cboAdvancedAuxiliaries.Items
If _
AuxiliaryModelHelper.Parse(item.AssemblyName) = auxInput.AuxiliaryAssembly AndAlso
......@@ -1144,7 +1144,7 @@ lbDlog:
Try
Dim inputData As IEngineeringInputDataProvider = TryCast(JSONInputDataFactory.ReadComponentData(gearboxFile),
IEngineeringInputDataProvider)
gearbox = inputData.JobInputData.Vehicle.GearboxInputData
gearbox = inputData.JobInputData.Vehicle.Components.GearboxInputData
Catch
End Try
End If
......@@ -1228,7 +1228,7 @@ lbDlog:
Try
Dim inputData As IEngineeringInputDataProvider = TryCast(JSONInputDataFactory.ReadComponentData(engineFile),
IEngineeringInputDataProvider)
engine = inputData.JobInputData.Vehicle.EngineInputData
engine = inputData.JobInputData.Vehicle.Components.EngineInputData
Catch
Return
End Try
......
......@@ -15,11 +15,14 @@ Imports System.IO
Imports System.Linq
Imports System.Windows.Forms.DataVisualization.Charting
Imports System.Xml
Imports Ninject
Imports TUGraz.VECTO.Input_Files
Imports TUGraz.VectoCommon.InputData
Imports TUGraz.VectoCommon.Models
Imports TUGraz.VectoCommon.Utils
Imports TUGraz.VectoCore
Imports TUGraz.VectoCore.InputData.FileIO.JSON
Imports TUGraz.VectoCore.InputData.FileIO.XML
Imports TUGraz.VectoCore.InputData.FileIO.XML.Declaration
Imports TUGraz.VectoCore.InputData.Reader
Imports TUGraz.VectoCore.Models.Declaration
......@@ -39,6 +42,8 @@ Public Class VectoVTPJobForm
Private _auxDialog As VehicleAuxiliariesDialog
Dim _xmlInputReader as IXMLInputDataReader
Enum AuxViewColumns
AuxID = 0
AuxType = 1
......@@ -49,6 +54,9 @@ Public Class VectoVTPJobForm
'Initialise form
Private Sub F02_GEN_Load(sender As Object, e As EventArgs) Handles Me.Load
Dim kernel as IKernel = New StandardKernel(new VectoNinjectModule)
_xmlInputReader = kernel.Get(Of IXMLInputDataReader)
_auxDialog = New VehicleAuxiliariesDialog
......@@ -191,11 +199,11 @@ Public Class VectoVTPJobForm
'Files -----------------------------
TbVEH.Text = GetRelativePath(inputData.JobInputData.Vehicle.Source, _basePath)
TbVEH.Text = GetRelativePath(inputData.JobInputData.Vehicle.DataSource.SourceFile, _basePath)
tbManufacturerRecord.Text =
If (cfg.DeclMode, GetRelativePath(inputData.JobInputData.ManufacturerReportInputData.Source, _basePath), "")
Dim auxInput As IAuxiliariesDeclarationInputData = inputData.JobInputData.Vehicle.AuxiliaryInputData()
Dim auxInput As IAuxiliariesDeclarationInputData = inputData.JobInputData.Vehicle.Components.AuxiliaryInputData
PopulateAuxiliaryList(auxInput)
......@@ -367,9 +375,9 @@ Public Class VectoVTPJobForm
TbVEH.Text)
If File.Exists(vehicleFile) Then
Try
Dim inputData As XMLDeclarationInputDataProvider =
New XMLDeclarationInputDataProvider(XmlReader.Create(vehicleFile), True)
Dim auxInput As IAuxiliariesDeclarationInputData = inputData.JobInputData.Vehicle.AuxiliaryInputData()
Dim inputData As IDeclarationInputDataProvider =
_xmlInputReader.CreateDeclaration(XmlReader.Create(vehicleFile), True)
Dim auxInput As IAuxiliariesDeclarationInputData = inputData.JobInputData.Vehicle.Components.AuxiliaryInputData
PopulateAuxiliaryList(auxInput)
Catch
End Try
......@@ -550,9 +558,9 @@ Public Class VectoVTPJobForm
TbVEH.Text)
If File.Exists(vehicleFile) Then
Try
Dim inputData As XMLDeclarationInputDataProvider =
New XMLDeclarationInputDataProvider(XmlReader.Create(vehicleFile), True)
gearbox = inputData.JobInputData.Vehicle.GearboxInputData
Dim inputData As IDeclarationInputDataProvider =
_xmlInputReader.CreateDeclaration(XmlReader.Create(vehicleFile), True)
gearbox = inputData.JobInputData.Vehicle.Components.GearboxInputData
Catch
End Try
End If
......@@ -574,9 +582,9 @@ Public Class VectoVTPJobForm
TbVEH.Text)
If File.Exists(vehicleFile) Then
Try
Dim inputData As XMLDeclarationInputDataProvider =
New XMLDeclarationInputDataProvider(XmlReader.Create(vehicleFile), True)
engine = inputData.JobInputData.Vehicle.EngineInputData
Dim inputData As IDeclarationInputDataProvider =
_xmlInputReader.CreateDeclaration(XmlReader.Create(vehicleFile), True)
engine = inputData.JobInputData.Vehicle.Components.EngineInputData
Catch
Return
End Try
......@@ -653,8 +661,8 @@ Public Class VectoVTPJobForm
TbVEH.Text)
If File.Exists(vehicleFile) Then
Try
Dim inputData As XMLDeclarationInputDataProvider =
New XMLDeclarationInputDataProvider(XmlReader.Create(vehicleFile), True)
Dim inputData As IDeclarationInputDataProvider =
_xmlInputReader.CreateDeclaration(XmlReader.Create(vehicleFile), True)
vehicle = inputData.JobInputData.Vehicle
Catch
End Try
......
......@@ -347,10 +347,10 @@ Public Class VehicleForm
Dim inputData As IEngineeringInputDataProvider = TryCast(JSONInputDataFactory.ReadComponentData(file),
IEngineeringInputDataProvider)
Dim vehicle As IVehicleEngineeringInputData = inputData.JobInputData.Vehicle
Dim airdrag As IAirdragEngineeringInputData = inputData.JobInputData.Vehicle.AirdragInputData
Dim retarder As IRetarderInputData = inputData.JobInputData.Vehicle.RetarderInputData
Dim angledrive As IAngledriveInputData = inputData.JobInputData.Vehicle.AngledriveInputData
Dim pto As IPTOTransmissionInputData = inputData.JobInputData.Vehicle.PTOTransmissionInputData
Dim airdrag As IAirdragEngineeringInputData = inputData.JobInputData.Vehicle.Components.AirdragInputData
Dim retarder As IRetarderInputData = inputData.JobInputData.Vehicle.Components.RetarderInputData
Dim angledrive As IAngledriveInputData = inputData.JobInputData.Vehicle.Components.AngledriveInputData
Dim pto As IPTOTransmissionInputData = inputData.JobInputData.Vehicle.Components.PTOTransmissionInputData
If Cfg.DeclMode <> vehicle.SavedInDeclarationMode Then
Select Case WrongMode()
......@@ -387,7 +387,7 @@ Public Class VehicleForm
LvRRC.Items.Clear()
Dim i As Integer = 0
Dim a0 As IAxleEngineeringInputData
For Each a0 In vehicle.Axles
For Each a0 In vehicle.Components.AxleWheels.AxlesEngineering
i += 1
If Cfg.DeclMode Then
Dim inertia As Double = DeclarationData.Wheels.Lookup(a0.Tyre.Dimension).Inertia.Value()
......
......@@ -269,17 +269,15 @@ Public Class Engine
#Region "IInputData"
Public ReadOnly Property SourceType As DataSourceType Implements IComponentInputData.SourceType
Public ReadOnly Property DataSource As DataSource Implements IComponentInputData.DataSource
Get
Return DataSourceType.JSONFile
Dim retVal As DataSource = New DataSource()
retVal.SourceType = DataSourceType.JSONFile
retVal.SourceFile = FilePath
Return retVal
End Get
End Property
Public ReadOnly Property Source As String Implements IComponentInputData.Source
Get
Return FilePath
End Get
End Property
Public ReadOnly Property SavedInDeclarationMode As Boolean Implements IComponentInputData.SavedInDeclarationMode
Get
......
......@@ -217,7 +217,7 @@ Public Class Gearbox
Try
engine = doa.CreateEngineData(inputData.JobInputData.Vehicle.EngineInputData, Nothing, gearbox, New List(Of ITorqueLimitInputData), TankSystem.Compressed)
engine = doa.CreateEngineData(inputData.JobInputData.Vehicle.Components.EngineInputData, Nothing, gearbox, New List(Of ITorqueLimitInputData), TankSystem.Compressed)
Catch
engine = GetDefaultEngine(gearbox.Gears)
End Try
......@@ -227,7 +227,7 @@ Public Class Gearbox
Else
Dim doa As EngineeringDataAdapter = New EngineeringDataAdapter()
Try
engine = doa.CreateEngineData(inputData.JobInputData.Vehicle.EngineInputData, gearbox, New List(Of ITorqueLimitInputData), TankSystem.Compressed)
engine = doa.CreateEngineData(inputData.JobInputData.Vehicle.Components.EngineInputData, gearbox, New List(Of ITorqueLimitInputData), TankSystem.Compressed)
Catch
engine = GetDefaultEngine(gearbox.Gears)
End Try
......@@ -286,15 +286,12 @@ Public Class Gearbox
End Function
Public ReadOnly Property SourceType As DataSourceType Implements IComponentInputData.SourceType
Public ReadOnly Property DataSource As DataSource Implements IComponentInputData.DataSource
Get
Return DataSourceType.JSONFile
End Get
End Property
Public ReadOnly Property Source As String Implements IComponentInputData.Source
Get
Return FilePath
Dim retVal As DataSource = New DataSource()
retVal.SourceType = DataSourceType.JSONFile
retVal.SourceFile = FilePath
Return retVal
End Get
End Property
......
......@@ -4,13 +4,16 @@ Imports System.ComponentModel.DataAnnotations
Imports System.IO
Imports System.Linq
Imports System.Xml
Imports Ninject
Imports TUGraz.VECTO.Input_Files
Imports TUGraz.VectoCommon.Exceptions
Imports TUGraz.VectoCommon.Hashing
Imports TUGraz.VectoCommon.InputData
Imports TUGraz.VectoCommon.Models
Imports TUGraz.VectoCommon.Utils
Imports TUGraz.VectoCore
Imports TUGraz.VectoCore.InputData.FileIO.JSON
Imports TUGraz.VectoCore.InputData.FileIO.XML
Imports TUGraz.VectoCore.InputData.FileIO.XML.Declaration
Imports TUGraz.VectoCore.InputData.Impl
Imports TUGraz.VectoCore.Models.Declaration
......@@ -32,11 +35,15 @@ Public Class VectoVTPJob
Public FanCoefficients As Double()
Private _fanDiameter As Meter
Private _xmlInputReader As IXMLInputDataReader
Public Sub New()
CycleFiles = New List(Of SubPath)
_vehicleFile = New SubPath
_manufacturerRecord = New SubPath()
Dim kernel as IKernel = New StandardKernel(new VectoNinjectModule)
_xmlInputReader = kernel.Get(Of IXMLInputDataReader)
End Sub
Public Property FilePath As String
......@@ -115,7 +122,7 @@ Public Class VectoVTPJob
Get
If Not File.Exists(_vehicleFile.FullPath) Then Return Nothing
'Return New JSONComponentInputData(_vehicleFile.FullPath).JobInputData.Vehicle
Return New XMLDeclarationInputDataProvider(_vehicleFile.FullPath, True).JobInputData.Vehicle
Return _xmlInputReader.CreateDeclaration(_vehicleFile.FullPath, True).JobInputData.Vehicle
End Get
End Property
......
......@@ -350,8 +350,8 @@ Public Class VectoJob
Dim result As IList(Of ValidationResult) = New List(Of ValidationResult)
Dim vehicleInputData As IVehicleEngineeringInputData = vectoJob.JobInputData.Vehicle
Dim engineInputData As IEngineDeclarationInputData = vectoJob.JobInputData.Vehicle.EngineInputData
Dim gearboxInputData As IGearboxDeclarationInputData = vectoJob.Vehicle.GearboxInputData
Dim engineInputData As IEngineDeclarationInputData = vectoJob.JobInputData.Vehicle.Components.EngineInputData
Dim gearboxInputData As IGearboxDeclarationInputData = vectoJob.Vehicle.Components.GearboxInputData
If vehicleInputData Is Nothing Then _
result.Add(New ValidationResult("Vehicle File is missing or invalid"))
......@@ -513,7 +513,7 @@ Public Class VectoJob
Public ReadOnly Property IEngineeringJobInputData_EngineOnly As IEngineEngineeringInputData Implements IEngineeringJobInputData.EngineOnly
Get
If Not File.Exists(_engineFile.FullPath) Then Return Nothing
Return New JSONComponentInputData(_engineFile.FullPath, Me).JobInputData.Vehicle.EngineInputData
Return New JSONComponentInputData(_engineFile.FullPath, Me).JobInputData.Vehicle.Components.EngineInputData
End Get
End Property
......@@ -604,27 +604,27 @@ Public Class VectoJob
Public ReadOnly Property Gearbox As IGearboxEngineeringInputData Implements IJSONVehicleComponents.Gearbox
Get
Return New JSONComponentInputData(_gearboxFile.FullPath, Me).JobInputData.Vehicle.GearboxInputData
Return New JSONComponentInputData(_gearboxFile.FullPath, Me).JobInputData.Vehicle.Components.GearboxInputData
End Get
End Property
Public ReadOnly Property TorqueConverter As ITorqueConverterEngineeringInputData Implements IJSONVehicleComponents.TorqueConverter
Get
Return New JSONComponentInputData(_gearboxFile.FullPath, Me).JobInputData.Vehicle.TorqueConverterInputData
Return New JSONComponentInputData(_gearboxFile.FullPath, Me).JobInputData.Vehicle.Components.TorqueConverterInputData
End Get
End Property
Public ReadOnly Property AxleGear As IAxleGearInputData Implements IJSONVehicleComponents.AxleGear
Get
Return New JSONComponentInputData(_gearboxFile.FullPath, Me).JobInputData.Vehicle.AxleGearInputData
Return New JSONComponentInputData(_gearboxFile.FullPath, Me).JobInputData.Vehicle.Components.AxleGearInputData
End Get
End Property
Public ReadOnly Property Engine As IEngineEngineeringInputData Implements IJSONVehicleComponents.Engine
Get
Return New JSONComponentInputData(_engineFile.FullPath, Me).JobInputData.Vehicle.EngineInputData
Return New JSONComponentInputData(_engineFile.FullPath, Me).JobInputData.Vehicle.Components.EngineInputData
End Get
End Property
......
......@@ -28,7 +28,8 @@ Imports TUGraz.VectoCore.Utils
<CustomValidation(GetType(Vehicle), "ValidateVehicle")>
Public Class Vehicle
Implements IVehicleEngineeringInputData, IVehicleDeclarationInputData, IRetarderInputData, IPTOTransmissionInputData,
IAngledriveInputData, IAirdragEngineeringInputData, IAdvancedDriverAssistantSystemDeclarationInputData
IAngledriveInputData, IAirdragEngineeringInputData, IAdvancedDriverAssistantSystemDeclarationInputData,
IVehicleComponentsEngineering, IVehicleComponentsDeclaration, IAxlesEngineeringInputData, IAxlesDeclarationInputData
Private _filePath As String
Private _path As String
......@@ -248,15 +249,12 @@ Public Class Vehicle
#Region "IInputData"
Public ReadOnly Property SourceType As DataSourceType Implements IComponentInputData.SourceType
Public ReadOnly Property DataSource As DataSource Implements IComponentInputData.DataSource
Get
Return DataSourceType.JSONFile
End Get
End Property
Public ReadOnly Property Source As String Implements IComponentInputData.Source
Get
Return FilePath
Dim retVal As DataSource = New DataSource()
retVal.SourceType = DataSourceType.JSONFile
retVal.SourceFile = FilePath
Return retVal
End Get
End Property
......@@ -320,6 +318,12 @@ Public Class Vehicle
End Get
End Property
Public ReadOnly Property Identifier As String Implements IVehicleDeclarationInputData.Identifier
get
Return ""
End Get
End Property
Public ReadOnly Property ExemptedVehicle As Boolean Implements IVehicleDeclarationInputData.ExemptedVehicle
get
Return false
......@@ -377,14 +381,14 @@ Public Class Vehicle
End Property
Public ReadOnly Property IVehicleEngineeringInputData_Axles As IList(Of IAxleEngineeringInputData) _
Implements IVehicleEngineeringInputData.Axles
Implements IAxlesEngineeringInputData.AxlesEngineering
Get
Return Axles.Cast(Of IAxleEngineeringInputData)().ToList()
End Get
End Property
Public ReadOnly Property IVehicleDeclarationInputData_Axles As IList(Of IAxleDeclarationInputData) _
Implements IVehicleDeclarationInputData.Axles
Implements IAxlesDeclarationInputData.AxlesDeclaration
Get
Return Axles.Cast(Of IAxleDeclarationInputData)().ToList()
End Get
......@@ -403,6 +407,8 @@ Public Class Vehicle
End Get
End Property
Public ReadOnly Property IVehicleEngineeringInputData_Components As IVehicleComponentsEngineering Implements IVehicleEngineeringInputData.Components
Public ReadOnly Property CrosswindCorrectionMap As TableData _
Implements IAirdragEngineeringInputData.CrosswindCorrectionMap
Get
......@@ -505,21 +511,21 @@ Public Class Vehicle
Public ReadOnly Property IDeclarationInputDataProvider_AirdragInputData As IAirdragDeclarationInputData _
Implements IVehicleDeclarationInputData.AirdragInputData
Implements IVehicleComponentsDeclaration.AirdragInputData
Get
Return AirdragInputData
End Get
End Property
Public ReadOnly Property AirdragInputData As IAirdragEngineeringInputData _
Implements IVehicleEngineeringInputData.AirdragInputData
Implements IVehicleComponentsEngineering.AirdragInputData
Get
Return Me
End Get
End Property
Public ReadOnly Property IDeclarationInputDataProvider_GearboxInputData As IGearboxDeclarationInputData _
Implements IVehicleDeclarationInputData.GearboxInputData
Implements IVehicleComponentsDeclaration.GearboxInputData
Get
Return Nothing
'If Not File.Exists(_gearboxFile.FullPath) Then Return Nothing
......@@ -528,7 +534,7 @@ Public Class Vehicle
End Property
Public ReadOnly Property GearboxInputData As IGearboxEngineeringInputData _
Implements IVehicleEngineeringInputData.GearboxInputData
Implements IVehicleComponentsEngineering.GearboxInputData
Get
Return Nothing
'If Not File.Exists(_gearboxFile.FullPath) Then Return Nothing
......@@ -537,7 +543,7 @@ Public Class Vehicle
End Property
Public ReadOnly Property IDeclarationInputDataProvider_TorqueConverterInputData As ITorqueConverterDeclarationInputData _
Implements IVehicleDeclarationInputData.TorqueConverterInputData
Implements IVehicleComponentsDeclaration.TorqueConverterInputData
Get
Return Nothing
'If Not File.Exists(_gearboxFile.FullPath) Then Return Nothing
......@@ -546,7 +552,7 @@ Public Class Vehicle
End Property
Public ReadOnly Property TorqueConverterInputData As ITorqueConverterEngineeringInputData _
Implements IVehicleEngineeringInputData.TorqueConverterInputData
Implements IVehicleComponentsEngineering.TorqueConverterInputData
Get
Return Nothing
'If Not File.Exists(_gearboxFile.FullPath) Then Return Nothing
......@@ -555,7 +561,7 @@ Public Class Vehicle
End Property
Public ReadOnly Property IDeclarationInputDataProvider_AxleGearInputData As IAxleGearInputData _
Implements IVehicleDeclarationInputData.AxleGearInputData
Implements IVehicleComponentsDeclaration.AxleGearInputData
Get
Return Nothing
'If Not File.Exists(_gearboxFile.FullPath) Then Return Nothing
......@@ -564,7 +570,7 @@ Public Class Vehicle
End Property
Public ReadOnly Property AxleGearInputData As IAxleGearInputData _
Implements IVehicleEngineeringInputData.AxleGearInputData
Implements IVehicleComponentsEngineering.AxleGearInputData
Get
Return Nothing
'If Not File.Exists(_gearboxFile.FullPath) Then Return Nothing
......@@ -573,21 +579,21 @@ Public Class Vehicle
End Property
Public ReadOnly Property DeclarationInputDataProviderAngledriveInputData As IAngledriveInputData _
Implements IVehicleDeclarationInputData.AngledriveInputData
Implements IVehicleComponentsDeclaration.AngledriveInputData
Get
Return Me
End Get
End Property
Public ReadOnly Property AngledriveInputData As IAngledriveInputData _
Implements IVehicleEngineeringInputData.AngledriveInputData
Implements IVehicleComponentsEngineering.AngledriveInputData
Get
Return Me
End Get
End Property
Public ReadOnly Property IDeclarationInputDataProvider_EngineInputData As IEngineDeclarationInputData _
Implements IVehicleDeclarationInputData.EngineInputData
Implements IVehicleComponentsDeclaration.EngineInputData
Get
Return Nothing
'If Not File.Exists(_engineFile.FullPath) Then Return Nothing
......@@ -596,7 +602,7 @@ Public Class Vehicle
End Property
Public ReadOnly Property EngineInputData As IEngineEngineeringInputData _
Implements IVehicleEngineeringInputData.EngineInputData
Implements IVehicleComponentsEngineering.EngineInputData
Get
Return Nothing
'If Not File.Exists(_engineFile.FullPath) Then Return Nothing
......@@ -604,27 +610,28 @@ Public Class Vehicle
End Get
End Property
Public Function AuxiliaryInputData() As IAuxiliariesEngineeringInputData _
Implements IVehicleEngineeringInputData.AuxiliaryInputData
Public ReadOnly Property IVehicleComponentsDeclaration_AuxiliaryInputData As IAuxiliariesDeclarationInputData Implements IVehicleComponentsDeclaration.AuxiliaryInputData
get
return nothing
End Get
End Property
Public ReadOnly Property AuxiliaryInputData As IAuxiliariesEngineeringInputData Implements IVehicleComponentsEngineering.AuxiliaryInputData
get
Return Nothing
End Function
Public Function IDeclarationInputDataProvider_AuxiliaryInputData() As IAuxiliariesDeclarationInputData _
Implements IVehicleDeclarationInputData.AuxiliaryInputData
End Get
End Property
Return Nothing
End Function
Public ReadOnly Property IDeclarationInputDataProvider_RetarderInputData As IRetarderInputData _
Implements IVehicleDeclarationInputData.RetarderInputData
Implements IVehicleComponentsDeclaration.RetarderInputData
Get
Return Me
End Get
End Property
Public ReadOnly Property RetarderInputData As IRetarderInputData _
Implements IVehicleEngineeringInputData.RetarderInputData
Implements IVehicleComponentsEngineering.RetarderInputData
Get
Return Me
End Get
......@@ -639,19 +646,31 @@ Public Class Vehicle
'End Property
Public ReadOnly Property IDeclarationInputDataProvider_PTOTransmissionInputData As IPTOTransmissionInputData _
Implements IVehicleDeclarationInputData.PTOTransmissionInputData
Implements IVehicleComponentsDeclaration.PTOTransmissionInputData
Get
Return Me
End Get
End Property
Public ReadOnly Property PTOTransmissionInputData As IPTOTransmissionInputData _
Implements IVehicleEngineeringInputData.PTOTransmissionInputData
Implements IVehicleComponentsEngineering.PTOTransmissionInputData
Get
Return Me
End Get
End Property
Public ReadOnly Property IVehicleComponentsDeclaration_AxleWheels As IAxlesDeclarationInputData Implements IVehicleComponentsDeclaration.AxleWheels
get
Return Me
End Get
End Property
Public ReadOnly Property AxleWheels As IAxlesEngineeringInputData Implements IVehicleComponentsEngineering.AxleWheels
get
Return me
End Get
End Property
Public ReadOnly Property VocationalVehicle As Boolean Implements IVehicleDeclarationInputData.VocationalVehicle
get
Return DeclarationData.Vehicle.VocationalVehicleDefault
......@@ -670,6 +689,12 @@ Public Class Vehicle
End Get
End Property
Public ReadOnly Property IVehicleEngineeringInputData_ADAS As IAdvancedDriverAssistantSystemsEngineering Implements IVehicleEngineeringInputData.ADAS
get
Return Nothing
End Get
End Property
Public ReadOnly Property ADAS As IAdvancedDriverAssistantSystemDeclarationInputData Implements IVehicleDeclarationInputData.ADAS
get
return Me
......@@ -706,6 +731,12 @@ Public Class Vehicle
End Get
End Property
Public ReadOnly Property Components As IVehicleComponentsDeclaration Implements IVehicleDeclarationInputData.Components
get
Return Me
End Get
End Property
Public ReadOnly Property EngineStopStart As Boolean Implements IAdvancedDriverAssistantSystemDeclarationInputData.EngineStopStart
get
return DeclarationData.Vehicle.ADAS.EngineStopStartDefault
......@@ -731,4 +762,9 @@ Public Class Vehicle
End Property
Public ReadOnly Property IAxlesEngineeringInputData_DataSource As DataSource Implements IAxlesEngineeringInputData.DataSource
get
Return New DataSource() With {.SourceType = DataSourceType.JSONFile}
End Get
End Property
End Class
......@@ -222,7 +222,7 @@ Public Class JSONFileWriter
{"IdlingSpeed", vehicle.EngineIdleSpeed.AsRPM},
{"AxleConfig", New Dictionary(Of String, Object) From {
{"Type", vehicle.AxleConfiguration.GetName()},
{"Axles", From axle In vehicle.Axles Select New Dictionary(Of String, Object) From {
{"Axles", From axle In vehicle.Components.AxleWheels.AxlesEngineering Select New Dictionary(Of String, Object) From {
{"Inertia", axle.Tyre.Inertia.Value()},
{"Wheels", axle.Tyre.Dimension},
{"AxleWeightShare", axle.AxleWeightShare},
......@@ -258,7 +258,7 @@ Public Class JSONFileWriter
body.Add("EngineOnlyMode", job.EngineOnlyMode)
If job.EngineOnlyMode Then
body.Add("EngineFile", GetRelativePath(job.EngineOnly.Source, basePath))
body.Add("EngineFile", GetRelativePath(job.EngineOnly.DataSource.SourceFile, basePath))
body.Add("Cycles",
job.Cycles.Select(Function(x) GetRelativePath(x.CycleData.Source, Path.GetDirectoryName(filename))).ToArray())
WriteFile(header, body, filename)
......@@ -266,12 +266,12 @@ Public Class JSONFileWriter
End If
'Main Files
body.Add("VehicleFile", GetRelativePath(job.Vehicle.Source, basePath))
body.Add("EngineFile", GetRelativePath(input.JobInputData.Vehicle.EngineInputData.Source, basePath))
body.Add("GearboxFile", GetRelativePath(input.JobInputData.Vehicle.GearboxInputData.Source, basePath))
body.Add("VehicleFile", GetRelativePath(job.Vehicle.DataSource.SourceFile, basePath))
body.Add("EngineFile", GetRelativePath(input.JobInputData.Vehicle.Components.EngineInputData.DataSource.SourceFile, basePath))
body.Add("GearboxFile", GetRelativePath(input.JobInputData.Vehicle.Components.GearboxInputData.DataSource.SourceFile, basePath))
Dim aux As IAuxiliariesEngineeringInputData = job.Vehicle.AuxiliaryInputData()
Dim aux As IAuxiliariesEngineeringInputData = job.Vehicle.Components.AuxiliaryInputData
'AA-TB
'ADVANCED AUXILIARIES
body.Add("AuxiliaryAssembly", aux.AuxiliaryAssembly.GetName())
......@@ -369,7 +369,7 @@ Public Class JSONFileWriter
'Body
Dim body As Dictionary(Of String, Object) = New Dictionary(Of String, Object)
body.Add("SavedInDeclMode", declarationmode)
body.Add("DeclarationVehicle", GetRelativePath(job.Vehicle.Source, Path.GetDirectoryName(filename)))
body.Add("DeclarationVehicle", GetRelativePath(job.Vehicle.DataSource.SourceFile, Path.GetDirectoryName(filename)))
if declarationmode Then
body.add("ManufacturerRecord", GetRelativePath(job.ManufacturerReportInputData.Source, Path.GetDirectoryName(filename)))
body.Add("Mileage", job.Mileage.ConvertToKiloMeter().Value)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment