allowDuplicateNames

This commit is contained in:
rusefillc 2024-10-16 22:44:42 -04:00
parent 22e66be7cd
commit d14ca16039
2 changed files with 7 additions and 1 deletions

View File

@ -12,6 +12,8 @@ public class Launcher {
public static String fileNameFilter;
public static final String DBC_FILENAME_PROPERTY = "-dbc";
public static String dbcFileName;
public static final String DBC_DUP_FIELD_NAMES = "-allow-dup-names";
public static boolean allowDuplicateNames = false;
public static void main(String[] args) throws IOException {
if (args.length < 1) {
@ -26,6 +28,9 @@ public class Launcher {
String inputFolderName = args[0];
for (int i = 1; i < args.length; i++) {
switch (args[i]) {
case DBC_DUP_FIELD_NAMES:
allowDuplicateNames = true;
break;
case FILENAME_SUFFIX_PROPERTY:
i += 1;
fileNameSuffixValue = args[i];

View File

@ -1,5 +1,6 @@
package com.rusefi.can.reader.dbc;
import com.rusefi.can.Launcher;
import com.rusefi.mlv.LoggingStrategy;
import com.rusefi.sensor_logs.BinaryLogEntry;
@ -82,7 +83,7 @@ public class DbcFile {
if (debugEnabled)
System.out.println("Found " + field);
if (field != null) {
if (!fieldNames.add(field.getName()))
if (!fieldNames.add(field.getName()) && !Launcher.allowDuplicateNames)
throw new IllegalArgumentException("Let's use unique field names: " + field.getName());
currentPacket.add(field);
}