2011-01-23 18:56:39 +00:00
|
|
|
|
using System;
|
2013-09-28 01:24:45 +00:00
|
|
|
|
using System.Collections;
|
2011-01-23 18:56:39 +00:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.ComponentModel;
|
|
|
|
|
using System.Drawing;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Windows.Forms;
|
2011-02-20 20:05:48 +00:00
|
|
|
|
using System.IO;
|
|
|
|
|
using System.Globalization;
|
2011-01-23 18:56:39 +00:00
|
|
|
|
|
|
|
|
|
namespace BizHawk.MultiClient
|
|
|
|
|
{
|
2011-06-19 19:10:01 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// A winform designed to search through ram values
|
|
|
|
|
/// </summary>
|
|
|
|
|
public partial class RamSearch : Form
|
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
public const string ADDRESS = "AddressColumn";
|
|
|
|
|
public const string VALUE = "ValueColumn";
|
|
|
|
|
public const string PREV = "PrevColumn";
|
|
|
|
|
public const string CHANGES = "ChangesColumn";
|
|
|
|
|
public const string DIFF = "DiffColumn";
|
|
|
|
|
|
|
|
|
|
private readonly Dictionary<string, int> DefaultColumnWidths = new Dictionary<string, int>
|
|
|
|
|
{
|
|
|
|
|
{ ADDRESS, 60 },
|
|
|
|
|
{ VALUE, 59 },
|
|
|
|
|
{ PREV, 59 },
|
|
|
|
|
{ CHANGES, 55 },
|
|
|
|
|
{ DIFF, 59 },
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
private string CurrentFileName = String.Empty;
|
|
|
|
|
|
|
|
|
|
private RamSearchEngine Searches;
|
|
|
|
|
private RamSearchEngine.Settings Settings;
|
|
|
|
|
|
2013-02-25 01:23:03 +00:00
|
|
|
|
private int defaultWidth; //For saving the default size of the dialog, so the user can restore if desired
|
|
|
|
|
private int defaultHeight;
|
2013-09-28 01:24:45 +00:00
|
|
|
|
private string _sortedColumn = "";
|
|
|
|
|
private bool _sortReverse = false;
|
2013-08-21 20:54:33 +00:00
|
|
|
|
private bool forcePreviewClear = false;
|
2013-09-28 01:24:45 +00:00
|
|
|
|
private bool autoSearch = false;
|
2011-06-19 19:10:01 +00:00
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
#region Initialize, Load, and Save
|
2011-06-19 19:10:01 +00:00
|
|
|
|
|
|
|
|
|
public RamSearch()
|
|
|
|
|
{
|
2011-08-27 13:56:06 +00:00
|
|
|
|
SetStyle(ControlStyles.AllPaintingInWmPaint, true);
|
|
|
|
|
SetStyle(ControlStyles.UserPaint, true);
|
|
|
|
|
SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
|
2011-06-19 19:10:01 +00:00
|
|
|
|
InitializeComponent();
|
2013-09-28 01:24:45 +00:00
|
|
|
|
WatchListView.QueryItemText += ListView_QueryItemText;
|
|
|
|
|
WatchListView.QueryItemBkColor += ListView_QueryItemBkColor;
|
|
|
|
|
WatchListView.VirtualMode = true;
|
2011-06-19 19:10:01 +00:00
|
|
|
|
Closing += (o, e) => SaveConfigSettings();
|
2013-09-28 01:24:45 +00:00
|
|
|
|
|
|
|
|
|
_sortedColumn = "";
|
|
|
|
|
_sortReverse = false;
|
|
|
|
|
|
|
|
|
|
Settings = new RamSearchEngine.Settings();
|
|
|
|
|
Searches = new RamSearchEngine(Settings);
|
|
|
|
|
|
|
|
|
|
TopMost = Global.Config.RamSearchAlwaysOnTop;
|
|
|
|
|
SetReboot(false);
|
2011-06-19 19:10:01 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
private void RamSearch_Load(object sender, EventArgs e)
|
2011-06-19 19:10:01 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
LoadConfigSettings();
|
|
|
|
|
SpecificValueBox.ByteSize = Settings.Size;
|
|
|
|
|
SpecificValueBox.Type = Settings.Type;
|
|
|
|
|
MessageLabel.Text = String.Empty;
|
|
|
|
|
NewSearch();
|
|
|
|
|
}
|
2011-08-21 20:28:22 +00:00
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
private void ListView_QueryItemBkColor(int index, int column, ref Color color)
|
|
|
|
|
{
|
|
|
|
|
if (Searches.Count > 0 && column == 0)
|
2012-08-29 01:42:04 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
Color nextColor = Color.White;
|
2013-06-30 20:10:52 +00:00
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
bool isCheat = Global.CheatList.IsActiveCheat(Settings.Domain, Searches[index].Address.Value);
|
|
|
|
|
bool isWeeded = Global.Config.RamSearchPreviewMode && Searches.Preview(Searches[index].Address.Value) && !forcePreviewClear;
|
2012-08-29 01:42:04 +00:00
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
if (isCheat)
|
2013-06-30 21:50:17 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
if (isWeeded)
|
|
|
|
|
{
|
|
|
|
|
nextColor = Color.Lavender;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
nextColor = Color.LightCyan;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (isWeeded)
|
|
|
|
|
{
|
|
|
|
|
nextColor = Color.Pink;
|
|
|
|
|
}
|
2013-06-30 21:50:17 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
if (color != nextColor)
|
|
|
|
|
{
|
|
|
|
|
color = nextColor;
|
|
|
|
|
}
|
2012-08-29 01:42:04 +00:00
|
|
|
|
}
|
2011-06-19 19:10:01 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
private void ListView_QueryItemText(int index, int column, out string text)
|
2011-06-19 19:10:01 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
text = "";
|
2011-06-19 19:10:01 +00:00
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
if (index >= Searches.Count)
|
2012-06-02 21:48:09 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
return;
|
2012-06-02 21:48:09 +00:00
|
|
|
|
}
|
2013-09-28 01:24:45 +00:00
|
|
|
|
|
|
|
|
|
string columnName = WatchListView.Columns[column].Name;
|
|
|
|
|
switch (columnName)
|
2012-06-02 21:48:09 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
case ADDRESS:
|
|
|
|
|
text = Searches[index].AddressString;
|
|
|
|
|
break;
|
|
|
|
|
case VALUE:
|
|
|
|
|
text = Searches[index].ValueString;
|
|
|
|
|
break;
|
|
|
|
|
case PREV:
|
|
|
|
|
text = Searches[index].PreviousStr;
|
|
|
|
|
break;
|
|
|
|
|
case CHANGES:
|
2013-09-28 02:42:56 +00:00
|
|
|
|
text = Searches[index].ChangeCount.ToString();
|
2013-09-28 01:24:45 +00:00
|
|
|
|
break;
|
|
|
|
|
case DIFF:
|
2013-09-28 02:42:56 +00:00
|
|
|
|
text = Searches[index].Diff;
|
2013-09-28 01:24:45 +00:00
|
|
|
|
break;
|
2012-06-02 21:48:09 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2011-06-19 19:10:01 +00:00
|
|
|
|
private void LoadConfigSettings()
|
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
//Size and Positioning
|
2013-04-14 23:56:45 +00:00
|
|
|
|
defaultWidth = Size.Width; //Save these first so that the user can restore to its original size
|
|
|
|
|
defaultHeight = Size.Height;
|
2011-06-19 19:10:01 +00:00
|
|
|
|
|
|
|
|
|
if (Global.Config.RamSearchSaveWindowPosition && Global.Config.RamSearchWndx >= 0 && Global.Config.RamSearchWndy >= 0)
|
2013-09-28 01:24:45 +00:00
|
|
|
|
{
|
2013-04-14 23:56:45 +00:00
|
|
|
|
Location = new Point(Global.Config.RamSearchWndx, Global.Config.RamSearchWndy);
|
2013-09-28 01:24:45 +00:00
|
|
|
|
}
|
2011-06-19 19:10:01 +00:00
|
|
|
|
|
|
|
|
|
if (Global.Config.RamSearchWidth >= 0 && Global.Config.RamSearchHeight >= 0)
|
|
|
|
|
{
|
2013-04-14 23:56:45 +00:00
|
|
|
|
Size = new Size(Global.Config.RamSearchWidth, Global.Config.RamSearchHeight);
|
2011-06-19 19:10:01 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
TopMost = Global.Config.RamSearchAlwaysOnTop;
|
|
|
|
|
|
|
|
|
|
LoadColumnInfo();
|
2011-06-19 19:10:01 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region Public
|
|
|
|
|
|
|
|
|
|
public void UpdateValues()
|
2011-06-19 19:10:01 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
if (Searches.Count > 0)
|
2011-06-19 19:10:01 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
Searches.Update();
|
|
|
|
|
|
|
|
|
|
if (autoSearch)
|
2011-06-19 19:10:01 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
DoSearch();
|
2011-06-19 19:10:01 +00:00
|
|
|
|
}
|
2013-09-28 01:24:45 +00:00
|
|
|
|
|
|
|
|
|
WatchListView.Refresh();
|
2011-06-19 19:10:01 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Restart()
|
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
//TODO
|
2013-04-14 23:56:45 +00:00
|
|
|
|
if (!IsHandleCreated || IsDisposed) return;
|
2013-09-28 01:24:45 +00:00
|
|
|
|
Settings.Domain = Global.Emulator.MainMemory;
|
|
|
|
|
NewSearch();
|
2011-06-19 19:10:01 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
public void SaveConfigSettings()
|
2012-03-09 18:50:26 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
SaveColumnInfo();
|
|
|
|
|
|
|
|
|
|
Global.Config.RamSearchWndx = Location.X;
|
|
|
|
|
Global.Config.RamSearchWndy = Location.Y;
|
|
|
|
|
Global.Config.RamSearchWidth = Right - Left;
|
|
|
|
|
Global.Config.RamSearchHeight = Bottom - Top;
|
2012-03-09 18:50:26 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region Private
|
|
|
|
|
|
|
|
|
|
private void NewSearch()
|
2011-06-19 19:10:01 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
Searches = new RamSearchEngine(Settings);
|
|
|
|
|
Searches.Start();
|
|
|
|
|
if (Global.Config.RamSearchAlwaysExcludeRamWatch)
|
2011-06-19 19:10:01 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
RemoveRamWatchesFromList();
|
2011-06-19 19:10:01 +00:00
|
|
|
|
}
|
2013-09-28 01:24:45 +00:00
|
|
|
|
|
|
|
|
|
SetTotal();
|
|
|
|
|
WatchListView.ItemCount = Searches.Count;
|
|
|
|
|
ToggleSearchDependentToolBarItems();
|
|
|
|
|
SetReboot(false);
|
2011-06-19 19:10:01 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
private void ToggleSearchDependentToolBarItems()
|
2011-06-19 19:10:01 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
DoSearchToolButton.Enabled =
|
|
|
|
|
CopyValueToPrevToolBarItem.Enabled =
|
|
|
|
|
Searches.Count > 0;
|
|
|
|
|
UpdateUndoToolBarButtons();
|
2011-06-19 19:10:01 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
private void DoSearch()
|
2011-06-19 19:10:01 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
int removed = Searches.DoSearch();
|
|
|
|
|
SetTotal();
|
|
|
|
|
WatchListView.ItemCount = Searches.Count;
|
|
|
|
|
SetRemovedMessage(removed);
|
|
|
|
|
ToggleSearchDependentToolBarItems();
|
2011-06-19 19:10:01 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
private List<int> SelectedIndices
|
2011-06-19 19:10:01 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
var indices = new List<int>();
|
|
|
|
|
foreach (int index in WatchListView.SelectedIndices)
|
|
|
|
|
{
|
|
|
|
|
indices.Add(index);
|
|
|
|
|
}
|
|
|
|
|
return indices;
|
|
|
|
|
}
|
2011-06-19 19:10:01 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
private void SetRemovedMessage(int val)
|
2011-06-19 19:10:01 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
MessageLabel.Text = val.ToString() + " address" + (val != 1 ? "es" : String.Empty) + " removed";
|
2011-06-19 19:10:01 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
private void SetTotal()
|
2011-06-19 19:10:01 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
TotalSearchLabel.Text = String.Format("{0:n0}", Searches.Count) + " addresses";
|
2011-06-19 19:10:01 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
private void SetDomainLabel()
|
2011-06-19 19:10:01 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
MemDomainLabel.Text = Searches.DomainName;
|
2011-06-19 19:10:01 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
private void LoadFileFromRecent(string path)
|
2011-06-19 19:10:01 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
FileInfo file = new FileInfo(path);
|
|
|
|
|
|
|
|
|
|
if (!file.Exists)
|
2011-06-19 19:10:01 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
Global.Config.RecentSearches.HandleLoadError(path);
|
2011-06-19 19:10:01 +00:00
|
|
|
|
}
|
2013-09-28 01:24:45 +00:00
|
|
|
|
else
|
2011-06-19 19:10:01 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
LoadWatchFile(file, append: false);
|
2011-06-19 19:10:01 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
private void SetPlatformAndMemoryDomainLabel()
|
2011-06-19 19:10:01 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
MemDomainLabel.Text = Global.Emulator.SystemId + " " + Searches.DomainName;
|
2011-06-19 19:10:01 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
private void SetMemoryDomain(int pos)
|
2011-06-19 19:10:01 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
if (pos < Global.Emulator.MemoryDomains.Count) //Sanity check
|
2011-06-19 19:10:01 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
Settings.Domain = Global.Emulator.MemoryDomains[pos];
|
|
|
|
|
SetDomainLabel();
|
|
|
|
|
SetReboot(true);
|
2011-06-19 19:10:01 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
private void LoadColumnInfo()
|
2011-06-19 19:10:01 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
WatchListView.Columns.Clear();
|
|
|
|
|
AddColumn(ADDRESS, true);
|
|
|
|
|
AddColumn(VALUE, true);
|
|
|
|
|
AddColumn(PREV, Global.Config.RamSearchShowPrevColumn);
|
|
|
|
|
AddColumn(CHANGES, Global.Config.RamSearchShowChangeColumn);
|
|
|
|
|
AddColumn(DIFF, Global.Config.RamSearchShowDiffColumn);
|
|
|
|
|
|
|
|
|
|
ColumnPositions();
|
2011-06-19 19:10:01 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
private void ColumnPositions()
|
2011-06-19 19:10:01 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
List<KeyValuePair<string, int>> Columns =
|
|
|
|
|
Global.Config.RamSearchColumnIndexes
|
|
|
|
|
.Where(x => WatchListView.Columns.ContainsKey(x.Key))
|
|
|
|
|
.OrderBy(x => x.Value).ToList();
|
2011-06-19 19:10:01 +00:00
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
for (int i = 0; i < Columns.Count; i++)
|
2011-06-19 19:10:01 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
if (WatchListView.Columns.ContainsKey(Columns[i].Key))
|
2012-08-15 01:14:25 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
WatchListView.Columns[Columns[i].Key].DisplayIndex = i;
|
2012-08-15 01:14:25 +00:00
|
|
|
|
}
|
2011-06-19 19:10:01 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
private void SaveColumnInfo()
|
2011-06-19 19:10:01 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
if (WatchListView.Columns[ADDRESS] != null)
|
|
|
|
|
{
|
|
|
|
|
Global.Config.RamSearchColumnIndexes[ADDRESS] = WatchListView.Columns[ADDRESS].DisplayIndex;
|
|
|
|
|
Global.Config.RamSearchColumnWidths[ADDRESS] = WatchListView.Columns[ADDRESS].Width;
|
|
|
|
|
}
|
2011-06-19 19:10:01 +00:00
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
if (WatchListView.Columns[VALUE] != null)
|
2012-09-03 23:42:00 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
Global.Config.RamSearchColumnIndexes[VALUE] = WatchListView.Columns[VALUE].DisplayIndex;
|
|
|
|
|
Global.Config.RamSearchColumnWidths[VALUE] = WatchListView.Columns[VALUE].Width;
|
2012-09-03 23:42:00 +00:00
|
|
|
|
}
|
2013-09-28 01:24:45 +00:00
|
|
|
|
|
|
|
|
|
if (WatchListView.Columns[PREV] != null)
|
2012-09-03 23:42:00 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
Global.Config.RamSearchColumnIndexes[PREV] = WatchListView.Columns[PREV].DisplayIndex;
|
|
|
|
|
Global.Config.RamSearchColumnWidths[PREV] = WatchListView.Columns[PREV].Width;
|
2012-09-03 23:42:00 +00:00
|
|
|
|
}
|
2013-09-28 01:24:45 +00:00
|
|
|
|
|
|
|
|
|
if (WatchListView.Columns[CHANGES] != null)
|
2012-09-03 23:42:00 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
Global.Config.RamSearchColumnIndexes[CHANGES] = WatchListView.Columns[CHANGES].DisplayIndex;
|
|
|
|
|
Global.Config.RamSearchColumnWidths[CHANGES] = WatchListView.Columns[CHANGES].Width;
|
2012-09-03 23:42:00 +00:00
|
|
|
|
}
|
2013-09-28 01:24:45 +00:00
|
|
|
|
|
|
|
|
|
if (WatchListView.Columns[DIFF] != null)
|
2012-09-03 23:42:00 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
Global.Config.RamSearchColumnIndexes[DIFF] = WatchListView.Columns[DIFF].DisplayIndex;
|
|
|
|
|
Global.Config.RamSearchColumnWidths[DIFF] = WatchListView.Columns[DIFF].Width;
|
2012-09-03 23:42:00 +00:00
|
|
|
|
}
|
2011-06-19 19:10:01 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
private int GetColumnWidth(string columnName)
|
2011-06-19 19:10:01 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
var width = Global.Config.RamSearchColumnWidths[columnName];
|
|
|
|
|
if (width == -1)
|
2012-09-03 23:42:00 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
width = DefaultColumnWidths[columnName];
|
2012-09-03 23:42:00 +00:00
|
|
|
|
}
|
2011-06-19 19:10:01 +00:00
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
return width;
|
2011-06-19 19:10:01 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
private void AddColumn(string columnName, bool enabled)
|
2011-06-19 19:10:01 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
if (enabled)
|
2011-06-19 19:10:01 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
if (WatchListView.Columns[columnName] == null)
|
2011-06-19 19:10:01 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
ColumnHeader column = new ColumnHeader
|
2011-06-19 19:10:01 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
Name = columnName,
|
|
|
|
|
Text = columnName.Replace("Column", ""),
|
|
|
|
|
Width = GetColumnWidth(columnName),
|
|
|
|
|
};
|
2011-06-19 19:10:01 +00:00
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
WatchListView.Columns.Add(column);
|
|
|
|
|
}
|
2011-06-19 19:10:01 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
private void DoDisplayTypeClick(Watch.DisplayType type)
|
2011-06-19 19:10:01 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
SpecificValueBox.Type = Settings.Type = type;
|
|
|
|
|
Searches.SetType(type);
|
2011-06-19 19:10:01 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
private void SetPreviousStype(Watch.PreviousType type)
|
2011-06-19 19:10:01 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
Settings.PreviousType = type;
|
|
|
|
|
Searches.SetPreviousType(type);
|
2011-06-19 19:10:01 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
private void SetSize(Watch.WatchSize size)
|
2011-06-19 19:10:01 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
SpecificValueBox.ByteSize = Settings.Size = size;
|
|
|
|
|
SetReboot(true);
|
2011-06-19 19:10:01 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
private void SetComparisonOperator(RamSearchEngine.ComparisonOperator op)
|
2011-06-19 19:10:01 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
Searches.Operator = op;
|
2011-06-19 19:10:01 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
private void SetCompareTo(RamSearchEngine.Compare comp)
|
2011-06-19 19:10:01 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
Searches.CompareTo = comp;
|
2011-06-19 19:10:01 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
private void SetCompareValue(int? value)
|
2011-06-19 19:10:01 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
Searches.CompareValue = value;
|
2011-06-19 19:10:01 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
private void SetReboot(bool rebootNeeded)
|
2011-06-19 19:10:01 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
RebootToolBarSeparator.Visible =
|
|
|
|
|
RebootToolbarButton.Visible =
|
|
|
|
|
rebootNeeded;
|
2011-06-19 19:10:01 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
private void SetToDetailedMode()
|
2011-06-19 19:10:01 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
Settings.Mode = RamSearchEngine.Settings.SearchMode.Detailed;
|
|
|
|
|
NumberOfChangesRadio.Enabled = true;
|
|
|
|
|
NumberOfChangesBox.Enabled = true;
|
|
|
|
|
DifferenceRadio.Enabled = true;
|
|
|
|
|
DifferentByBox.Enabled = true;
|
|
|
|
|
ClearChangeCountsToolBarItem.Enabled = true;
|
|
|
|
|
WatchListView.Columns[CHANGES].Width = Global.Config.RamSearchColumnWidths[CHANGES];
|
|
|
|
|
SetReboot(true);
|
2011-06-19 19:10:01 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
private void SetToFastMode()
|
2011-06-19 19:10:01 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
Settings.Mode = RamSearchEngine.Settings.SearchMode.Fast;
|
2011-06-19 19:10:01 +00:00
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
if (Settings.PreviousType == Watch.PreviousType.LastFrame || Settings.PreviousType == Watch.PreviousType.LastChange)
|
|
|
|
|
{
|
|
|
|
|
SetPreviousStype(Watch.PreviousType.LastSearch);
|
|
|
|
|
}
|
2011-06-19 19:10:01 +00:00
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
NumberOfChangesRadio.Enabled = false;
|
|
|
|
|
NumberOfChangesBox.Enabled = false;
|
|
|
|
|
NumberOfChangesBox.Text = String.Empty;
|
|
|
|
|
ClearChangeCountsToolBarItem.Enabled = false;
|
|
|
|
|
|
|
|
|
|
if (NumberOfChangesRadio.Checked || DifferenceRadio.Checked)
|
2011-06-19 19:10:01 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
PreviousValueRadio.Checked = true;
|
2011-06-19 19:10:01 +00:00
|
|
|
|
}
|
2013-09-28 01:24:45 +00:00
|
|
|
|
|
|
|
|
|
Global.Config.RamSearchColumnWidths[CHANGES] = WatchListView.Columns[CHANGES].Width;
|
|
|
|
|
WatchListView.Columns[CHANGES].Width = 0;
|
|
|
|
|
SetReboot(true);
|
2011-06-19 19:10:01 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
private void RemoveAddresses()
|
2011-08-15 19:33:18 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
if (SelectedIndices.Count > 0)
|
2011-09-14 23:36:36 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
SetRemovedMessage(SelectedIndices.Count);
|
|
|
|
|
|
|
|
|
|
var addresses = new List<int>();
|
|
|
|
|
foreach (int index in SelectedIndices)
|
|
|
|
|
{
|
|
|
|
|
addresses.Add(Searches[index].Address.Value);
|
|
|
|
|
}
|
|
|
|
|
Searches.RemoveRange(addresses);
|
|
|
|
|
|
|
|
|
|
WatchListView.ItemCount = Searches.Count;
|
|
|
|
|
SetTotal();
|
|
|
|
|
WatchListView.SelectedIndices.Clear();
|
2011-09-14 23:36:36 +00:00
|
|
|
|
}
|
2011-08-15 19:33:18 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
public void LoadWatchFile(FileInfo file, bool append, bool truncate = false)
|
2011-02-20 01:27:22 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
if (file != null)
|
2011-06-19 19:10:01 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
if (!truncate)
|
2011-06-19 19:10:01 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
CurrentFileName = file.FullName;
|
2011-08-27 14:49:13 +00:00
|
|
|
|
}
|
2013-09-28 01:24:45 +00:00
|
|
|
|
|
|
|
|
|
WatchList watches = new WatchList(Settings.Domain);
|
2013-09-28 02:42:56 +00:00
|
|
|
|
watches.Load(file.FullName, append);
|
2013-09-28 01:24:45 +00:00
|
|
|
|
List<int> addresses = watches.Where(x => !x.IsSeparator).Select(x => x.Address.Value).ToList();
|
|
|
|
|
|
|
|
|
|
if (truncate)
|
2012-08-29 01:42:04 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
SetRemovedMessage(addresses.Count);
|
|
|
|
|
Searches.RemoveRange(addresses);
|
2012-08-29 01:42:04 +00:00
|
|
|
|
}
|
2011-08-27 14:49:13 +00:00
|
|
|
|
else
|
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
Searches.AddRange(addresses, append);
|
|
|
|
|
MessageLabel.Text = file.Name + " loaded";
|
2013-08-21 20:54:33 +00:00
|
|
|
|
}
|
2013-09-28 01:24:45 +00:00
|
|
|
|
|
|
|
|
|
WatchListView.ItemCount = Searches.Count;
|
|
|
|
|
SetTotal();
|
|
|
|
|
Global.Config.RecentSearches.Add(file.FullName);
|
|
|
|
|
|
|
|
|
|
if (!append && !truncate)
|
2013-08-21 20:54:33 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
Searches.ClearHistory();
|
2013-08-21 20:54:33 +00:00
|
|
|
|
}
|
2013-09-28 01:24:45 +00:00
|
|
|
|
|
|
|
|
|
ToggleSearchDependentToolBarItems();
|
2013-08-21 20:54:33 +00:00
|
|
|
|
}
|
2013-09-28 01:24:45 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void AddToRamWatch()
|
|
|
|
|
{
|
|
|
|
|
if (SelectedIndices.Count > 0)
|
2013-08-21 20:54:33 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
Global.MainForm.LoadRamWatch(true);
|
|
|
|
|
for (int x = 0; x < SelectedIndices.Count; x++)
|
2013-08-21 20:54:33 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
Global.MainForm.RamWatch1.AddWatch(Searches[SelectedIndices[x]]);
|
2013-08-21 20:54:33 +00:00
|
|
|
|
}
|
2013-09-28 01:24:45 +00:00
|
|
|
|
|
|
|
|
|
if (Global.Config.RamSearchAlwaysExcludeRamWatch)
|
2013-08-21 20:54:33 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
RemoveRamWatchesFromList();
|
2013-08-21 20:54:33 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2011-02-20 01:27:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
private Point GetPromptPoint()
|
2011-02-20 01:27:22 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
return PointToScreen(new Point(WatchListView.Location.X, WatchListView.Location.Y));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void PokeAddress()
|
|
|
|
|
{
|
|
|
|
|
if (SelectedIndices.Count > 0)
|
2011-06-19 19:10:01 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
Global.Sound.StopSound();
|
|
|
|
|
var poke = new RamPoke();
|
|
|
|
|
|
|
|
|
|
var watches = new List<Watch>();
|
|
|
|
|
for (int i = 0; i < SelectedIndices.Count; i++)
|
2012-06-09 01:56:56 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
watches.Add(Searches[SelectedIndices[i]]);
|
2012-06-09 01:56:56 +00:00
|
|
|
|
}
|
2013-09-28 01:24:45 +00:00
|
|
|
|
|
|
|
|
|
poke.SetWatch(watches);
|
|
|
|
|
poke.InitialLocation = GetPromptPoint();
|
|
|
|
|
poke.ShowDialog();
|
|
|
|
|
UpdateValues();
|
|
|
|
|
Global.Sound.StartSound();
|
2012-08-20 00:22:57 +00:00
|
|
|
|
}
|
2011-02-20 01:27:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
private List<Watch> SelectedWatches
|
2011-06-19 19:10:01 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
get
|
2012-09-02 01:21:57 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
var selected = new List<Watch>();
|
|
|
|
|
ListView.SelectedIndexCollection indexes = WatchListView.SelectedIndices;
|
|
|
|
|
if (indexes.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
foreach (int index in indexes)
|
|
|
|
|
{
|
|
|
|
|
if (!Searches[index].IsSeparator)
|
|
|
|
|
{
|
|
|
|
|
selected.Add(Searches[index]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return selected;
|
2012-09-02 01:21:57 +00:00
|
|
|
|
}
|
2013-09-28 01:24:45 +00:00
|
|
|
|
}
|
2013-02-25 01:23:03 +00:00
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
private void FreezeAddress()
|
|
|
|
|
{
|
|
|
|
|
ToolHelpers.FreezeAddress(SelectedWatches);
|
2011-06-19 19:10:01 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
private void RemoveRamWatchesFromList()
|
2011-06-19 19:10:01 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
Searches.RemoveRange(Global.MainForm.RamWatch1.AddressList);
|
|
|
|
|
WatchListView.ItemCount = Searches.Count;
|
|
|
|
|
SetTotal();
|
2011-06-19 19:10:01 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
private void UpdateUndoToolBarButtons()
|
2011-06-19 19:10:01 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
UndoToolBarButton.Enabled = Searches.CanUndo;
|
|
|
|
|
RedoToolBarItem.Enabled = Searches.CanRedo;
|
2011-06-19 19:10:01 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
private string GetColumnValue(string name, int index)
|
2011-06-19 19:10:01 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
switch (name)
|
2011-06-19 19:10:01 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
default:
|
|
|
|
|
return String.Empty;
|
|
|
|
|
case ADDRESS:
|
|
|
|
|
return Searches[index].AddressString;
|
|
|
|
|
case VALUE:
|
|
|
|
|
return Searches[index].ValueString;
|
|
|
|
|
case PREV:
|
|
|
|
|
return Searches[index].PreviousStr;
|
|
|
|
|
case CHANGES:
|
2013-09-28 02:42:56 +00:00
|
|
|
|
return Searches[index].ChangeCount.ToString();
|
2013-09-28 01:24:45 +00:00
|
|
|
|
case DIFF:
|
2013-09-28 02:42:56 +00:00
|
|
|
|
return Searches[index].Diff;
|
2011-06-19 19:10:01 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
private void ToggleAutoSearch()
|
2012-09-02 01:05:08 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
autoSearch ^= true;
|
|
|
|
|
AutoSearchCheckBox.Checked = autoSearch;
|
|
|
|
|
DoSearchToolButton.Enabled =
|
|
|
|
|
SearchButton.Enabled =
|
|
|
|
|
!autoSearch;
|
2012-09-02 01:05:08 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
#endregion
|
2011-06-19 19:10:01 +00:00
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
#region Winform Events
|
2011-06-19 19:10:01 +00:00
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
#region File
|
2011-06-19 19:10:01 +00:00
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
private void FileSubMenu_DropDownOpened(object sender, EventArgs e)
|
2011-06-19 19:10:01 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
SaveMenuItem.Enabled = !String.IsNullOrWhiteSpace(CurrentFileName);
|
2011-06-19 19:10:01 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
private void RecentSubMenu_DropDownOpened(object sender, EventArgs e)
|
2011-06-19 19:10:01 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
RecentSubMenu.DropDownItems.Clear();
|
|
|
|
|
RecentSubMenu.DropDownItems.AddRange(Global.Config.RecentSearches.GenerateRecentMenu(LoadFileFromRecent));
|
2011-06-19 19:10:01 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
private void OpenMenuItem_Click(object sender, EventArgs e)
|
2011-06-19 19:10:01 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
LoadWatchFile(
|
|
|
|
|
WatchList.GetFileFromUser(String.Empty),
|
|
|
|
|
sender == AppendFileMenuItem,
|
|
|
|
|
sender == TruncateFromFileMenuItem
|
|
|
|
|
);
|
2011-06-19 19:10:01 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
private void SaveMenuItem_Click(object sender, EventArgs e)
|
2011-06-19 19:10:01 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
if (!String.IsNullOrWhiteSpace(CurrentFileName))
|
2011-06-19 19:10:01 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
WatchList watches = new WatchList(Settings.Domain);
|
|
|
|
|
watches.CurrentFileName = CurrentFileName;
|
|
|
|
|
for (int i = 0; i < Searches.Count; i++)
|
2012-06-10 04:32:25 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
watches.Add(Searches[i]);
|
|
|
|
|
}
|
2012-06-02 21:48:09 +00:00
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
if (watches.Save())
|
|
|
|
|
{
|
|
|
|
|
CurrentFileName = watches.CurrentFileName;
|
|
|
|
|
MessageLabel.Text = Path.GetFileName(CurrentFileName) + " saved";
|
|
|
|
|
}
|
|
|
|
|
}
|
2011-06-19 19:10:01 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
private void SaveAsMenuItem_Click(object sender, EventArgs e)
|
2011-06-19 19:10:01 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
WatchList watches = new WatchList(Settings.Domain);
|
|
|
|
|
watches.CurrentFileName = CurrentFileName;
|
|
|
|
|
for (int i = 0; i < Searches.Count; i++)
|
2013-04-14 23:56:45 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
watches.Add(Searches[i]);
|
2013-04-14 23:56:45 +00:00
|
|
|
|
}
|
2013-09-28 01:24:45 +00:00
|
|
|
|
|
|
|
|
|
if (watches.SaveAs())
|
2013-04-14 23:56:45 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
CurrentFileName = watches.CurrentFileName;
|
|
|
|
|
MessageLabel.Text = Path.GetFileName(CurrentFileName) + " saved";
|
|
|
|
|
Global.Config.RecentSearches.Add(watches.CurrentFileName);
|
2013-04-14 23:56:45 +00:00
|
|
|
|
}
|
2011-06-19 19:10:01 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
private void CloseMenuItem_Click(object sender, EventArgs e)
|
2011-06-19 19:10:01 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
Close();
|
2011-06-19 19:10:01 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region Settings
|
2011-06-19 19:10:01 +00:00
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
private void SettingsSubMenu_DropDownOpened(object sender, EventArgs e)
|
2011-06-19 19:10:01 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
CheckMisalignedMenuItem.Checked = Settings.CheckMisAligned;
|
|
|
|
|
BigEndianMenuItem.Checked = Settings.BigEndian;
|
2011-06-19 19:10:01 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
private void ModeSubMenu_DropDownOpened(object sender, EventArgs e)
|
2011-06-19 19:10:01 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
DetailedMenuItem.Checked = Settings.Mode == RamSearchEngine.Settings.SearchMode.Detailed;
|
|
|
|
|
FastMenuItem.Checked = Settings.Mode == RamSearchEngine.Settings.SearchMode.Fast;
|
2011-06-19 19:10:01 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
private void MemoryDomainsSubMenu_DropDownOpened(object sender, EventArgs e)
|
2011-06-19 19:10:01 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
MemoryDomainsSubMenu.DropDownItems.Clear();
|
|
|
|
|
MemoryDomainsSubMenu.DropDownItems.AddRange(ToolHelpers.GenerateMemoryDomainMenuItems(SetMemoryDomain, Searches.DomainName));
|
2011-06-19 19:10:01 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
private void SizeSubMenu_DropDownOpened(object sender, EventArgs e)
|
2011-06-19 19:10:01 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
_1ByteMenuItem.Checked = Settings.Size == Watch.WatchSize.Byte;
|
|
|
|
|
_2ByteMenuItem.Checked = Settings.Size == Watch.WatchSize.Word;
|
|
|
|
|
_4ByteMenuItem.Checked = Settings.Size == Watch.WatchSize.DWord;
|
2011-06-19 19:10:01 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
private void DisplayTypeSubMenu_DropDownOpened(object sender, EventArgs e)
|
2011-06-19 19:10:01 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
DisplayTypeSubMenu.DropDownItems.Clear();
|
|
|
|
|
|
|
|
|
|
foreach (var type in Watch.AvailableTypes(Settings.Size))
|
2013-09-09 21:36:26 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
var item = new ToolStripMenuItem()
|
|
|
|
|
{
|
|
|
|
|
Name = type.ToString() + "ToolStripMenuItem",
|
|
|
|
|
Text = Watch.DisplayTypeToString(type),
|
|
|
|
|
Checked = Settings.Type == type,
|
|
|
|
|
};
|
|
|
|
|
item.Click += (o, ev) => DoDisplayTypeClick(type);
|
|
|
|
|
|
|
|
|
|
DisplayTypeSubMenu.DropDownItems.Add(item);
|
2011-06-19 19:10:01 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
private void DefinePreviousValueSubMenu_DropDownOpened(object sender, EventArgs e)
|
2011-06-19 19:10:01 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
Previous_LastSearchMenuItem.Checked = false;
|
|
|
|
|
Previous_LastChangeMenuItem.Checked = false;
|
|
|
|
|
PreviousFrameMenuItem.Checked = false;
|
|
|
|
|
Previous_OriginalMenuItem.Checked = false;
|
2011-06-19 19:10:01 +00:00
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
switch (Settings.PreviousType)
|
2011-06-19 19:10:01 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
default:
|
|
|
|
|
case Watch.PreviousType.LastSearch:
|
|
|
|
|
Previous_LastSearchMenuItem.Checked = true;
|
|
|
|
|
break;
|
|
|
|
|
case Watch.PreviousType.LastChange:
|
|
|
|
|
Previous_LastChangeMenuItem.Checked = true;
|
|
|
|
|
break;
|
|
|
|
|
case Watch.PreviousType.LastFrame:
|
|
|
|
|
PreviousFrameMenuItem.Checked = true;
|
|
|
|
|
break;
|
|
|
|
|
case Watch.PreviousType.Original:
|
|
|
|
|
Previous_OriginalMenuItem.Checked = true;
|
|
|
|
|
break;
|
|
|
|
|
}
|
2011-06-19 19:10:01 +00:00
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
if (Settings.Mode == RamSearchEngine.Settings.SearchMode.Fast)
|
|
|
|
|
{
|
|
|
|
|
Previous_LastChangeMenuItem.Enabled = false;
|
|
|
|
|
PreviousFrameMenuItem.Enabled = false;
|
2011-06-19 19:10:01 +00:00
|
|
|
|
}
|
2012-06-07 03:16:25 +00:00
|
|
|
|
else
|
2013-09-09 21:36:26 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
Previous_LastChangeMenuItem.Enabled = true;
|
|
|
|
|
PreviousFrameMenuItem.Enabled = true;
|
2013-09-09 21:36:26 +00:00
|
|
|
|
}
|
2011-06-19 19:10:01 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
private void DetailedMenuItem_Click(object sender, EventArgs e)
|
2011-06-19 19:10:01 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
SetToDetailedMode();
|
2011-06-19 19:10:01 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
private void FastMenuItem_Click(object sender, EventArgs e)
|
2011-06-19 19:10:01 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
SetToFastMode();
|
2011-06-19 19:10:01 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
private void _1ByteMenuItem_Click(object sender, EventArgs e)
|
2011-06-19 19:10:01 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
SetSize(Watch.WatchSize.Byte);
|
2011-06-19 19:10:01 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
private void _2ByteMenuItem_Click(object sender, EventArgs e)
|
2011-06-19 19:10:01 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
SetSize(Watch.WatchSize.Word);
|
2011-06-19 19:10:01 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
private void _4ByteMenuItem_Click(object sender, EventArgs e)
|
2011-06-19 19:10:01 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
SetSize(Watch.WatchSize.DWord);
|
2011-06-19 19:10:01 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
private void CheckMisalignedMenuItem_Click(object sender, EventArgs e)
|
2011-06-19 19:10:01 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
Settings.CheckMisAligned ^= true;
|
|
|
|
|
SetReboot(true);
|
2011-06-19 19:10:01 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
private void Previous_LastFrameMenuItem_Click(object sender, EventArgs e)
|
2011-06-19 19:10:01 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
SetPreviousStype(Watch.PreviousType.LastFrame);
|
2011-06-19 19:10:01 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
private void Previous_LastSearchMenuItem_Click(object sender, EventArgs e)
|
2011-06-19 19:10:01 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
SetPreviousStype(Watch.PreviousType.LastSearch);
|
2011-06-19 19:10:01 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
private void Previous_LastChangeMenuItem_Click(object sender, EventArgs e)
|
2011-06-19 19:10:01 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
SetPreviousStype(Watch.PreviousType.LastChange);
|
2011-06-19 19:10:01 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
private void Previous_OriginalMenuItem_Click(object sender, EventArgs e)
|
2011-06-19 19:10:01 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
SetPreviousStype(Watch.PreviousType.Original);
|
2011-06-19 19:10:01 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
private void BigEndianMenuItem_Click(object sender, EventArgs e)
|
2011-06-19 19:10:01 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
Settings.BigEndian ^= true;
|
|
|
|
|
Searches.SetEndian(Settings.BigEndian);
|
2011-06-19 19:10:01 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
#endregion
|
2011-06-19 19:10:01 +00:00
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
#region Search
|
|
|
|
|
|
|
|
|
|
private void SearchSubMenu_DropDownOpened(object sender, EventArgs e)
|
2011-06-19 19:10:01 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
ClearChangeCountsMenuItem.Enabled = Settings.Mode == RamSearchEngine.Settings.SearchMode.Detailed;
|
2011-09-16 23:44:39 +00:00
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
RemoveMenuItem.Enabled =
|
|
|
|
|
AddToRamWatchMenuItem.Enabled =
|
|
|
|
|
PokeAddressMenuItem.Enabled =
|
|
|
|
|
FreezeAddressMenuItem.Enabled =
|
|
|
|
|
SelectedIndices.Any();
|
2011-06-19 19:10:01 +00:00
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
UndoMenuItem.Enabled =
|
|
|
|
|
ClearUndoMenuItem.Enabled =
|
|
|
|
|
Searches.CanUndo;
|
2011-06-19 19:10:01 +00:00
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
RedoMenuItem.Enabled = Searches.CanRedo;
|
2012-06-09 06:40:11 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
private void NewSearchMenuMenuItem_Click(object sender, EventArgs e)
|
2012-06-09 06:40:11 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
NewSearch();
|
2011-06-19 19:10:01 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
private void SearchMenuItem_Click(object sender, EventArgs e)
|
2011-06-19 19:10:01 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
DoSearch();
|
2011-06-19 19:10:01 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
private void UndoMenuItem_Click(object sender, EventArgs e)
|
2011-06-19 19:10:01 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
if (Searches.CanUndo)
|
|
|
|
|
{
|
|
|
|
|
Searches.Undo();
|
|
|
|
|
UpdateUndoToolBarButtons();
|
|
|
|
|
}
|
2011-06-19 19:10:01 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
private void RedoMenuItem_Click(object sender, EventArgs e)
|
2011-06-19 19:10:01 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
if (Searches.CanRedo)
|
2011-06-19 19:10:01 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
Searches.Redo();
|
|
|
|
|
UpdateUndoToolBarButtons();
|
2011-06-19 19:10:01 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
private void CopyValueToPrevMenuItem_Click(object sender, EventArgs e)
|
2011-06-19 19:10:01 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
Searches.SetPrevousToCurrent();
|
|
|
|
|
WatchListView.Refresh();
|
2011-06-19 19:10:01 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
private void ClearChangeCountsMenuItem_Click(object sender, EventArgs e)
|
2011-06-19 19:10:01 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
Searches.ClearChangeCounts();
|
|
|
|
|
WatchListView.Refresh();
|
2011-06-19 19:10:01 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
private void RemoveMenuItem_Click(object sender, EventArgs e)
|
2011-06-19 19:10:01 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
RemoveAddresses();
|
2011-06-19 19:10:01 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
private void AddToRamWatchMenuItem_Click(object sender, EventArgs e)
|
2011-06-19 19:10:01 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
AddToRamWatch();
|
2011-06-19 19:10:01 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
private void PokeAddressMenuItem_Click(object sender, EventArgs e)
|
2011-06-19 19:10:01 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
PokeAddress();
|
2011-06-19 19:10:01 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
private void FreezeAddressMenuItem_Click(object sender, EventArgs e)
|
2011-06-19 19:10:01 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
FreezeAddress();
|
2011-06-19 19:10:01 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
private void ClearUndoMenuItem_Click(object sender, EventArgs e)
|
2011-06-19 19:10:01 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
Searches.ClearHistory();
|
|
|
|
|
UpdateUndoToolBarButtons();
|
2011-06-19 19:10:01 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
#endregion
|
2011-06-19 19:10:01 +00:00
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
#region Options
|
2011-06-19 19:10:01 +00:00
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
private void OptionsSubMenu_DropDownOpened(object sender, EventArgs e)
|
2011-06-19 19:10:01 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
AutoloadDialogMenuItem.Checked = Global.Config.RecentSearches.AutoLoad;
|
|
|
|
|
SaveWinPositionMenuItem.Checked = Global.Config.RamSearchSaveWindowPosition;
|
|
|
|
|
ExcludeRamWatchMenuItem.Checked = Global.Config.RamSearchAlwaysExcludeRamWatch;
|
|
|
|
|
UseUndoHistoryMenuItem.Checked = Searches.UndoEnabled;
|
|
|
|
|
PreviewModeMenuItem.Checked = Global.Config.RamSearchPreviewMode;
|
|
|
|
|
AlwaysOnTopMenuItem.Checked = Global.Config.RamSearchAlwaysOnTop;
|
|
|
|
|
AutoSearchMenuItem.Checked = autoSearch;
|
2011-06-19 19:10:01 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
private void PreviewModeMenuItem_Click(object sender, EventArgs e)
|
2011-06-19 19:10:01 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
Global.Config.RamSearchPreviewMode ^= true;
|
2011-06-19 19:10:01 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
private void AutoSearchMenuItem_Click(object sender, EventArgs e)
|
2011-06-19 19:10:01 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
ToggleAutoSearch();
|
2011-06-19 19:10:01 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
private void ExcludeRamWatchMenuItem_Click(object sender, EventArgs e)
|
2012-09-02 03:05:48 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
Global.Config.RamSearchAlwaysExcludeRamWatch ^= true;
|
|
|
|
|
if (Global.Config.RamSearchAlwaysExcludeRamWatch)
|
2012-09-02 03:05:48 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
RemoveRamWatchesFromList();
|
2012-09-02 03:05:48 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
private void UseUndoHistoryMenuItem_Click(object sender, EventArgs e)
|
2012-09-02 03:05:48 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
Searches.UndoEnabled ^= true;
|
2012-09-02 03:05:48 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
private void AutoloadDialogMenuItem_Click(object sender, EventArgs e)
|
2011-06-19 19:10:01 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
Global.Config.RecentSearches.AutoLoad ^= true;
|
2011-06-19 19:10:01 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
private void SaveWinPositionMenuItem_Click(object sender, EventArgs e)
|
2011-06-19 19:10:01 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
Global.Config.RamSearchSaveWindowPosition ^= true;
|
2011-06-19 19:10:01 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
private void AlwaysOnTopMenuItem_Click(object sender, EventArgs e)
|
2011-06-19 19:10:01 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
Global.Config.RamSearchAlwaysOnTop ^= true;
|
|
|
|
|
TopMost = Global.Config.RamSearchAlwaysOnTop;
|
2011-06-19 19:10:01 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
private void RestoreDefaultsMenuItem_Click(object sender, EventArgs e)
|
2011-06-19 19:10:01 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
Size = new Size(defaultWidth, defaultHeight);
|
2011-06-19 19:10:01 +00:00
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
Global.Config.RamSearchColumnIndexes = new Dictionary<string, int>
|
|
|
|
|
{
|
|
|
|
|
{ "AddressColumn", 0 },
|
|
|
|
|
{ "ValueColumn", 1 },
|
|
|
|
|
{ "PrevColumn", 2 },
|
|
|
|
|
{ "ChangesColumn", 3 },
|
|
|
|
|
{ "DiffColumn", 4 },
|
|
|
|
|
{ "DomainColumn", 5 },
|
|
|
|
|
{ "NotesColumn", 6 },
|
|
|
|
|
};
|
2011-06-19 19:10:01 +00:00
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
ColumnPositions();
|
2011-06-19 19:10:01 +00:00
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
Global.Config.RamSearchShowChangeColumn = true;
|
|
|
|
|
Global.Config.RamSearchShowPrevColumn = true;
|
|
|
|
|
Global.Config.RamSearchShowDiffColumn = false;
|
2012-06-09 01:56:56 +00:00
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
WatchListView.Columns[ADDRESS].Width = DefaultColumnWidths[ADDRESS];
|
|
|
|
|
WatchListView.Columns[VALUE].Width = DefaultColumnWidths[VALUE];
|
|
|
|
|
//WatchListView.Columns[PREV].Width = DefaultColumnWidths[PREV];
|
|
|
|
|
WatchListView.Columns[CHANGES].Width = DefaultColumnWidths[CHANGES];
|
|
|
|
|
//WatchListView.Columns[DIFF].Width = DefaultColumnWidths[DIFF];
|
2011-06-19 19:10:01 +00:00
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
Global.Config.RamSearchSaveWindowPosition = true;
|
|
|
|
|
Global.Config.RamSearchAlwaysOnTop = TopMost = false;
|
|
|
|
|
|
|
|
|
|
LoadColumnInfo();
|
2011-06-19 19:10:01 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region Columns
|
|
|
|
|
|
|
|
|
|
private void ColumnsMenuItem_DropDownOpened(object sender, EventArgs e)
|
2011-06-19 19:10:01 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
ShowPreviousMenuItem.Checked = Global.Config.RamSearchShowPrevColumn;
|
|
|
|
|
ShowChangesMenuItem.Checked = Global.Config.RamSearchShowChangeColumn;
|
|
|
|
|
ShowDiffMenuItem.Checked = Global.Config.RamSearchShowDiffColumn;
|
2011-06-19 19:10:01 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
private void ShowPreviousMenuItem_Click(object sender, EventArgs e)
|
2011-06-19 19:10:01 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
Global.Config.RamSearchShowPrevColumn ^= true;
|
|
|
|
|
SaveColumnInfo();
|
|
|
|
|
LoadColumnInfo();
|
2011-06-19 19:10:01 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
private void ShowChangesMenuItem_Click(object sender, EventArgs e)
|
2011-06-19 19:10:01 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
Global.Config.RamSearchShowChangeColumn ^= true;
|
|
|
|
|
SaveColumnInfo();
|
|
|
|
|
LoadColumnInfo();
|
2011-06-19 19:10:01 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
private void ShowDiffMenuItem_Click(object sender, EventArgs e)
|
2011-06-19 19:10:01 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
Global.Config.RamSearchShowDiffColumn ^= true;
|
|
|
|
|
SaveColumnInfo();
|
|
|
|
|
LoadColumnInfo();
|
2011-06-19 19:10:01 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
#endregion
|
2012-09-23 14:51:54 +00:00
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
#region ContextMenu and Toolbar
|
2011-08-07 04:19:49 +00:00
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
private void contextMenuStrip1_Opening(object sender, CancelEventArgs e)
|
2011-06-19 19:10:01 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
DoSearchContextMenuItem.Enabled = Searches.Count > 0;
|
|
|
|
|
|
|
|
|
|
RemoveContextMenuItem.Visible =
|
|
|
|
|
AddToRamWatchContextMenuItem.Visible =
|
|
|
|
|
PokeContextMenuItem.Visible =
|
|
|
|
|
FreezeContextMenuItem.Visible =
|
|
|
|
|
ContextMenuSeparator2.Visible =
|
|
|
|
|
|
|
|
|
|
ViewInHexEditorContextMenuItem.Visible =
|
|
|
|
|
SelectedIndices.Count > 0;
|
|
|
|
|
|
|
|
|
|
UnfreezeAllContextMenuItem.Visible = Global.CheatList.Any();
|
|
|
|
|
|
|
|
|
|
ContextMenuSeparator3.Visible = (SelectedIndices.Count > 0) || (Global.CheatList.Any());
|
|
|
|
|
|
|
|
|
|
bool allCheats = true;
|
|
|
|
|
foreach (int index in SelectedIndices)
|
2011-06-19 19:10:01 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
if (!Global.CheatList.IsActiveCheat(Settings.Domain, Searches[index].Address.Value))
|
2011-06-19 19:10:01 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
allCheats = false;
|
2011-06-19 19:10:01 +00:00
|
|
|
|
}
|
2013-09-28 01:24:45 +00:00
|
|
|
|
}
|
2012-09-23 14:51:54 +00:00
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
if (allCheats)
|
|
|
|
|
{
|
|
|
|
|
FreezeContextMenuItem.Text = "&Unfreeze address";
|
|
|
|
|
FreezeContextMenuItem.Image = Properties.Resources.Unfreeze;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
FreezeContextMenuItem.Text = "&Freeze address";
|
|
|
|
|
FreezeContextMenuItem.Image = Properties.Resources.Freeze;
|
2011-06-19 19:10:01 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
private void UnfreezeAllContextMenuItem_Click(object sender, EventArgs e)
|
2011-06-19 19:10:01 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
ToolHelpers.UnfreezeAll();
|
2011-06-19 19:10:01 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
private void ViewInHexEditorContextMenuItem_Click(object sender, EventArgs e)
|
2011-06-19 19:10:01 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
if (SelectedIndices.Count > 0)
|
2011-06-19 19:10:01 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
Global.MainForm.LoadHexEditor();
|
|
|
|
|
Global.MainForm.HexEditor1.SetDomain(Settings.Domain);
|
|
|
|
|
Global.MainForm.HexEditor1.GoToAddress(Searches[SelectedIndices[0]].Address.Value);
|
2013-08-21 20:54:33 +00:00
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
//TODO: secondary highlighted on remaining indexes
|
2012-09-23 15:09:29 +00:00
|
|
|
|
}
|
2011-06-19 19:10:01 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
private void ClearPreviewContextMenuItem_Click(object sender, EventArgs e)
|
2011-06-19 19:10:01 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
forcePreviewClear = true;
|
|
|
|
|
WatchListView.Refresh();
|
2011-06-19 19:10:01 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
#endregion
|
2011-06-19 19:10:01 +00:00
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
#region Compare To Box
|
|
|
|
|
|
|
|
|
|
private void PreviousValueRadio_Click(object sender, EventArgs e)
|
2011-06-19 19:10:01 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
SpecificValueBox.Enabled = false;
|
|
|
|
|
SpecificAddressBox.Enabled = false;
|
|
|
|
|
NumberOfChangesBox.Enabled = false;
|
|
|
|
|
DifferenceBox.Enabled = false;
|
|
|
|
|
SetCompareTo(RamSearchEngine.Compare.Previous);
|
2011-06-19 19:10:01 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
private void SpecificValueRadio_Click(object sender, EventArgs e)
|
2011-06-19 19:10:01 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
SpecificValueBox.Enabled = true;
|
|
|
|
|
if (String.IsNullOrWhiteSpace(SpecificValueBox.Text))
|
2012-09-23 14:51:54 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
SpecificValueBox.Text = "0";
|
|
|
|
|
Searches.CompareValue = 0;
|
2012-09-23 14:51:54 +00:00
|
|
|
|
}
|
2013-09-28 01:24:45 +00:00
|
|
|
|
SpecificValueBox.Focus();
|
|
|
|
|
SpecificAddressBox.Enabled = false;
|
|
|
|
|
NumberOfChangesBox.Enabled = false;
|
|
|
|
|
DifferenceBox.Enabled = false;
|
|
|
|
|
SetCompareTo(RamSearchEngine.Compare.SpecificValue);
|
2011-06-19 19:10:01 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
private void SpecificAddressRadio_Click(object sender, EventArgs e)
|
2011-06-19 19:10:01 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
SpecificValueBox.Enabled = false;
|
|
|
|
|
SpecificAddressBox.Enabled = true;
|
|
|
|
|
if (String.IsNullOrWhiteSpace(SpecificAddressBox.Text))
|
2011-06-19 19:10:01 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
SpecificAddressBox.Text = "0";
|
|
|
|
|
Searches.CompareValue = 0;
|
2011-06-19 19:10:01 +00:00
|
|
|
|
}
|
2013-09-28 01:24:45 +00:00
|
|
|
|
SpecificAddressBox.Focus();
|
|
|
|
|
NumberOfChangesBox.Enabled = false;
|
|
|
|
|
DifferenceBox.Enabled = false;
|
|
|
|
|
SetCompareTo(RamSearchEngine.Compare.SpecificAddress);
|
2011-06-19 19:10:01 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
private void NumberOfChangesRadio_Click(object sender, EventArgs e)
|
2011-06-19 19:10:01 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
SpecificValueBox.Enabled = false;
|
|
|
|
|
SpecificAddressBox.Enabled = false;
|
|
|
|
|
NumberOfChangesBox.Enabled = true;
|
|
|
|
|
if (String.IsNullOrWhiteSpace(NumberOfChangesBox.Text))
|
|
|
|
|
{
|
|
|
|
|
NumberOfChangesBox.Text = "0";
|
|
|
|
|
Searches.CompareValue = 0;
|
|
|
|
|
}
|
|
|
|
|
NumberOfChangesBox.Focus();
|
|
|
|
|
DifferenceBox.Enabled = false;
|
|
|
|
|
SetCompareTo(RamSearchEngine.Compare.Changes);
|
2011-06-19 19:10:01 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
private void DifferenceRadio_Click(object sender, EventArgs e)
|
2011-06-19 19:10:01 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
SpecificValueBox.Enabled = false;
|
|
|
|
|
SpecificAddressBox.Enabled = false;
|
|
|
|
|
NumberOfChangesBox.Enabled = false;
|
|
|
|
|
DifferenceBox.Enabled = true;
|
|
|
|
|
if (String.IsNullOrWhiteSpace(DifferenceBox.Text))
|
2011-06-19 19:10:01 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
DifferenceBox.Text = "0";
|
|
|
|
|
Searches.CompareValue = 0;
|
2011-06-19 19:10:01 +00:00
|
|
|
|
}
|
2013-09-28 01:24:45 +00:00
|
|
|
|
DifferenceBox.Focus();
|
|
|
|
|
SetCompareTo(RamSearchEngine.Compare.Difference);
|
|
|
|
|
}
|
2011-06-19 19:10:01 +00:00
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
private void CompareToValue_TextChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
SetCompareValue((sender as INumberBox).ToInt());
|
|
|
|
|
}
|
2011-06-19 19:10:01 +00:00
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
#endregion
|
2011-06-19 19:10:01 +00:00
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
#region Comparison Operator Box
|
2011-06-19 19:10:01 +00:00
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
private void EqualToRadio_Click(object sender, EventArgs e)
|
2011-06-19 19:10:01 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
DifferentByBox.Enabled = false;
|
|
|
|
|
SetComparisonOperator(RamSearchEngine.ComparisonOperator.Equal);
|
2011-06-19 19:10:01 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
private void NotEqualToRadio_Click(object sender, EventArgs e)
|
2011-06-19 19:10:01 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
DifferentByBox.Enabled = false;
|
|
|
|
|
SetComparisonOperator(RamSearchEngine.ComparisonOperator.NotEqual);
|
2011-06-19 19:10:01 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
private void LessThanRadio_Click(object sender, EventArgs e)
|
2011-06-19 19:10:01 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
DifferentByBox.Enabled = false;
|
|
|
|
|
SetComparisonOperator(RamSearchEngine.ComparisonOperator.LessThan);
|
2011-06-19 19:10:01 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
private void GreaterThanRadio_Click(object sender, EventArgs e)
|
2011-06-19 19:10:01 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
DifferentByBox.Enabled = false;
|
|
|
|
|
SetComparisonOperator(RamSearchEngine.ComparisonOperator.GreaterThan);
|
2011-06-19 19:10:01 +00:00
|
|
|
|
}
|
2011-06-26 19:50:15 +00:00
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
private void LessThanOrEqualToRadio_Click(object sender, EventArgs e)
|
2011-08-15 19:33:18 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
DifferentByBox.Enabled = false;
|
|
|
|
|
SetComparisonOperator(RamSearchEngine.ComparisonOperator.LessThanEqual);
|
2011-08-15 19:33:18 +00:00
|
|
|
|
}
|
2011-08-20 13:02:25 +00:00
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
private void GreaterThanOrEqualToRadio_Click(object sender, EventArgs e)
|
2011-08-20 13:02:25 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
DifferentByBox.Enabled = false;
|
|
|
|
|
SetComparisonOperator(RamSearchEngine.ComparisonOperator.GreaterThanEqual);
|
2011-08-20 13:02:25 +00:00
|
|
|
|
}
|
2011-08-20 13:39:44 +00:00
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
private void DifferentByRadio_Click(object sender, EventArgs e)
|
2011-08-20 13:39:44 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
DifferentByBox.Enabled = true;
|
|
|
|
|
SetComparisonOperator(RamSearchEngine.ComparisonOperator.DifferentBy);
|
|
|
|
|
if (String.IsNullOrWhiteSpace(DifferentByBox.Text))
|
|
|
|
|
{
|
|
|
|
|
DifferentByBox.Text = "0";
|
|
|
|
|
}
|
|
|
|
|
DifferentByBox.Focus();
|
2011-08-20 13:39:44 +00:00
|
|
|
|
}
|
2011-08-20 15:35:16 +00:00
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
private void DifferentByBox_TextChanged(object sender, EventArgs e)
|
2011-08-20 15:35:16 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
if (!String.IsNullOrWhiteSpace(DifferentByBox.Text))
|
|
|
|
|
{
|
|
|
|
|
Searches.DifferentBy = DifferentByBox.ToInt();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Searches.DifferentBy = null;
|
|
|
|
|
}
|
2011-08-20 15:35:16 +00:00
|
|
|
|
}
|
2011-09-16 23:29:36 +00:00
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region ListView Events
|
|
|
|
|
|
|
|
|
|
private void WatchListView_KeyDown(object sender, KeyEventArgs e)
|
2011-09-16 23:29:36 +00:00
|
|
|
|
{
|
|
|
|
|
if (e.KeyCode == Keys.Delete && !e.Control && !e.Alt && !e.Shift)
|
|
|
|
|
{
|
|
|
|
|
RemoveAddresses();
|
|
|
|
|
}
|
|
|
|
|
else if (e.KeyCode == Keys.A && e.Control && !e.Alt && !e.Shift) //Select All
|
|
|
|
|
{
|
2012-09-03 23:42:00 +00:00
|
|
|
|
for (int x = 0; x < Searches.Count; x++)
|
2011-09-16 23:29:36 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
WatchListView.SelectItem(x, true);
|
2011-09-16 23:29:36 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2013-03-17 15:45:01 +00:00
|
|
|
|
else if (e.KeyCode == Keys.C && e.Control && !e.Alt && !e.Shift) //Copy
|
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
if (SelectedIndices.Count > 0)
|
2013-03-17 15:45:01 +00:00
|
|
|
|
{
|
|
|
|
|
StringBuilder sb = new StringBuilder();
|
2013-09-28 01:24:45 +00:00
|
|
|
|
foreach (int index in SelectedIndices)
|
2013-03-17 15:45:01 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
foreach (ColumnHeader column in WatchListView.Columns)
|
2013-03-17 15:45:01 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
sb.Append(GetColumnValue(column.Name, index)).Append('\t');
|
2013-03-17 15:45:01 +00:00
|
|
|
|
}
|
|
|
|
|
sb.Remove(sb.Length - 1, 1);
|
2013-09-28 01:24:45 +00:00
|
|
|
|
sb.AppendLine();
|
2013-03-17 15:45:01 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
if (sb.Length > 0)
|
2013-03-17 15:45:01 +00:00
|
|
|
|
{
|
|
|
|
|
Clipboard.SetDataObject(sb.ToString());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2013-09-28 01:24:45 +00:00
|
|
|
|
else if (e.KeyCode == Keys.Escape && !e.Control && !e.Alt && !e.Shift)
|
|
|
|
|
{
|
|
|
|
|
WatchListView.SelectedIndices.Clear();
|
|
|
|
|
}
|
2013-03-17 15:45:01 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
private void WatchListView_SelectedIndexChanged(object sender, EventArgs e)
|
2013-03-17 15:45:01 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
RemoveToolBarItem.Enabled =
|
|
|
|
|
AddToRamWatchToolBarItem.Enabled =
|
|
|
|
|
PokeAddressToolBarItem.Enabled =
|
|
|
|
|
FreezeAddressToolBarItem.Enabled =
|
|
|
|
|
SelectedIndices.Any();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void WatchListView_ColumnReordered(object sender, ColumnReorderedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
Global.Config.RamSearchColumnIndexes[ADDRESS] = WatchListView.Columns[ADDRESS].DisplayIndex;
|
|
|
|
|
Global.Config.RamSearchColumnIndexes[VALUE] = WatchListView.Columns[VALUE].DisplayIndex;
|
|
|
|
|
Global.Config.RamSearchColumnIndexes[PREV] = WatchListView.Columns[ADDRESS].DisplayIndex;
|
|
|
|
|
Global.Config.RamSearchColumnIndexes[CHANGES] = WatchListView.Columns[CHANGES].DisplayIndex;
|
|
|
|
|
Global.Config.RamSearchColumnIndexes[DIFF] = WatchListView.Columns[DIFF].DisplayIndex;
|
2011-09-16 23:29:36 +00:00
|
|
|
|
}
|
2011-09-16 23:44:39 +00:00
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
private void WatchListView_Enter(object sender, EventArgs e)
|
2011-09-16 23:44:39 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
WatchListView.Refresh();
|
2011-09-16 23:44:39 +00:00
|
|
|
|
}
|
2012-06-02 14:38:35 +00:00
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
private void WatchListView_ColumnClick(object sender, ColumnClickEventArgs e)
|
2012-06-02 14:38:35 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
var column = WatchListView.Columns[e.Column];
|
|
|
|
|
if (column.Name != _sortedColumn)
|
2012-06-02 14:38:35 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
_sortReverse = false;
|
2012-06-02 14:38:35 +00:00
|
|
|
|
}
|
2013-09-28 01:24:45 +00:00
|
|
|
|
|
|
|
|
|
Searches.Sort(column.Name, _sortReverse);
|
|
|
|
|
|
|
|
|
|
_sortedColumn = column.Name;
|
|
|
|
|
_sortReverse ^= true;
|
|
|
|
|
WatchListView.Refresh();
|
2012-06-02 14:38:35 +00:00
|
|
|
|
}
|
2012-09-02 18:33:59 +00:00
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
private void WatchListView_MouseDoubleClick(object sender, MouseEventArgs e)
|
2012-09-02 18:33:59 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
if (SelectedIndices.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
AddToRamWatch();
|
|
|
|
|
}
|
2012-09-02 18:33:59 +00:00
|
|
|
|
}
|
2012-09-23 15:09:29 +00:00
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
#endregion
|
2012-09-23 15:37:25 +00:00
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
#region Dialog Events
|
2013-06-25 08:50:42 +00:00
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
private void NewRamSearch_Activated(object sender, EventArgs e)
|
2013-06-30 20:10:52 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
WatchListView.Refresh();
|
2013-06-30 20:10:52 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
private void NewRamSearch_DragEnter(object sender, DragEventArgs e)
|
2013-06-30 20:10:52 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
e.Effect = e.Data.GetDataPresent(DataFormats.FileDrop) ? DragDropEffects.Copy : DragDropEffects.None;
|
2013-06-30 20:10:52 +00:00
|
|
|
|
}
|
2013-06-30 21:50:17 +00:00
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
private void NewRamSearch_DragDrop(object sender, DragEventArgs e)
|
2013-06-30 21:50:17 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
string[] filePaths = (string[])e.Data.GetData(DataFormats.FileDrop);
|
|
|
|
|
if (Path.GetExtension(filePaths[0]) == (".wch"))
|
2013-06-30 21:50:17 +00:00
|
|
|
|
{
|
2013-09-28 01:24:45 +00:00
|
|
|
|
var file = new FileInfo(filePaths[0]);
|
|
|
|
|
if (file.Exists)
|
|
|
|
|
{
|
|
|
|
|
LoadWatchFile(file, false);
|
|
|
|
|
}
|
2013-06-30 21:50:17 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2013-08-14 01:04:14 +00:00
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
#endregion
|
2013-08-21 20:54:33 +00:00
|
|
|
|
|
2013-09-28 01:24:45 +00:00
|
|
|
|
#endregion
|
2011-06-19 19:10:01 +00:00
|
|
|
|
}
|
2011-01-23 18:56:39 +00:00
|
|
|
|
}
|