コード例 #1
0
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

        public IEnumerable <IDebugLaunchSettings> PrepareLaunch(DebugLaunchOptions launchOptions, IDictionary <string, string> projectProperties)
        {
            LoggingUtils.PrintFunction();

            IDebugLauncher debugLauncher = null;

            try
            {
                debugLauncher = GetDebugLauncher(ServiceProvider);

                debugLauncher.PrepareLaunch();

                DebugLaunchSettings debugLaunchSettings = null;

                Project startupProject = GetStartupSolutionProject(ServiceProvider, (Dictionary <string, string>)projectProperties);

                if (startupProject == null)
                {
                    throw new InvalidOperationException("Could not find solution startup project.");
                }

                LoggingUtils.Print("Launcher startup project: " + startupProject.Name + " (" + startupProject.FullName + ")");

                LaunchConfiguration launchConfig = debugLauncher.GetLaunchConfigurationFromProjectProperties(projectProperties, startupProject);

                LaunchProps [] launchProps = debugLauncher.GetLaunchPropsFromProjectProperties(projectProperties, startupProject);

                if (launchOptions.HasFlag(DebugLaunchOptions.NoDebug))
                {
                    debugLaunchSettings = (DebugLaunchSettings)debugLauncher.StartWithoutDebugging((int)launchOptions, launchConfig, launchProps, projectProperties);
                }
                else
                {
                    debugLaunchSettings = (DebugLaunchSettings)debugLauncher.StartWithDebugging((int)launchOptions, launchConfig, launchProps, projectProperties);
                }

                if (debugLaunchSettings == null)
                {
                    throw new InvalidOperationException("Could not evaluate valid launch settings.");
                }

                return(new IDebugLaunchSettings [] { debugLaunchSettings });
            }
            catch (Exception e)
            {
                LoggingUtils.HandleException(e);

                string description = string.Format("'PrepareLaunch' failed:\n[Exception] {0}", e.Message);

#if DEBUG
                description += "\n[Exception] Stack trace:\n" + e.StackTrace;
#endif

                if (debugLauncher != null)
                {
                    LoggingUtils.RequireOk(debugLauncher.GetConnectionService().LaunchDialogUpdate(description, true));
                }

                VsShellUtilities.ShowMessageBox(ServiceProvider, description, "Android++ Debugger", OLEMSGICON.OLEMSGICON_CRITICAL, OLEMSGBUTTON.OLEMSGBUTTON_OK, OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST);
            }

            return(null);
        }