public virtual List <string> GetExcelHeaderRow(ExcelData asset, out int firstRow) { firstRow = 0; var headerRow = asset.GetRow(firstRow++); var numEmpty = headerRow.Count(h => h.IsNullOrWhiteSpace()); if (headerRow.Count == numEmpty || headerRow.Count > 1 && ( headerRow[1].IsNullOrWhiteSpace() && ( headerRow[0].StartsWith("H") || headerRow[0] == "主人公"))) { headerRow = asset.GetRow(firstRow++); } else if (numEmpty > 3 || (numEmpty / (headerRow.Count * 1.0)) > 0.49) { var testRow = asset.GetRow(firstRow); var testData = asset.GetRow(firstRow + 1); if (testRow.Count > 1) { if ((testRow[0] == "表示順番" || testRow[0] == "管理番号") || (testData.Count > 1 && int.TryParse(testData[0], out _) && !int.TryParse(testRow[0], out _))) { headerRow = testRow; firstRow++; } } } return(headerRow); }
protected bool IsAssetTable(ExcelData excelData, out int startIdx) { startIdx = -1; if (excelData.MaxCell > 1) { var firstRow = 0; foreach (var headers in ResourceHelper.GetExcelHeaderRows(excelData, out firstRow)) { startIdx = headers.IndexOf("AssetBundleName"); if (startIdx != -1) { break; } } //Logger.LogFatal($"IsAssetTable: {startIdx}"); if (startIdx != -1) { var row = excelData.GetRow(firstRow); //Logger.LogFatal($"IsAssetTable: {startIdx}: '{string.Join("', '", row.ToArray())}'"); if (GetAssetInfo(string.Empty, row, ref startIdx, out _)) { return(true); } } } return(false); }
public virtual List <List <string> > GetExcelHeaderRows(ExcelData asset, out int firstRow) { var headerRows = new List <List <string> >(); firstRow = 0; var headerRow = asset.GetRow(firstRow++); headerRows.Add(headerRow); var numEmpty = headerRow.Count(h => h.IsNullOrWhiteSpace()); var hiddenIndex = headerRow.IndexOf("非表示オブジェクト"); if (headerRow.Count == numEmpty || headerRow.Count > 1 && headerRow[1].IsNullOrWhiteSpace() && ( headerRow[0].StartsWith("H") || headerRow[0] == "主人公")) { headerRows.Add(asset.GetRow(firstRow++)); } else if (hiddenIndex == -1 && numEmpty > 3 || numEmpty / (headerRow.Count * 1.0) > 0.49) { var testRow = asset.GetRow(firstRow); var testData = asset.GetRow(firstRow + 1); if (testRow.Count > 1) { if (testRow[0] == "表示順番" || testRow[0] == "管理番号" || testData.Count > 1 && int.TryParse(testData[0], out _) && !int.TryParse(testRow[0], out _)) { headerRows.Add(testRow); firstRow++; } } } else if (hiddenIndex > 0) { var testRow = asset.GetRow(firstRow); if (testRow.Count > hiddenIndex && testRow[0].IsNullOrEmpty() && !testRow[hiddenIndex].IsNullOrEmpty()) { var dataRow = asset.GetRow(firstRow + 1); if (dataRow.Count > 0 && !dataRow[0].IsNullOrEmpty()) { firstRow++; headerRows.Add(testRow); } } } var rowNum = -1; foreach (var row in headerRows) { rowNum++; Logger.DebugLogDebug( $"{nameof(GetExcelHeaderRows)}: {asset.name}: firstRow={firstRow}, headerRows[{rowNum}]='{string.Join("', '", row.ToArray())}'"); } return(headerRows); }
private bool IsRedirectTable(ExcelData excelData) { if (excelData.MaxCell > 1) { var row = excelData.GetRow(1); if (int.TryParse(row.GetElement(0), out _)) { var idx = 1; if (GetAssetInfo(row, ref idx, out _)) { return(true); } } } return(false); }