From f547dfbb212b1ec3797380fc13566e755eed14ac Mon Sep 17 00:00:00 2001 From: adelikat Date: Tue, 27 Jan 2015 02:53:57 +0000 Subject: [PATCH] some fixes to last commit --- BizHawk.Client.Common/tools/Watch.cs | 11 ++++++----- BizHawk.Client.EmuHawk/tools/Watch/RamWatch.cs | 15 ++++----------- 2 files changed, 10 insertions(+), 16 deletions(-) diff --git a/BizHawk.Client.Common/tools/Watch.cs b/BizHawk.Client.Common/tools/Watch.cs index df35824515..9dd553fd6a 100644 --- a/BizHawk.Client.Common/tools/Watch.cs +++ b/BizHawk.Client.Common/tools/Watch.cs @@ -38,7 +38,7 @@ namespace BizHawk.Client.Common var type = Watch.DisplayTypeFromChar(parts[2][0]); var bigEndian = parts[3] == "0" ? false : true; var domain = domains[parts[4]]; - var notes = parts[5]; + var notes = parts[5].Trim(new[] { '\r', '\n' }); return Watch.GenerateWatch( domain, @@ -55,18 +55,19 @@ namespace BizHawk.Client.Common } } - public static string ToString(Watch watch, int numdigits) + public static string ToString(Watch watch, MemoryDomain domain) { + var numDigits = (domain.Size - 1).NumHexDigits(); + var sb = new StringBuilder(); sb - .Append((watch.Address ?? 0).ToHexString(numdigits)).Append('\t') + .Append((watch.Address ?? 0).ToHexString(numDigits)).Append('\t') .Append(watch.SizeAsChar).Append('\t') .Append(watch.TypeAsChar).Append('\t') .Append(watch.BigEndian ? '1' : '0').Append('\t') .Append(watch.DomainName).Append('\t') - .Append(watch.Notes) - .AppendLine(); + .Append(watch.Notes.Trim(new[] { '\r', '\n' })); return sb.ToString(); } diff --git a/BizHawk.Client.EmuHawk/tools/Watch/RamWatch.cs b/BizHawk.Client.EmuHawk/tools/Watch/RamWatch.cs index 679f12c82b..256a1728d4 100644 --- a/BizHawk.Client.EmuHawk/tools/Watch/RamWatch.cs +++ b/BizHawk.Client.EmuHawk/tools/Watch/RamWatch.cs @@ -7,6 +7,7 @@ using System.Linq; using System.Text; using System.Windows.Forms; +using BizHawk.Common.NumberExtensions; using BizHawk.Emulation.Common; using BizHawk.Emulation.Common.IEmulatorExtensions; @@ -343,20 +344,12 @@ namespace BizHawk.Client.EmuHawk private void CopyWatchesToClipBoard() { - var indexes = SelectedIndices.ToList(); - - if (indexes.Any()) + if (SelectedItems.Any()) { var sb = new StringBuilder(); - foreach (var index in indexes) + foreach (var watch in SelectedItems) { - foreach (ColumnHeader column in WatchListView.Columns) - { - sb.Append(GetColumnValue(column.Name, index)).Append('\t'); - } - - sb.Remove(sb.Length - 1, 1); - sb.AppendLine(); + sb.AppendLine(Watch.ToString(watch, _watches.Domain)); } if (sb.Length > 0)