Ejemplo n.º 1
0
        /// <summary>
        /// Dispatches menu commands.
        /// </summary>
        /// <param name="cmdSet"></param>
        /// <param name="cmdId"></param>
        /// <returns></returns>
        public bool Execute(CommandID cmdId)
        {
            var ct = GetSubCommandTarget();

            if (ct != null && ct.Execute(cmdId))
            {
                form.UpdateToolbarState();
                return(true);
            }
            if (currentPhase != null && currentPhase.Execute(cmdId))
            {
                form.UpdateToolbarState();
                return(true);
            }
            if (cmdId.Guid == CmdSets.GuidReko)
            {
                if (ExecuteMruFile(cmdId.ID))
                {
                    form.UpdateToolbarState();
                    return(false);
                }

                bool retval = false;
                switch (cmdId.ID)
                {
                case CmdIds.FileOpen: OpenBinaryWithPrompt(); retval = true; break;

                case CmdIds.FileOpenAs: retval = OpenBinaryAs(""); break;

                case CmdIds.FileAssemble: retval = AssembleFile(); break;

                case CmdIds.FileSave: Save(); retval = true; break;

                case CmdIds.FileAddMetadata: AddMetadataFile(); retval = true; break;

                case CmdIds.FileCloseProject: CloseProject(); retval = true; break;

                case CmdIds.FileExit: form.Close(); retval = true; break;

                case CmdIds.ActionRestartDecompilation: RestartRecompilation(); retval = true; break;

                case CmdIds.ActionNextPhase: NextPhase(); retval = true; break;

                case CmdIds.ActionFinishDecompilation: FinishDecompilation(); retval = true; break;

                case CmdIds.EditFind: EditFind(); retval = true; break;

                case CmdIds.ViewProjectBrowser: ViewProjectBrowser(); retval = true; break;

                case CmdIds.ViewProcedureList: ViewProcedureList(); retval = true; break;

                case CmdIds.ViewDisassembly: ViewDisassemblyWindow(); retval = true; break;

                case CmdIds.ViewMemory: ViewMemoryWindow(); retval = true; break;

                case CmdIds.ViewCallGraph: ViewCallGraph(); retval = true; break;

                case CmdIds.ViewFindAllProcedures: FindProcedures(srSvc); retval = true; break;

                case CmdIds.ViewFindStrings: FindStrings(srSvc); retval = true; break;

                case CmdIds.ToolsOptions: ToolsOptions(); retval = true; break;

                case CmdIds.ToolsKeyBindings: ToolsKeyBindings(); retval = true; break;

                case CmdIds.WindowsCascade: LayoutMdi(DocumentWindowLayout.None); retval = true; break;

                case CmdIds.WindowsTileVertical: LayoutMdi(DocumentWindowLayout.TiledVertical); retval = true; break;

                case CmdIds.WindowsTileHorizontal: LayoutMdi(DocumentWindowLayout.TiledHorizontal); retval = true; break;

                case CmdIds.WindowsCloseAll: CloseAllDocumentWindows(); retval = true; break;

                case CmdIds.HelpAbout: ShowAboutBox(); retval = true; break;
                }
                form.UpdateToolbarState();
                return(retval);
            }
            return(false);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Dispatches menu commands.
        /// </summary>
        /// <param name="cmdSet"></param>
        /// <param name="cmdId"></param>
        /// <returns></returns>
        public bool Execute(CommandID cmdId)
        {
            var ct = GetSubCommandTarget();

            if (ct != null && ct.Execute(cmdId))
            {
                return(true);
            }

            if (currentPhase != null && currentPhase.Execute(cmdId))
            {
                return(true);
            }
            if (cmdId.Guid == CmdSets.GuidReko)
            {
                if (ExecuteMruFile(cmdId.ID))
                {
                    return(false);
                }

                switch (cmdId.ID)
                {
                case CmdIds.FileOpen: OpenBinaryWithPrompt(); return(true);

                case CmdIds.FileOpenAs: return(OpenBinaryAs());

                case CmdIds.FileAssemble: return(AssembleFile());

                case CmdIds.FileSave: Save(); return(true);

                case CmdIds.FileAddMetadata: AddMetadataFile(); return(true);

                case CmdIds.FileCloseProject: CloseProject(); return(true);

                case CmdIds.FileExit: form.Close(); return(true);

                case CmdIds.ActionRestartDecompilation: RestartRecompilation(); return(true);

                case CmdIds.ActionNextPhase: NextPhase(); return(true);

                case CmdIds.ActionFinishDecompilation: FinishDecompilation(); return(true);

                case CmdIds.EditFind: EditFind(); return(true);

                case CmdIds.ViewDisassembly: ViewDisassemblyWindow(); return(true);

                case CmdIds.ViewMemory: ViewMemoryWindow(); return(true);

                case CmdIds.ViewFindAllProcedures: FindProcedures(srSvc); return(true);

                case CmdIds.WindowsCascade: LayoutMdi(DocumentWindowLayout.None); return(true);

                case CmdIds.WindowsTileVertical: LayoutMdi(DocumentWindowLayout.TiledVertical); return(true);

                case CmdIds.WindowsTileHorizontal: LayoutMdi(DocumentWindowLayout.TiledHorizontal); return(true);

                case CmdIds.WindowsCloseAll: CloseAllDocumentWindows(); return(true);

                case CmdIds.HelpAbout: ShowAboutBox(); return(true);
                }
            }
            return(false);
        }