|
|
@ -2,6 +2,7 @@ |
|
|
|
// This code is distributed under the BSD license (for details please see \src\AddIns\Debugger\Debugger.AddIn\license.txt)
|
|
|
|
// This code is distributed under the BSD license (for details please see \src\AddIns\Debugger\Debugger.AddIn\license.txt)
|
|
|
|
|
|
|
|
|
|
|
|
using System; |
|
|
|
using System; |
|
|
|
|
|
|
|
using System.Collections.Generic; |
|
|
|
using System.Collections.ObjectModel; |
|
|
|
using System.Collections.ObjectModel; |
|
|
|
using System.Dynamic; |
|
|
|
using System.Dynamic; |
|
|
|
using System.Windows; |
|
|
|
using System.Windows; |
|
|
@ -17,77 +18,58 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads |
|
|
|
{ |
|
|
|
{ |
|
|
|
public class LoadedModulesPad : AbstractPadContent |
|
|
|
public class LoadedModulesPad : AbstractPadContent |
|
|
|
{ |
|
|
|
{ |
|
|
|
DockPanel panel; |
|
|
|
ListView listView; |
|
|
|
ListView loadedModulesList; |
|
|
|
|
|
|
|
ObservableCollection<ModuleModel> loadedModules; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public override object Control { |
|
|
|
public override object Control { |
|
|
|
get { return panel; } |
|
|
|
get { return listView; } |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public LoadedModulesPad() |
|
|
|
public LoadedModulesPad() |
|
|
|
{ |
|
|
|
{ |
|
|
|
this.panel = new DockPanel(); |
|
|
|
var res = new CommonResources(); |
|
|
|
loadedModulesList = new ListView(); |
|
|
|
res.InitializeComponent(); |
|
|
|
loadedModules = new ObservableCollection<ModuleModel>(); |
|
|
|
|
|
|
|
loadedModulesList.ItemsSource = loadedModules; |
|
|
|
listView = new ListView(); |
|
|
|
loadedModulesList.View = new GridView(); |
|
|
|
listView.View = (GridView)res["loadedModulesGridView"]; |
|
|
|
panel.Children.Add(loadedModulesList); |
|
|
|
|
|
|
|
RedrawContent(); |
|
|
|
|
|
|
|
ResourceService.LanguageChanged += delegate { RedrawContent(); }; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
WindowsDebugger.RefreshingPads += RefreshPad; |
|
|
|
WindowsDebugger.RefreshingPads += RefreshPad; |
|
|
|
RefreshPad(); |
|
|
|
RefreshPad(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void RedrawContent() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
loadedModulesList.ClearColumns(); |
|
|
|
|
|
|
|
loadedModulesList.AddColumn(StringParser.Parse("${res:Global.Name}"), |
|
|
|
|
|
|
|
new Binding { Path = new PropertyPath("Name") }, 250); |
|
|
|
|
|
|
|
loadedModulesList.AddColumn(StringParser.Parse("${res:MainWindow.Windows.Debug.Modules.AddressColumn}"), |
|
|
|
|
|
|
|
new Binding { Path = new PropertyPath("Address") }, 100); |
|
|
|
|
|
|
|
loadedModulesList.AddColumn(StringParser.Parse("${res:Global.Path}"), |
|
|
|
|
|
|
|
new Binding { Path = new PropertyPath("Path") }, 250); |
|
|
|
|
|
|
|
loadedModulesList.AddColumn(StringParser.Parse("${res:MainWindow.Windows.Debug.Modules.OrderColumn}"), |
|
|
|
|
|
|
|
new Binding { Path = new PropertyPath("Order") }, 80); |
|
|
|
|
|
|
|
loadedModulesList.AddColumn(StringParser.Parse("${res:MainWindow.Windows.Debug.Modules.SymbolsColumn}"), |
|
|
|
|
|
|
|
new Binding { Path = new PropertyPath("Symbols") }, 130); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void RefreshPad() |
|
|
|
void RefreshPad() |
|
|
|
{ |
|
|
|
{ |
|
|
|
Process process = WindowsDebugger.CurrentProcess; |
|
|
|
Process process = WindowsDebugger.CurrentProcess; |
|
|
|
loadedModules.Clear(); |
|
|
|
List<ModuleItem> loadedModules = new List<ModuleItem>(); |
|
|
|
if (process != null) { |
|
|
|
if (process != null) { |
|
|
|
foreach(Module module in process.Modules) { |
|
|
|
foreach(Module module in process.Modules) { |
|
|
|
loadedModules.Add(new ModuleModel(module)); |
|
|
|
loadedModules.Add(new ModuleItem(module)); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
listView.ItemsSource = loadedModules; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static class ListViewExtensions |
|
|
|
public class ModuleItem |
|
|
|
{ |
|
|
|
{ |
|
|
|
public static void ClearColumns(this ListView view) |
|
|
|
public string Name { get; private set; } |
|
|
|
{ |
|
|
|
public string Address { get; private set; } |
|
|
|
if (view == null) |
|
|
|
public string Path { get; private set; } |
|
|
|
throw new ArgumentNullException("view"); |
|
|
|
public string Order { get; private set; } |
|
|
|
if (view.View is GridView) |
|
|
|
public string Symbols { get; private set; } |
|
|
|
((GridView)view.View).Columns.Clear(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static void AddColumn(this ListView view, string header, Binding binding, double width) |
|
|
|
public ModuleItem(Module module) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (view == null) |
|
|
|
this.Name = module.Name; |
|
|
|
throw new ArgumentNullException("view"); |
|
|
|
this.Address = string.Format("{0:X8}", module.BaseAdress); |
|
|
|
if (view.View is GridView) { |
|
|
|
if (module.IsDynamic) { |
|
|
|
GridViewColumn column = new GridViewColumn { |
|
|
|
this.Path = StringParser.Parse("${res:MainWindow.Windows.Debug.Modules.DynamicModule}"); |
|
|
|
Width = width, |
|
|
|
} else if (module.IsInMemory) { |
|
|
|
DisplayMemberBinding = binding, |
|
|
|
this.Path = StringParser.Parse("${res:MainWindow.Windows.Debug.Modules.InMemoryModule}"); |
|
|
|
Header = header }; |
|
|
|
} else { |
|
|
|
((GridView)view.View).Columns.Add(column); |
|
|
|
this.Path = module.FullPath; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
this.Order = module.OrderOfLoading.ToString(); |
|
|
|
|
|
|
|
this.Symbols = module.HasSymbols ? StringParser.Parse("${res:MainWindow.Windows.Debug.Modules.HasSymbols}") : StringParser.Parse("${res:MainWindow.Windows.Debug.Modules.HasNoSymbols}"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |