public override object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var lbi = (ListBoxItem)value; AsmListBoxItem item = (AsmListBoxItem)lbi.Content; AddressItem addressItem = item as AddressItem; string operand = addressItem.Operand ?? ""; Console.WriteLine(operand); int padding; operand = int.TryParse(parameter.ToString(), out padding) ? operand.PadRight(padding) : operand; AsmLine asmLine = item.AsmLine; if (asmLine.HasOperandArgument()) { if (asmLine.OperandArgument.HasLabel()) { if (!(asmLine.IsJumpOperation() || asmLine.IsBranchOperation() || asmLine.Opcode == "rts")) { string label = asmLine.OperandArgument.Label; operand = operand.Replace(label, "<Run Foreground=\"DarkOrange\">" + label + "</Run>"); } } } return(operand.Replace("&", "&")); }
private string ColorOpcodeOperand(AsmLine asmLine, string paddedOperand) { if (asmLine.HasOperandArgument()) { if (asmLine.OperandArgument.HasLabel()) { if (!(asmLine.IsJumpOperation() || asmLine.IsBranchOperation() || asmLine.Opcode == "rts")) { string label = asmLine.OperandArgument.Label; paddedOperand = "<Span>" + paddedOperand.Replace(label, "<Run Foreground=\"DarkOrange\">" + label + "</Run>").Replace("&", "&") + "</Span>"; } } } return(paddedOperand.Replace("&", "&")); }