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 887f68dc authored by Markus Quaritsch's avatar Markus Quaritsch
Browse files

syncronize gear entries in ihpc dialog, implement autosendto functionality,...

syncronize gear entries in ihpc dialog, implement autosendto functionality, sort entries before writing json files
parent 6d644abb
No related branches found
No related tags found
No related merge requests found
...@@ -15,6 +15,8 @@ Public Class IEPCForm ...@@ -15,6 +15,8 @@ Public Class IEPCForm
Private _flcFilePath2 as String Private _flcFilePath2 as String
Private _changed as Boolean Private _changed as Boolean
Public AutoSendTo As action(of string, VehicleForm)
Private _contextMenuFiles As String() Private _contextMenuFiles As String()
...@@ -92,7 +94,7 @@ Public Class IEPCForm ...@@ -92,7 +94,7 @@ Public Class IEPCForm
End Sub End Sub
Private Function CreateListViewItem(axleNumber As Integer, filepath As String) As ListViewItem Private Function CreateListViewItem(axleNumber As Integer, filepath As String) As ListViewItem
Dim basePath As String = Path.GetDirectoryName(_iepcFilePath) Dim basePath As String = GetPath(_iepcFilePath)
Dim retVal As New ListViewItem Dim retVal As New ListViewItem
retVal.SubItems(0).Text = axleNumber.ToGUIFormat() retVal.SubItems(0).Text = axleNumber.ToGUIFormat()
retVal.SubItems.Add(GetRelativePath(filepath, basePath)) retVal.SubItems.Add(GetRelativePath(filepath, basePath))
...@@ -425,6 +427,12 @@ Public Class IEPCForm ...@@ -425,6 +427,12 @@ Public Class IEPCForm
Return False Return False
End If End If
If not AutoSendTo is nothing Then
If VehicleForm.Visible Then
AutoSendTo(file, VehicleForm)
End If
End If
_changed = False _changed = False
LbStatus.Text = "" LbStatus.Text = ""
......
...@@ -15,6 +15,8 @@ Public Class IHPCForm ...@@ -15,6 +15,8 @@ Public Class IHPCForm
Private _contextMenuFiles As String() Private _contextMenuFiles As String()
Public AutoSendTo As action(of string, VehicleForm)
#Region "Set JSON Data" #Region "Set JSON Data"
Public Sub ReadIHPCFile(file As String) Public Sub ReadIHPCFile(file As String)
...@@ -59,7 +61,7 @@ Public Class IHPCForm ...@@ -59,7 +61,7 @@ Public Class IHPCForm
End Sub End Sub
Private Sub SetPowerMapEntries(powerMapListView As ListView, entries As IList(Of IElectricMotorPowerMap)) Private Sub SetPowerMapEntries(powerMapListView As ListView, entries As IList(Of IElectricMotorPowerMap))
For Each entry As IElectricMotorPowerMap In entries For Each entry As IElectricMotorPowerMap In entries.OrderBy(Function(x) x.Gear)
Dim listEntry = CreateListViewItem(entry.Gear, entry.PowerMap.Source) Dim listEntry = CreateListViewItem(entry.Gear, entry.PowerMap.Source)
powerMapListView.Items.Add(listEntry) powerMapListView.Items.Add(listEntry)
Next Next
...@@ -68,7 +70,7 @@ Public Class IHPCForm ...@@ -68,7 +70,7 @@ Public Class IHPCForm
Private Function CreateListViewItem(axleNumber As Integer, filepath As String) As ListViewItem Private Function CreateListViewItem(axleNumber As Integer, filepath As String) As ListViewItem
Dim retVal As New ListViewItem Dim retVal As New ListViewItem
retVal.SubItems(0).Text = axleNumber.ToGUIFormat() retVal.SubItems(0).Text = axleNumber.ToGUIFormat()
retVal.SubItems.Add(GetRelativePath(filepath, Path.GetDirectoryName(_ihpcFilePath))) retVal.SubItems.Add(GetRelativePath(filepath, GetPath(_ihpcFilePath)))
Return retVal Return retVal
End Function End Function
...@@ -144,21 +146,30 @@ Public Class IHPCForm ...@@ -144,21 +146,30 @@ Public Class IHPCForm
Private Sub AddListViewItem(listView As ListView) Private Sub AddListViewItem(listView As ListView)
IHPCPowerMapInputDialog.Clear() IHPCPowerMapInputDialog.Clear()
dim gear = listView.Items.Count + 1
IHPCPowerMapInputDialog.tbGear.Text = gear.ToString()
If IHPCPowerMapInputDialog.ShowDialog() = DialogResult.OK Then If IHPCPowerMapInputDialog.ShowDialog() = DialogResult.OK Then
Dim gear = Convert.ToInt32(IHPCPowerMapInputDialog.tbGear.Text)
Dim filePath = IHPCPowerMapInputDialog.tbInputFile.Text Dim filePath = IHPCPowerMapInputDialog.tbInputFile.Text
listView.Items.Add(CreateListViewItem(gear, filePath)) listView.Items.Add(CreateListViewItem(gear, filePath))
if (listView.Equals(lvPowerMap1)) Then
lvPowerMap2.Items.Add(CreateListViewItem(gear, ""))
End If
if (listView.Equals(_lvPowerMap2)) Then
lvPowerMap1.Items.Add(CreateListViewItem(gear, ""))
End If
Change() Change()
End If End If
End Sub End Sub
Private Sub btRemovePowerMap1_Click(sender As Object, e As EventArgs) Handles btRemovePowerMap1.Click Private Sub btRemovePowerMap1_Click(sender As Object, e As EventArgs) Handles btRemovePowerMap1.Click
RemoveListEntry(lvPowerMap1) RemoveListEntry(lvPowerMap1)
RemoveListEntry(lvPowerMap2)
End Sub End Sub
Private Sub btRemovePowerMap2_Click(sender As Object, e As EventArgs) Handles btRemovePowerMap2.Click Private Sub btRemovePowerMap2_Click(sender As Object, e As EventArgs) Handles btRemovePowerMap2.Click
RemoveListEntry(lvPowerMap2) RemoveListEntry(lvPowerMap2)
RemoveListEntry(lvPowerMap1)
End Sub End Sub
Private Sub RemoveListEntry(listView As ListView) Private Sub RemoveListEntry(listView As ListView)
...@@ -293,6 +304,12 @@ Public Class IHPCForm ...@@ -293,6 +304,12 @@ Public Class IHPCForm
Return False Return False
End If End If
If not AutoSendTo is nothing Then
If VehicleForm.Visible Then
AutoSendTo(ihpcFilePath, VehicleForm)
End If
End If
_changed = False _changed = False
LbStatus.Text = "" LbStatus.Text = ""
......
...@@ -45,8 +45,9 @@ Partial Class IHPCPowerMapInputDialog ...@@ -45,8 +45,9 @@ Partial Class IHPCPowerMapInputDialog
Me.FlowLayoutPanel1.Controls.Add(Me.TableLayoutPanel5) Me.FlowLayoutPanel1.Controls.Add(Me.TableLayoutPanel5)
Me.FlowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Top Me.FlowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Top
Me.FlowLayoutPanel1.Location = New System.Drawing.Point(0, 0) Me.FlowLayoutPanel1.Location = New System.Drawing.Point(0, 0)
Me.FlowLayoutPanel1.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5)
Me.FlowLayoutPanel1.Name = "FlowLayoutPanel1" Me.FlowLayoutPanel1.Name = "FlowLayoutPanel1"
Me.FlowLayoutPanel1.Size = New System.Drawing.Size(508, 45) Me.FlowLayoutPanel1.Size = New System.Drawing.Size(762, 69)
Me.FlowLayoutPanel1.TabIndex = 11 Me.FlowLayoutPanel1.TabIndex = 11
' '
'TableLayoutPanel4 'TableLayoutPanel4
...@@ -57,29 +58,32 @@ Partial Class IHPCPowerMapInputDialog ...@@ -57,29 +58,32 @@ Partial Class IHPCPowerMapInputDialog
Me.TableLayoutPanel4.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 67.2!)) Me.TableLayoutPanel4.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 67.2!))
Me.TableLayoutPanel4.Controls.Add(Me.tbGear, 1, 0) Me.TableLayoutPanel4.Controls.Add(Me.tbGear, 1, 0)
Me.TableLayoutPanel4.Controls.Add(Me.Label3, 0, 0) Me.TableLayoutPanel4.Controls.Add(Me.Label3, 0, 0)
Me.TableLayoutPanel4.Location = New System.Drawing.Point(6, 8) Me.TableLayoutPanel4.Location = New System.Drawing.Point(9, 13)
Me.TableLayoutPanel4.Margin = New System.Windows.Forms.Padding(6, 3, 3, 3) Me.TableLayoutPanel4.Margin = New System.Windows.Forms.Padding(9, 5, 4, 5)
Me.TableLayoutPanel4.Name = "TableLayoutPanel4" Me.TableLayoutPanel4.Name = "TableLayoutPanel4"
Me.TableLayoutPanel4.RowCount = 1 Me.TableLayoutPanel4.RowCount = 1
Me.TableLayoutPanel4.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50!)) Me.TableLayoutPanel4.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50!))
Me.TableLayoutPanel4.Size = New System.Drawing.Size(128, 28) Me.TableLayoutPanel4.Size = New System.Drawing.Size(192, 43)
Me.TableLayoutPanel4.TabIndex = 10 Me.TableLayoutPanel4.TabIndex = 10
' '
'tbGear 'tbGear
' '
Me.tbGear.Anchor = System.Windows.Forms.AnchorStyles.None Me.tbGear.Anchor = System.Windows.Forms.AnchorStyles.None
Me.tbGear.Location = New System.Drawing.Point(46, 4) Me.tbGear.Location = New System.Drawing.Point(70, 8)
Me.tbGear.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5)
Me.tbGear.Name = "tbGear" Me.tbGear.Name = "tbGear"
Me.tbGear.Size = New System.Drawing.Size(77, 20) Me.tbGear.ReadOnly = true
Me.tbGear.Size = New System.Drawing.Size(114, 26)
Me.tbGear.TabIndex = 1 Me.tbGear.TabIndex = 1
' '
'Label3 'Label3
' '
Me.Label3.Anchor = System.Windows.Forms.AnchorStyles.None Me.Label3.Anchor = System.Windows.Forms.AnchorStyles.None
Me.Label3.AutoSize = true Me.Label3.AutoSize = true
Me.Label3.Location = New System.Drawing.Point(5, 7) Me.Label3.Location = New System.Drawing.Point(8, 11)
Me.Label3.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0)
Me.Label3.Name = "Label3" Me.Label3.Name = "Label3"
Me.Label3.Size = New System.Drawing.Size(30, 13) Me.Label3.Size = New System.Drawing.Size(45, 20)
Me.Label3.TabIndex = 9 Me.Label3.TabIndex = 9
Me.Label3.Text = "Gear" Me.Label3.Text = "Gear"
' '
...@@ -87,33 +91,36 @@ Partial Class IHPCPowerMapInputDialog ...@@ -87,33 +91,36 @@ Partial Class IHPCPowerMapInputDialog
' '
Me.TableLayoutPanel5.Anchor = System.Windows.Forms.AnchorStyles.None Me.TableLayoutPanel5.Anchor = System.Windows.Forms.AnchorStyles.None
Me.TableLayoutPanel5.ColumnCount = 2 Me.TableLayoutPanel5.ColumnCount = 2
Me.TableLayoutPanel5.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 316!)) Me.TableLayoutPanel5.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 474!))
Me.TableLayoutPanel5.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 40!)) Me.TableLayoutPanel5.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 60!))
Me.TableLayoutPanel5.Controls.Add(Me.btAddFilePath, 1, 0) Me.TableLayoutPanel5.Controls.Add(Me.btAddFilePath, 1, 0)
Me.TableLayoutPanel5.Controls.Add(Me.tbInputFile, 0, 0) Me.TableLayoutPanel5.Controls.Add(Me.tbInputFile, 0, 0)
Me.TableLayoutPanel5.Location = New System.Drawing.Point(140, 3) Me.TableLayoutPanel5.Location = New System.Drawing.Point(209, 5)
Me.TableLayoutPanel5.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5)
Me.TableLayoutPanel5.Name = "TableLayoutPanel5" Me.TableLayoutPanel5.Name = "TableLayoutPanel5"
Me.TableLayoutPanel5.RowCount = 1 Me.TableLayoutPanel5.RowCount = 1
Me.TableLayoutPanel5.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100!)) Me.TableLayoutPanel5.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100!))
Me.TableLayoutPanel5.Size = New System.Drawing.Size(356, 39) Me.TableLayoutPanel5.Size = New System.Drawing.Size(534, 60)
Me.TableLayoutPanel5.TabIndex = 11 Me.TableLayoutPanel5.TabIndex = 11
' '
'btAddFilePath 'btAddFilePath
' '
Me.btAddFilePath.Anchor = System.Windows.Forms.AnchorStyles.None Me.btAddFilePath.Anchor = System.Windows.Forms.AnchorStyles.None
Me.btAddFilePath.Image = CType(resources.GetObject("btAddFilePath.Image"),System.Drawing.Image) Me.btAddFilePath.Image = CType(resources.GetObject("btAddFilePath.Image"),System.Drawing.Image)
Me.btAddFilePath.Location = New System.Drawing.Point(324, 6) Me.btAddFilePath.Location = New System.Drawing.Point(486, 10)
Me.btAddFilePath.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5)
Me.btAddFilePath.Name = "btAddFilePath" Me.btAddFilePath.Name = "btAddFilePath"
Me.btAddFilePath.Size = New System.Drawing.Size(24, 26) Me.btAddFilePath.Size = New System.Drawing.Size(36, 40)
Me.btAddFilePath.TabIndex = 13 Me.btAddFilePath.TabIndex = 13
Me.btAddFilePath.UseVisualStyleBackColor = true Me.btAddFilePath.UseVisualStyleBackColor = true
' '
'tbInputFile 'tbInputFile
' '
Me.tbInputFile.Anchor = CType((System.Windows.Forms.AnchorStyles.Left Or System.Windows.Forms.AnchorStyles.Right),System.Windows.Forms.AnchorStyles) Me.tbInputFile.Anchor = CType((System.Windows.Forms.AnchorStyles.Left Or System.Windows.Forms.AnchorStyles.Right),System.Windows.Forms.AnchorStyles)
Me.tbInputFile.Location = New System.Drawing.Point(3, 9) Me.tbInputFile.Location = New System.Drawing.Point(4, 17)
Me.tbInputFile.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5)
Me.tbInputFile.Name = "tbInputFile" Me.tbInputFile.Name = "tbInputFile"
Me.tbInputFile.Size = New System.Drawing.Size(310, 20) Me.tbInputFile.Size = New System.Drawing.Size(466, 26)
Me.tbInputFile.TabIndex = 12 Me.tbInputFile.TabIndex = 12
' '
'TableLayoutPanel1 'TableLayoutPanel1
...@@ -123,19 +130,21 @@ Partial Class IHPCPowerMapInputDialog ...@@ -123,19 +130,21 @@ Partial Class IHPCPowerMapInputDialog
Me.TableLayoutPanel1.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50!)) Me.TableLayoutPanel1.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50!))
Me.TableLayoutPanel1.Controls.Add(Me.btAddInput, 0, 0) Me.TableLayoutPanel1.Controls.Add(Me.btAddInput, 0, 0)
Me.TableLayoutPanel1.Controls.Add(Me.btCancel, 1, 0) Me.TableLayoutPanel1.Controls.Add(Me.btCancel, 1, 0)
Me.TableLayoutPanel1.Location = New System.Drawing.Point(348, 51) Me.TableLayoutPanel1.Location = New System.Drawing.Point(522, 78)
Me.TableLayoutPanel1.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5)
Me.TableLayoutPanel1.Name = "TableLayoutPanel1" Me.TableLayoutPanel1.Name = "TableLayoutPanel1"
Me.TableLayoutPanel1.RowCount = 1 Me.TableLayoutPanel1.RowCount = 1
Me.TableLayoutPanel1.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50!)) Me.TableLayoutPanel1.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50!))
Me.TableLayoutPanel1.Size = New System.Drawing.Size(148, 29) Me.TableLayoutPanel1.Size = New System.Drawing.Size(222, 45)
Me.TableLayoutPanel1.TabIndex = 12 Me.TableLayoutPanel1.TabIndex = 12
' '
'btAddInput 'btAddInput
' '
Me.btAddInput.Anchor = System.Windows.Forms.AnchorStyles.None Me.btAddInput.Anchor = System.Windows.Forms.AnchorStyles.None
Me.btAddInput.Location = New System.Drawing.Point(3, 3) Me.btAddInput.Location = New System.Drawing.Point(5, 5)
Me.btAddInput.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5)
Me.btAddInput.Name = "btAddInput" Me.btAddInput.Name = "btAddInput"
Me.btAddInput.Size = New System.Drawing.Size(67, 23) Me.btAddInput.Size = New System.Drawing.Size(100, 35)
Me.btAddInput.TabIndex = 14 Me.btAddInput.TabIndex = 14
Me.btAddInput.Text = "OK" Me.btAddInput.Text = "OK"
' '
...@@ -143,20 +152,22 @@ Partial Class IHPCPowerMapInputDialog ...@@ -143,20 +152,22 @@ Partial Class IHPCPowerMapInputDialog
' '
Me.btCancel.Anchor = System.Windows.Forms.AnchorStyles.None Me.btCancel.Anchor = System.Windows.Forms.AnchorStyles.None
Me.btCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel Me.btCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel
Me.btCancel.Location = New System.Drawing.Point(77, 3) Me.btCancel.Location = New System.Drawing.Point(116, 5)
Me.btCancel.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5)
Me.btCancel.Name = "btCancel" Me.btCancel.Name = "btCancel"
Me.btCancel.Size = New System.Drawing.Size(67, 23) Me.btCancel.Size = New System.Drawing.Size(100, 35)
Me.btCancel.TabIndex = 15 Me.btCancel.TabIndex = 15
Me.btCancel.Text = "Cancel" Me.btCancel.Text = "Cancel"
' '
'IHPCPowerMapInputDialog 'IHPCPowerMapInputDialog
' '
Me.AutoScaleDimensions = New System.Drawing.SizeF(6!, 13!) Me.AutoScaleDimensions = New System.Drawing.SizeF(9!, 20!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(508, 85) Me.ClientSize = New System.Drawing.Size(762, 131)
Me.Controls.Add(Me.TableLayoutPanel1) Me.Controls.Add(Me.TableLayoutPanel1)
Me.Controls.Add(Me.FlowLayoutPanel1) Me.Controls.Add(Me.FlowLayoutPanel1)
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow
Me.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5)
Me.MaximizeBox = false Me.MaximizeBox = false
Me.MinimizeBox = false Me.MinimizeBox = false
Me.Name = "IHPCPowerMapInputDialog" Me.Name = "IHPCPowerMapInputDialog"
......
...@@ -1605,6 +1605,11 @@ Public Class VehicleForm ...@@ -1605,6 +1605,11 @@ Public Class VehicleForm
Dim f = FileRepl(tbIEPCFilePath.Text, GetPath(_vehFile)) Dim f = FileRepl(tbIEPCFilePath.Text, GetPath(_vehFile))
IEPCForm.JobDir = GetPath(_vehFile) IEPCForm.JobDir = GetPath(_vehFile)
IEPCForm.AutoSendTo = Sub(file, vehicleForm)
If UCase(FileRepl(vehicleForm.tbIEPCFilePath.Text, JobDir)) <> UCase(file) Then _
vehicleForm.tbIEPCFilePath.Text = GetFilenameWithoutDirectory(file, JobDir)
VectoJobForm.UpdatePic()
End Sub
If Not Trim(f) = "" Then If Not Trim(f) = "" Then
If Not File.Exists(f) Then If Not File.Exists(f) Then
...@@ -1640,6 +1645,12 @@ Public Class VehicleForm ...@@ -1640,6 +1645,12 @@ Public Class VehicleForm
Dim f = FileRepl(tbIHPCFilePath.Text, GetPath(_vehFile)) Dim f = FileRepl(tbIHPCFilePath.Text, GetPath(_vehFile))
IHPCForm.JobDir = GetPath(_vehFile) IHPCForm.JobDir = GetPath(_vehFile)
IHPCForm.AutoSendTo = Sub(file, vehicleForm)
If UCase(FileRepl(vehicleForm.tbIHPCFilePath.Text, JobDir)) <> UCase(file) Then _
vehicleForm.tbIHPCFilePath.Text = GetFilenameWithoutDirectory(file, JobDir)
VectoJobForm.UpdatePic()
End Sub
If Not Trim(f) = "" Then If Not Trim(f) = "" Then
If Not File.Exists(f) Then If Not File.Exists(f) Then
MsgBox("File not found!") MsgBox("File not found!")
......
...@@ -109,7 +109,7 @@ public class JSONFileWriter : IOutputFileWriter ...@@ -109,7 +109,7 @@ public class JSONFileWriter : IOutputFileWriter
private List<Dictionary<string, object>> GetVoltageLevelEntries(IList<IElectricMotorVoltageLevel> voltageLevels, string filename) private List<Dictionary<string, object>> GetVoltageLevelEntries(IList<IElectricMotorVoltageLevel> voltageLevels, string filename)
{ {
var vlevels = new List<Dictionary<string, object>>(); var vlevels = new List<Dictionary<string, object>>();
foreach (var entry in voltageLevels) foreach (var entry in voltageLevels.OrderBy(x => x.VoltageLevel))
{ {
var vlevel = new Dictionary<string, object> { var vlevel = new Dictionary<string, object> {
{ JsonKeys.EM_Voltage, entry.VoltageLevel.Value() }, { JsonKeys.EM_Voltage, entry.VoltageLevel.Value() },
...@@ -121,7 +121,7 @@ public class JSONFileWriter : IOutputFileWriter ...@@ -121,7 +121,7 @@ public class JSONFileWriter : IOutputFileWriter
{ JsonKeys.EM_FullLoadCurve, GetRelativePath(entry.FullLoadCurve.Source, Path.GetDirectoryName(filename)) } { JsonKeys.EM_FullLoadCurve, GetRelativePath(entry.FullLoadCurve.Source, Path.GetDirectoryName(filename)) }
}; };
var powerMaps = new Dictionary<int, object>(); var powerMaps = new Dictionary<int, object>();
foreach (var pMap in entry.PowerMap) foreach (var pMap in entry.PowerMap.OrderBy(x => x.Gear))
{ {
powerMaps.Add(pMap.Gear, GetRelativePath(pMap.PowerMap.Source, Path.GetDirectoryName(filename))); powerMaps.Add(pMap.Gear, GetRelativePath(pMap.PowerMap.Source, Path.GetDirectoryName(filename)));
} }
...@@ -150,7 +150,7 @@ public class JSONFileWriter : IOutputFileWriter ...@@ -150,7 +150,7 @@ public class JSONFileWriter : IOutputFileWriter
var gears = new List<Dictionary<string, object>>(); var gears = new List<Dictionary<string, object>>();
foreach (var gear in iepc.Gears) { foreach (var gear in iepc.Gears.OrderBy(x => x.GearNumber)) {
var currentGear = new Dictionary<string, object> { var currentGear = new Dictionary<string, object> {
{ JsonKeys.Gearbox_Gear_Ratio, gear.Ratio } { JsonKeys.Gearbox_Gear_Ratio, gear.Ratio }
}; };
...@@ -162,7 +162,7 @@ public class JSONFileWriter : IOutputFileWriter ...@@ -162,7 +162,7 @@ public class JSONFileWriter : IOutputFileWriter
} }
var voltageLevels = new List<Dictionary<string, object>>(); var voltageLevels = new List<Dictionary<string, object>>();
foreach (var voltageLevel in iepc.VoltageLevels) { foreach (var voltageLevel in iepc.VoltageLevels.OrderBy(x => x.VoltageLevel)) {
var currentLevel = new Dictionary<string, object> var currentLevel = new Dictionary<string, object>
{ {
{JsonKeys.IEPC_Voltage, voltageLevel.VoltageLevel.Value()}, {JsonKeys.IEPC_Voltage, voltageLevel.VoltageLevel.Value()},
...@@ -175,7 +175,7 @@ public class JSONFileWriter : IOutputFileWriter ...@@ -175,7 +175,7 @@ public class JSONFileWriter : IOutputFileWriter
}; };
var powerMaps = new Dictionary<string, object>(); var powerMaps = new Dictionary<string, object>();
foreach (var pMap in voltageLevel.PowerMap) foreach (var pMap in voltageLevel.PowerMap.OrderBy(x => x.Gear))
{ {
powerMaps.Add(pMap.Gear.ToString(), GetRelativePath(pMap.PowerMap.Source, Path.GetDirectoryName(filename))); powerMaps.Add(pMap.Gear.ToString(), GetRelativePath(pMap.PowerMap.Source, Path.GetDirectoryName(filename)));
} }
...@@ -184,7 +184,7 @@ public class JSONFileWriter : IOutputFileWriter ...@@ -184,7 +184,7 @@ public class JSONFileWriter : IOutputFileWriter
} }
var dragCurves = new Dictionary<string, object>(); var dragCurves = new Dictionary<string, object>();
foreach (var dragCurveEntry in iepc.DragCurves) { foreach (var dragCurveEntry in iepc.DragCurves.OrderBy(x => x.Gear)) {
dragCurves.Add(dragCurveEntry.Gear.ToString(), dragCurves.Add(dragCurveEntry.Gear.ToString(),
GetRelativePath(dragCurveEntry.DragCurve.Source, Path.GetDirectoryName(filename))); GetRelativePath(dragCurveEntry.DragCurve.Source, Path.GetDirectoryName(filename)));
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment