Exemplo n.º 1
0
        public override string GetHeader(ModulesCtxMenuContext context)
        {
            var files = GetSavableFiles(context.SelectedItems);

            return(files.Length > 1 ? string.Format(dnSpy_Debugger_Resources.SaveModulesCommand, files.Length) :
                   dnSpy_Debugger_Resources.SaveModuleCommand);
        }
Exemplo n.º 2
0
 protected override void Execute(ModulesCtxMenuContext context)
 {
     if (context.SelectedItems.Length > 0)
     {
         Clipboard.SetText(context.SelectedItems[0].Module.Name);
     }
 }
Exemplo n.º 3
0
 protected override void Execute(ModulesCtxMenuContext context)
 {
     if (context.SelectedItems.Length > 0)
     {
         OpenContainingFolder(context.SelectedItems[0].Module.Name);
     }
 }
Exemplo n.º 4
0
 internal static void ExecuteInternal(ModulesCtxMenuContext context, bool newTab)
 {
     if (context == null || context.SelectedItems.Length == 0)
     {
         return;
     }
     ExecuteInternal(context.SelectedItems[0], newTab);
 }
Exemplo n.º 5
0
 public override string GetHeader(ModulesCtxMenuContext context)
 {
     if (context.SelectedItems.Length <= 1)
     {
         return(dnSpy_Debugger_Resources.LoadModulesCommand);
     }
     return(string.Format(dnSpy_Debugger_Resources.LoadXModulesCommand, context.SelectedItems.Length));
 }
Exemplo n.º 6
0
        public override void Execute(ModulesCtxMenuContext context)
        {
            var vm = GetModule(context);

            if (vm != null)
            {
                memoryWindowManager.Value.Show(vm.Module.Address, vm.Module.Size, windowIndex);
            }
        }
Exemplo n.º 7
0
        protected override void Execute(ModulesCtxMenuContext context)
        {
            var vm = GetModule(context);

            if (vm != null)
            {
                MemoryUtils.ShowInMemoryWindow(windowNumber, vm.Module.Address, vm.Module.Size);
            }
        }
Exemplo n.º 8
0
        public override void Execute(ModulesCtxMenuContext context)
        {
            var vm = ShowInMemoryWindowModulesCtxMenuCommand.GetModule(context);

            if (vm != null)
            {
                memoryWindowService.Value.Show(vm.Module.Address, vm.Module.Size);
            }
        }
Exemplo n.º 9
0
 public override void Execute(ModulesCtxMenuContext context)
 {
     if (context.SelectedItems.Length > 0)
     {
         try {
             Clipboard.SetText(context.SelectedItems[0].Module.Name);
         }
         catch (ExternalException) { }
     }
 }
Exemplo n.º 10
0
        static bool CanGoToModule(ModulesCtxMenuContext context)
        {
            if (context == null || context.SelectedItems.Length == 0)
            {
                return(false);
            }
            var vm = context.SelectedItems[0];

            return(!vm.Module.IsDynamic && !vm.Module.IsInMemory);
        }
Exemplo n.º 11
0
        internal static bool CanGoToModule(ModulesCtxMenuContext context)
        {
            if (context == null || context.SelectedItems.Length == 0)
            {
                return(false);
            }
            var vm = context.SelectedItems[0];

            //TODO: Support dynamic and in-memory modules
            return(!vm.Module.IsDynamic && !vm.Module.IsInMemory);
        }
Exemplo n.º 12
0
        internal static ModuleVM GetModule(ModulesCtxMenuContext context)
        {
            if (context.SelectedItems.Length != 1)
            {
                return(null);
            }
            var vm = context.SelectedItems[0];

            if (vm.Module.Address == 0 || vm.Module.Size == 0)
            {
                return(null);
            }
            return(vm);
        }
Exemplo n.º 13
0
        public override void Execute(ModulesCtxMenuContext context)
        {
            var vm = GetModule(context);

            if (vm != null)
            {
                var start = new HexPosition(vm.Module.Address);
                var end   = start + vm.Module.Size;
                Debug.Assert(end <= HexPosition.MaxEndPosition);
                if (end <= HexPosition.MaxEndPosition)
                {
                    memoryWindowService.Value.Show(HexSpan.FromBounds(start, end), windowIndex);
                }
            }
        }
Exemplo n.º 14
0
 protected override void Initialize(ModulesCtxMenuContext context, MenuItem menuItem)
 {
     foreach (var tuple in subCmds)
     {
         var mi = new MenuItem {
             Command = tuple.Item1,
             Header  = tuple.Item2,
         };
         if (!string.IsNullOrEmpty(tuple.Item3))
         {
             mi.InputGestureText = tuple.Item3;
         }
         MainWindow.CreateMenuItemImage(mi, this, "MemoryWindow", BackgroundType.ContextMenuItem);
         menuItem.Items.Add(mi);
     }
 }
Exemplo n.º 15
0
        public override void Execute(ModulesCtxMenuContext context)
        {
            bool canShowDlgBox = true;

            foreach (var vm in context.SelectedItems)
            {
                var  mod = vm.Module;
                bool res = GoToModuleModulesCtxMenuCommand.ShowErrorIfDynamic(inMemoryModuleManager, mod, canShowDlgBox);
                if (!res)
                {
                    canShowDlgBox = false;
                }
                if (res)
                {
                    moduleLoader.Value.LoadModule(vm.Module, canLoadDynFile: true, isAutoLoaded: false);
                }
            }
        }
Exemplo n.º 16
0
        public override void Execute(ModulesCtxMenuContext context)
        {
            var output = new StringBuilderTextColorOutput();

            foreach (var vm in context.SelectedItems)
            {
                var printer = new ModulePrinter(output, debuggerSettings.UseHexadecimal, theDebugger.Value.Debugger);
                printer.WriteName(vm);
                output.Write(BoxedTextColor.Text, "\t");
                printer.WriteOptimized(vm);
                output.Write(BoxedTextColor.Text, "\t");
                printer.WriteDynamic(vm);
                output.Write(BoxedTextColor.Text, "\t");
                printer.WriteInMemory(vm);
                output.Write(BoxedTextColor.Text, "\t");
                printer.WriteOrder(vm);
                output.Write(BoxedTextColor.Text, "\t");
                printer.WriteVersion(vm);
                output.Write(BoxedTextColor.Text, "\t");
                printer.WriteTimestamp(vm);
                output.Write(BoxedTextColor.Text, "\t");
                printer.WriteAddress(vm);
                output.Write(BoxedTextColor.Text, "\t");
                printer.WriteProcess(vm);
                output.Write(BoxedTextColor.Text, "\t");
                printer.WriteAppDomain(vm);
                output.Write(BoxedTextColor.Text, "\t");
                printer.WritePath(vm);
                output.WriteLine();
            }
            var s = output.ToString();

            if (s.Length > 0)
            {
                try {
                    Clipboard.SetText(s);
                }
                catch (ExternalException) { }
            }
        }
Exemplo n.º 17
0
        public override void Execute(ModulesCtxMenuContext context)
        {
            var output = new NoSyntaxHighlightOutput();

            foreach (var vm in context.SelectedItems)
            {
                var printer = new ModulePrinter(output, debuggerSettings.UseHexadecimal, theDebugger.Value.Debugger);
                printer.WriteName(vm);
                output.Write("\t", TextTokenKind.Text);
                printer.WriteOptimized(vm);
                output.Write("\t", TextTokenKind.Text);
                printer.WriteDynamic(vm);
                output.Write("\t", TextTokenKind.Text);
                printer.WriteInMemory(vm);
                output.Write("\t", TextTokenKind.Text);
                printer.WriteOrder(vm);
                output.Write("\t", TextTokenKind.Text);
                printer.WriteVersion(vm);
                output.Write("\t", TextTokenKind.Text);
                printer.WriteTimestamp(vm);
                output.Write("\t", TextTokenKind.Text);
                printer.WriteAddress(vm);
                output.Write("\t", TextTokenKind.Text);
                printer.WriteProcess(vm);
                output.Write("\t", TextTokenKind.Text);
                printer.WriteAppDomain(vm);
                output.Write("\t", TextTokenKind.Text);
                printer.WritePath(vm);
                output.WriteLine();
            }
            var s = output.ToString();

            if (s.Length > 0)
            {
                Clipboard.SetText(s);
            }
        }
Exemplo n.º 18
0
        protected override void Execute(ModulesCtxMenuContext context)
        {
            var output = new PlainTextOutput();

            foreach (var vm in context.SelectedItems)
            {
                var printer = new ModulePrinter(output, DebuggerSettings.Instance.UseHexadecimal);
                printer.WriteName(vm);
                output.Write('\t', TextTokenType.Text);
                printer.WriteOptimized(vm);
                output.Write('\t', TextTokenType.Text);
                printer.WriteDynamic(vm);
                output.Write('\t', TextTokenType.Text);
                printer.WriteInMemory(vm);
                output.Write('\t', TextTokenType.Text);
                printer.WriteOrder(vm);
                output.Write('\t', TextTokenType.Text);
                printer.WriteVersion(vm);
                output.Write('\t', TextTokenType.Text);
                printer.WriteTimestamp(vm);
                output.Write('\t', TextTokenType.Text);
                printer.WriteAddress(vm);
                output.Write('\t', TextTokenType.Text);
                printer.WriteProcess(vm);
                output.Write('\t', TextTokenType.Text);
                printer.WriteAppDomain(vm);
                output.Write('\t', TextTokenType.Text);
                printer.WritePath(vm);
                output.WriteLine();
            }
            var s = output.ToString();

            if (s.Length > 0)
            {
                Clipboard.SetText(s);
            }
        }
Exemplo n.º 19
0
 protected override void Execute(ModulesCtxMenuContext context)
 {
     ExecuteInternal(context, false);
 }
Exemplo n.º 20
0
 protected override bool IsEnabled(ModulesCtxMenuContext context)
 {
     return(GetSavableFiles(context.SelectedItems).Length > 0);
 }
Exemplo n.º 21
0
        protected override void Initialize(ModulesCtxMenuContext context, MenuItem menuItem)
        {
            var files = GetSavableFiles(context.SelectedItems);

            menuItem.Header = files.Length > 1 ? string.Format("Save {0} Modules...", files.Length) : "Save Module...";
        }
Exemplo n.º 22
0
 protected override bool IsEnabled(ModulesCtxMenuContext context)
 {
     return(context.SelectedItems.Length == 1);
 }
Exemplo n.º 23
0
 protected override void Execute(ModulesCtxMenuContext context)
 {
     Save(GetSavableFiles(context.SelectedItems));
 }
Exemplo n.º 24
0
 protected override bool IsEnabled(ModulesCtxMenuContext context)
 {
     return(context.SelectedItems.Length == 1 &&
            !context.SelectedItems[0].Module.IsDynamic &&
            !context.SelectedItems[0].Module.IsInMemory);
 }
Exemplo n.º 25
0
 protected override void Execute(ModulesCtxMenuContext context)
 {
     ModulesControlCreator.ModulesControlInstance.listView.SelectAll();
 }
Exemplo n.º 26
0
 protected override bool IsEnabled(ModulesCtxMenuContext context)
 {
     return(ModulesControlCreator.ModulesControlInstance.listView.Items.Count > 0);
 }
Exemplo n.º 27
0
 protected override void Initialize(ModulesCtxMenuContext context, MenuItem menuItem)
 {
     menuItem.IsChecked = DebuggerSettings.Instance.UseHexadecimal;
 }
Exemplo n.º 28
0
 protected override void Execute(ModulesCtxMenuContext context)
 {
     DebuggerSettings.Instance.UseHexadecimal = !DebuggerSettings.Instance.UseHexadecimal;
 }
Exemplo n.º 29
0
 protected override bool IsEnabled(ModulesCtxMenuContext context)
 {
     return(GoToModuleModulesCtxMenuCommand.CanGoToModule(context));
 }
Exemplo n.º 30
0
 protected override void Execute(ModulesCtxMenuContext context)
 {
     GoToModuleModulesCtxMenuCommand.ExecuteInternal(context, true);
 }