From 011894b807b36ce97b6f202f21379e235a88d351 Mon Sep 17 00:00:00 2001 From: "rick.chan" Date: Fri, 8 Dec 2023 09:58:27 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=20BOM=20=E5=A4=84=E7=90=86?= =?UTF-8?q?=E5=8D=95=E5=85=83:?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. 使用 Reference 替代 Ref; 2. 使用 MaterialFootprint 替代 Footprint. Signed-off-by: rick.chan --- bom.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/bom.go b/bom.go index 2c8d709..e3296d3 100644 --- a/bom.go +++ b/bom.go @@ -37,7 +37,7 @@ func transBomFormat(commentId, designatorId, footprintId int, contents []string) lines := strings.Split(line, "\",") if commentId < len(lines) && designatorId < len(lines) && footprintId < len(lines) { footprint := transBomFootprint(lines[footprintId]) - ostr += lines[commentId] + "\"," + lines[designatorId] + "\"," + footprint + "\"\n" + ostr += lines[commentId] + "\"," + lines[designatorId] + "\"," + footprint + "\n" } } return ostr @@ -54,16 +54,16 @@ func transBomFootprint(footprint string) string { func findBomContents(content string) (commentId, designatorId, footprintId int, contents []string) { contents = strings.Split(content, "\n") for i, line := range contents { - if (strings.Contains(line, "\"Ref\"")) && + if (strings.Contains(line, "\"Reference\"")) && (strings.Contains(line, "\"Value\"")) && - (strings.Contains(line, "\"Footprint\"")) { + (strings.Contains(line, "\"MaterialFootprint\"")) { lines := strings.Split(line, ",") for j, item := range lines { - if item == "\"Ref\"" { + if item == "\"Reference\"" { designatorId = j } else if item == "\"Value\"" { commentId = j - } else if item == "\"Footprint\"" { + } else if item == "\"MaterialFootprint\"" { footprintId = j } }