diff --git a/HashingCmd/Program.cs b/HashingCmd/Program.cs index e693f7f472d9a8c8f0d4c2ccb0929877d2597500..5ce77962cb62ff18c7860874a6acd59af3f2c361 100644 --- a/HashingCmd/Program.cs +++ b/HashingCmd/Program.cs @@ -46,20 +46,20 @@ namespace HashingCmd { public delegate void HashingAction(string filename, VectoHash h); - private const string Usage = @" -hashingcmd.exe (-h | [-v] [[-s] -x] [-c] [-r]) <file.xml> <file2.xml> <file3.xml> - + private const string Usage = @" +hashingcmd.exe (-h | [-v] [[-s] -x] [-c] [-r]) <file.xml> <file2.xml> <file3.xml> + "; - private const string Help = @" -hashingcmd.exe - --h: print help --v: verify hashed file --s: create hashed file --x: validate generated XML against VECTO XML schema --c: compute hash and write to stdout --r: read hash from file and write to stdout + private const string Help = @" +hashingcmd.exe + +-h: print help +-v: verify hashed file +-s: create hashed file +-x: validate generated XML against VECTO XML schema +-c: compute hash and write to stdout +-r: read hash from file and write to stdout "; private static readonly Dictionary<string, HashingAction> Actions = new Dictionary<string, HashingAction> { diff --git a/VECTO/GUI/XMLExportJobDialog.vb b/VECTO/GUI/XMLExportJobDialog.vb index 8072b66ce3046925fc75ba1dc90a15e5f7e49727..48236bee9e9b37d7e9ae82267b83d7bf3c9ffe2f 100644 --- a/VECTO/GUI/XMLExportJobDialog.vb +++ b/VECTO/GUI/XMLExportJobDialog.vb @@ -1,78 +1,78 @@ -Imports System.IO -Imports System.Xml.Linq -Imports TUGraz.VectoCommon.Exceptions -Imports TUGraz.VectoCommon.InputData -Imports TUGraz.VectoCommon.Models -Imports TUGraz.VectoCore.OutputData.XML - -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 - +Imports System.IO +Imports System.Xml.Linq +Imports TUGraz.VectoCommon.Exceptions +Imports TUGraz.VectoCommon.InputData +Imports TUGraz.VectoCommon.Models +Imports TUGraz.VectoCore.OutputData.XML + +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 BtTCfileBrowse.Click If Not FolderFileBrowser.OpenDialog("") Then Exit Sub - End If + End If Dim filePath As String = FolderFileBrowser.Files(0) tbDestination.Text = Path.GetFullPath(filePath) - 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(tbVendor.Text).GenerateVectoJob(declarationData) - document.Save(Path.Combine(tbDestination.Text, declarationData.JobInputData().JobName + ".xml")) - MessageBox.Show("Successfully exported") - Close() - End If - End Sub + 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(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/VectoCore/VectoCore/Models/Declaration/DeclarationData.cs b/VectoCore/VectoCore/Models/Declaration/DeclarationData.cs index 98bfc64763ee494c8ee68aaaaf03348216655628..a3c29bfca4aa9200810e8a044d1ec48f25d553db 100644 --- a/VectoCore/VectoCore/Models/Declaration/DeclarationData.cs +++ b/VectoCore/VectoCore/Models/Declaration/DeclarationData.cs @@ -29,6 +29,7 @@ * Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology */ +using System; using System.Collections.Generic; using System.Data; using System.Linq; @@ -88,8 +89,8 @@ namespace TUGraz.VectoCore.Models.Declaration /// </summary> public static Kilogram GetPayloadForTrailerWeight(Kilogram grossVehicleWeight, Kilogram curbWeight, bool lowLoading) { - return (Payloads.LookupTrailer(grossVehicleWeight, curbWeight) / (lowLoading ? 7.5 : 1)).LimitTo(0.SI<Kilogram>(), - grossVehicleWeight - curbWeight); + return (Math.Round((Payloads.LookupTrailer(grossVehicleWeight, curbWeight) / (lowLoading ? 7.5 : 1)).LimitTo(0.SI<Kilogram>(), + grossVehicleWeight - curbWeight).Value() / 100, 0) * 100).SI<Kilogram>(); } public static int PoweredAxle()