From 493ecfeb11e7e1f5c268f495f4cb54610ecc1886 Mon Sep 17 00:00:00 2001 From: Oliver Wong Date: Tue, 19 May 2026 12:20:42 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=B7=B3=E8=BF=87=E6=B2=A1=E6=9C=89ID?= =?UTF-8?q?=E7=9A=84=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ExcelTool/ExcelHelper.cs | 4 ++++ ExcelTool/Parser/GenAudioConsts.cs | 8 ++++++-- ExcelTool/Parser/GenModels.cs | 3 ++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/ExcelTool/ExcelHelper.cs b/ExcelTool/ExcelHelper.cs index 224ae67..f7a6bf9 100644 --- a/ExcelTool/ExcelHelper.cs +++ b/ExcelTool/ExcelHelper.cs @@ -83,6 +83,10 @@ namespace ExcelTool IRow row = sheet.GetRow(i); if (row == null) continue; + + // ID为空则跳过该行 + if (string.IsNullOrEmpty(GetCellValue(row.GetCell(0)))) continue; + TableExcelRow tableExcelRow = new(); for (int j = 0; j < headers.Count; j++) tableExcelRow.Add(GetCellValue(row.GetCell(j))); diff --git a/ExcelTool/Parser/GenAudioConsts.cs b/ExcelTool/Parser/GenAudioConsts.cs index 0bdb5ee..9e74dde 100644 --- a/ExcelTool/Parser/GenAudioConsts.cs +++ b/ExcelTool/Parser/GenAudioConsts.cs @@ -119,7 +119,9 @@ namespace ExcelTool.Parser if (idIndex < 0 || namesIndex < 0) continue; if (string.IsNullOrEmpty(row.StrList[idIndex])) continue; - uint id = Convert.ToUInt32(row.StrList[idIndex]); + uint id = Convert.ToUInt32(row.StrList[idIndex]); + if (id == 0) continue; // 跳过ID=0的行 + string rawNames = row.StrList[namesIndex]; List names = new(rawNames.Split(['|'], StringSplitOptions.RemoveEmptyEntries)); @@ -223,7 +225,9 @@ namespace ExcelTool.Parser if (idIndex < 0 || namesIndex < 0) continue; if (string.IsNullOrEmpty(row.StrList[idIndex])) continue; - uint id = Convert.ToUInt32(row.StrList[idIndex]); + uint id = Convert.ToUInt32(row.StrList[idIndex]); + if (id == 0) continue; // 跳过ID=0的行 + string rawNames = row.StrList[namesIndex]; List names = new(rawNames.Split(['|'], StringSplitOptions.RemoveEmptyEntries)); diff --git a/ExcelTool/Parser/GenModels.cs b/ExcelTool/Parser/GenModels.cs index 4df0e23..8fa545c 100644 --- a/ExcelTool/Parser/GenModels.cs +++ b/ExcelTool/Parser/GenModels.cs @@ -201,8 +201,9 @@ namespace ExcelTool.Parser if (idIndex < 0 || namesIndex < 0) continue; if (string.IsNullOrEmpty(row.StrList[idIndex])) continue; - + uint id = Convert.ToUInt32(row.StrList[idIndex]); + if (id == 0) continue; // 跳过ID=0的行 // Names 是用分隔符(例如 '|')拼接的字符串 string rawNames = row.StrList[namesIndex];