Skip to content

Commit 023ba55

Browse files
committed
Merge remote-tracking branch 'origin/main' into 228-cloning-an-object-ending-with-a-number-create-an-exception
2 parents 6dfac12 + 634f930 commit 023ba55

5 files changed

Lines changed: 17 additions & 9 deletions

File tree

‎EDSEditorGUI/DevicePDOView2.cs‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -499,6 +499,12 @@ public void UpdatePDOinfo(bool updatechoices = true)
499499
MessageBox.Show(string.Format("Invalid TXPDO mapping parameters in 0x{0:X}!\r\nTrying to map more than the maximum lenght of a CAN message (8 bytes).\r\n\r\nMembers are:\r\n{1}", slot.ConfigurationIndex,toDisplay));
500500
break;
501501
}
502+
if ((bitoff + mappingentry.width) <= 0)
503+
{
504+
string toDisplay = string.Join(Environment.NewLine, slot.Mapping);
505+
MessageBox.Show(string.Format("Invalid TXPDO mapping parameters in 0x{0:X}!\r\nTrying to map less than the minimum lenght of a CAN message (0 bytes).\r\n\r\nMembers are:\r\n{1}", slot.ConfigurationIndex, toDisplay));
506+
break;
507+
}
502508
string target = slot.getTargetName(mappingentry.entry);
503509
grid1[row + 2, bitoff + INFO_COLS_COUNT] = new SourceGrid.Cells.Cell(target, comboStandard);
504510
grid1[row + 2, bitoff + INFO_COLS_COUNT].ColumnSpan = mappingentry.width;

‎EDSEditorGUI2/EDSEditorGUI2.csproj‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,6 @@
3636
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="11.1.5" />
3737
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.3.2" />
3838
<PackageReference Include="DialogHost.Avalonia" Version="0.8.1" />
39-
<PackageReference Include="AutoMapper" Version="13.0.1" />
39+
<PackageReference Include="AutoMapper" Version="16.2.0" />
4040
</ItemGroup>
4141
</Project>

‎EDSEditorGUI2/Mapper/ProtobufferViewModelMapper.cs‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using AutoMapper;
22
using Google.Protobuf.WellKnownTypes;
33
using LibCanOpen;
4+
using Microsoft.Extensions.Logging;
45
using System;
56

67
namespace EDSEditorGUI2.Mapper
@@ -27,7 +28,7 @@ public static ViewModels.Device MapFromProtobuffer(CanOpenDevice source)
2728
.ForMember(dest => dest.Objects, opt => opt.MapFrom(src => src.Objects));
2829
cfg.CreateMap<CanOpen_DeviceInfo, ViewModels.DeviceInfo>();
2930
cfg.CreateMap<CanOpen_DeviceCommissioning, ViewModels.DeviceCommissioning>();
30-
});
31+
}, LoggerFactory.Create(builder => { builder.AddDebug(); }));
3132
config.AssertConfigurationIsValid();
3233
var mapper = config.CreateMapper();
3334
var result = mapper.Map<ViewModels.Device>(source);
@@ -42,7 +43,7 @@ public ViewModels.ObjectDictionary Convert(Google.Protobuf.Collections.MapField<
4243
{
4344
cfg.CreateMap<OdObject, ViewModels.OdObject>();
4445
cfg.CreateMap<OdSubObject, ViewModels.OdSubObject>();
45-
});
46+
}, LoggerFactory.Create(builder => { builder.AddDebug(); }));
4647
config.AssertConfigurationIsValid();
4748
var mapper = config.CreateMapper();
4849

@@ -59,7 +60,7 @@ public Google.Protobuf.Collections.MapField<string, OdObject> Convert(ViewModels
5960
{
6061
cfg.CreateMap<ViewModels.OdObject, OdObject>();
6162
cfg.CreateMap<ViewModels.OdSubObject, OdSubObject>();
62-
});
63+
}, LoggerFactory.Create(builder => { builder.AddDebug(); }));
6364
config.AssertConfigurationIsValid();
6465
var mapper = config.CreateMapper();
6566

@@ -77,7 +78,7 @@ public static CanOpenDevice MapToProtobuffer(ViewModels.Device source)
7778
var config = new MapperConfiguration(cfg =>
7879
{
7980
//TODO
80-
});
81+
}, LoggerFactory.Create(builder => { builder.AddDebug(); }));
8182
config.AssertConfigurationIsValid();
8283
var mapper = config.CreateMapper();
8384
var result = mapper.Map<CanOpenDevice>(source);

‎libEDSsharp/CanOpenEDSMapping.cs‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ You should have received a copy of the GNU General Public License
2020
using AutoMapper;
2121
using Google.Protobuf.WellKnownTypes;
2222
using LibCanOpen;
23+
using Microsoft.Extensions.Logging;
2324
using System;
2425
using System.Collections.Generic;
2526
using System.Globalization;
@@ -167,7 +168,7 @@ public static EDSsharp MapFromProtobuffer(CanOpenDevice source)
167168
.ForMember(dest => dest.objecttype, opt => opt.Ignore())
168169
.ForMember(dest => dest.Description, opt => opt.Ignore())
169170
.ForMember(dest => dest.subobjects, opt => opt.Ignore());
170-
});
171+
}, LoggerFactory.Create(builder => { builder.AddDebug(); }));
171172
config.AssertConfigurationIsValid();
172173
var mapper = config.CreateMapper();
173174

@@ -236,7 +237,7 @@ public static CanOpenDevice MapToProtobuffer(EDSsharp source)
236237
.ForMember(dest => dest.Pdo, opt => opt.MapFrom(src => src.accesstype))
237238
.ForMember(dest => dest.Srdo, opt => opt.MapFrom(src => src.prop.CO_accessSRDO))
238239
.ForMember(dest => dest.StringLengthMin, opt => opt.MapFrom(src => src.prop.CO_stringLengthMin));
239-
});
240+
}, LoggerFactory.Create(builder => { builder.AddDebug(); }));
240241

241242
config.AssertConfigurationIsValid();
242243
var mapper = config.CreateMapper();

‎libEDSsharp/libEDSsharp.csproj‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@
4747
<PackageReference Include="System.CodeDom" Version="8.0.0" Condition="'$(TargetFramework)' == 'net8.0'" />
4848
<PackageReference Include="Google.Protobuf" Version="3.27.2" />
4949
<PackageReference Include="Google.Protobuf.Tools" Version="3.27.2" />
50-
<PackageReference Include="AutoMapper" Version="10.0.0" Condition="'$(TargetFramework)' == 'net481'" />
51-
<PackageReference Include="AutoMapper" Version="13.0.1" Condition="'$(TargetFramework)' == 'net8.0'" />
50+
<PackageReference Include="AutoMapper" Version="16.2.0" />
51+
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="10.0.10" />
5252
</ItemGroup>
5353

5454
<ItemGroup>

0 commit comments

Comments
 (0)