private void LinkLabels() { var labelCol = m_HeaderCols["Label"]; var asmCol = m_HeaderCols["ASM"]; for (int row = 2; row <= m_Worksheet.Dimension.Rows; ++row) { var asmCell = m_Worksheet.Cells[row, asmCol]; var label = AsmUtils.GetJumpToLabel(asmCell.Text); if (string.IsNullOrEmpty(label)) { continue; } int labelRow; if (m_LabelRows.TryGetValue(label + ":", out labelRow)) { var linkCell = m_Worksheet.Cells[labelRow, asmCol]; asmCell.Hyperlink = new ExcelHyperLink(linkCell.Address, asmCell.Text); asmCell.StyleName = "Hyperlink"; } else { asmCell.Hyperlink = null; asmCell.StyleName = "Normal"; } } }
private HashSet <JumpSet> FindJumpSets() { var jumpSets = new Dictionary <int, JumpSet>(); var labelCol = m_HeaderCols["Label"]; var asmCol = m_HeaderCols["ASM"]; for (int row = 2; row <= m_Worksheet.Dimension.Rows; ++row) { var asmCell = m_Worksheet.Cells[row, asmCol]; var label = AsmUtils.GetJumpToLabel(asmCell.Text); if (string.IsNullOrEmpty(label)) { continue; } int labelRow; if (!m_LabelRows.TryGetValue(label + ":", out labelRow)) { continue; } JumpSet jumpSet; if (!jumpSets.TryGetValue(labelRow, out jumpSet)) { jumpSet = new JumpSet(labelRow); jumpSets[labelRow] = jumpSet; } jumpSet.AddSource(row); } return(new HashSet <JumpSet>(jumpSets.Values)); }
private void DrawSprites() { var asmCol = m_HeaderCols["ASM"]; var commentCol = m_HeaderCols["Comments"]; for (int row = m_Worksheet.Dimension.Rows; row >= 2; --row) { var asmCell = m_Worksheet.Cells[row, asmCol]; var commentCell = m_Worksheet.Cells[row, commentCol]; if (!s_IsSprite.IsMatch(commentCell.Text)) { continue; } // break up bytes to multiple rows: var bytes = AsmUtils.GetBytes(asmCell.Text).ToList(); if (bytes.Count > 1) { for (int i = bytes.Count - 1; i >= 1; --i) { m_Worksheet.InsertRow(row + 1, 1); var newAsmCell = m_Worksheet.Cells[row + 1, asmCol]; var newCommentCell = m_Worksheet.Cells[row + 1, commentCol]; newAsmCell.Value = $".byte ${bytes[i]}"; newCommentCell.Value = AsmUtils.DecodeSprite(newAsmCell.Text); } } asmCell.Value = $".byte ${bytes[0]}"; commentCell.Value = AsmUtils.DecodeSprite(asmCell.Text);; } }
private void DecodeAsms() { var asmCol = m_HeaderCols["ASM"]; var commentCol = m_HeaderCols["Comments"]; for (int row = 2; row <= m_Worksheet.Dimension.Rows; ++row) { var asmCell = m_Worksheet.Cells[row, asmCol]; var commentCell = m_Worksheet.Cells[row, commentCol]; var decode = AsmUtils.DecodeAsm(asmCell.Text); if (string.IsNullOrEmpty(decode)) { continue; } commentCell.Value = decode; } }