Parse() public static method

public static Parse ( string args ) : MonoDevelopOptions
args string
return MonoDevelopOptions
Example #1
0
        public static int Main(string[] args, IdeCustomizer customizer = null)
        {
            // Using a Stopwatch instead of a TimerCounter since calling
            // TimerCounter.BeginTiming here would occur before any timer
            // handlers can be registered. So instead the startup duration is
            // set as a metadata property on the Counters.Startup counter.
            startupTimer.Start();

            var options = MonoDevelopOptions.Parse(args);

            if (options.ShowHelp || options.Error != null)
            {
                return(options.Error != null? -1 : 0);
            }

            LoggingService.Initialize(options.RedirectOutput);

            if (customizer == null)
            {
                customizer = LoadBrandingCustomizer();
            }
            options.IdeCustomizer = customizer;

            if (!Platform.IsWindows)
            {
                // Limit maximum threads when running on mono
                int threadCount = 125;
                ThreadPool.SetMaxThreads(threadCount, threadCount);
            }

            int ret = -1;

            try {
                var exename = Path.GetFileNameWithoutExtension(Assembly.GetEntryAssembly().Location);
                if (!Platform.IsMac && !Platform.IsWindows)
                {
                    exename = exename.ToLower();
                }
                Runtime.SetProcessName(exename);

                sectionTimings ["mainInitialization"] = startupTimer.ElapsedMilliseconds;
                startupTimer.Restart();

                var app = new IdeStartup();
                ret = app.Run(options);
            } catch (Exception ex) {
                LoggingService.LogFatalError(
                    string.Format(
                        "{0} failed to start. Some of the assemblies required to run {0} (for example gtk-sharp)" +
                        "may not be properly installed in the GAC.",
                        BrandingService.ApplicationName
                        ), ex);
            } finally {
                Runtime.Shutdown();
            }

            LoggingService.Shutdown();

            return(ret);
        }
Example #2
0
		Task<int> IApplication.Run (string[] args)
		{
			var options = MonoDevelopOptions.Parse (args);
			if (options.Error != null || options.ShowHelp)
				return Task.FromResult (options.Error != null? -1 : 0);
			return Task.FromResult (Run (options));
		}
Example #3
0
        public static int Main(string[] args, IdeCustomizer customizer = null)
        {
            var options = MonoDevelopOptions.Parse(args);

            if (options.ShowHelp || options.Error != null)
            {
                return(options.Error != null? -1 : 0);
            }

            LoggingService.Initialize(options.RedirectOutput);

            if (customizer == null)
            {
                customizer = LoadBrandingCustomizer();
            }
            options.IdeCustomizer = customizer;

            int  ret   = -1;
            bool retry = false;

            do
            {
                try {
                    var exename = Path.GetFileNameWithoutExtension(Assembly.GetEntryAssembly().Location);
                    if (!Platform.IsMac && !Platform.IsWindows)
                    {
                        exename = exename.ToLower();
                    }
                    Runtime.SetProcessName(exename);
                    var app = new IdeStartup();
                    ret = app.Run(options);
                    break;
                } catch (Exception ex) {
                    if (!retry && AddinManager.IsInitialized)
                    {
                        LoggingService.LogWarning(BrandingService.ApplicationName + " failed to start. Rebuilding addins registry.", ex);
                        AddinManager.Registry.Rebuild(new Mono.Addins.ConsoleProgressStatus(true));
                        LoggingService.LogInfo("Addin registry rebuilt. Restarting {0}.", BrandingService.ApplicationName);
                        retry = true;
                    }
                    else
                    {
                        LoggingService.LogFatalError(
                            string.Format(
                                "{0} failed to start. Some of the assemblies required to run {0} (for example gtk-sharp)" +
                                "may not be properly installed in the GAC.",
                                BrandingService.ApplicationName
                                ), ex);
                        retry = false;
                    }
                } finally {
                    Runtime.Shutdown();
                }
            }while (retry);

            LoggingService.Shutdown();

            return(ret);
        }
Example #4
0
        int IApplication.Run(string[] args)
        {
            var options = MonoDevelopOptions.Parse(args);

            if (options.Error != null || options.ShowHelp)
            {
                return(options.Error != null? -1 : 0);
            }
            return(Run(options));
        }
Example #5
0
        public static int Main(string[] args, IdeCustomizer customizer = null)
        {
            IdeStartupTracker.StartupTracker.Start();

            var options = MonoDevelopOptions.Parse(args);

            if (options.ShowHelp || options.Error != null)
            {
                return(options.Error != null? -1 : 0);
            }

            LoggingService.Initialize(options.RedirectOutput);

            if (customizer == null)
            {
                customizer = LoadBrandingCustomizer();
            }
            options.IdeCustomizer = customizer;

            if (!Platform.IsWindows)
            {
                // Limit maximum threads when running on mono
                int threadCount = 125;
                ThreadPool.SetMaxThreads(threadCount, threadCount);
            }

            int ret = -1;

            try {
                var exename = Path.GetFileNameWithoutExtension(Assembly.GetEntryAssembly().Location);
                if (!Platform.IsMac && !Platform.IsWindows)
                {
                    exename = exename.ToLower();
                }
                Runtime.SetProcessName(exename);

                IdeStartupTracker.StartupTracker.MarkSection("mainInitialization");

                var app = new IdeStartup();
                ret = app.Run(options);
            } catch (Exception ex) {
                LoggingService.LogFatalError(
                    string.Format(
                        "{0} failed to start. Some of the assemblies required to run {0} (for example gtk-sharp)" +
                        "may not be properly installed in the GAC.",
                        BrandingService.ApplicationName
                        ), ex);
            } finally {
                Runtime.Shutdown();
            }

            LoggingService.Shutdown();

            return(ret);
        }
Example #6
0
        public static int Main(string[] args)
        {
            var options = MonoDevelopOptions.Parse(args);

            if (options.ShowHelp || options.Error != null)
            {
                return(options.Error != null? -1 : 0);
            }

            LoggingService.Initialize(options.RedirectOutput);

            int  ret   = -1;
            bool retry = false;

            do
            {
                try
                {
                    Runtime.SetProcessName(BrandingService.ApplicationName);
                    var app = new IdeStartup();
                    ret = app.Run(options);
                    break;
                }
                catch (Exception ex)
                {
                    if (!retry && AddinManager.IsInitialized)
                    {
                        LoggingService.LogWarning(BrandingService.ApplicationName + " failed to start. Rebuilding addins registry.");
                        AddinManager.Registry.Rebuild(new Mono.Addins.ConsoleProgressStatus(true));
                        LoggingService.LogInfo("Addin registry rebuilt. Restarting MonoDevelop.");
                        retry = true;
                    }
                    else
                    {
                        LoggingService.LogFatalError(BrandingService.ApplicationName + " failed to start. Some of the assemblies required to run MonoDevelop (for example gtk-sharp, gnome-sharp or gtkhtml-sharp) may not be properly installed in the GAC.", ex);
                        retry = false;
                    }
                }
                finally
                {
                    Runtime.Shutdown();
                }
            }while (retry);

            LoggingService.Shutdown();

            return(ret);
        }
Example #7
0
        public static int Main(string[] args, IdeCustomizer customizer = null)
        {
            var options = MonoDevelopOptions.Parse(args);

            if (options.ShowHelp || options.Error != null)
            {
                return(options.Error != null? -1 : 0);
            }

            LoggingService.Initialize(options.RedirectOutput);

            if (customizer == null)
            {
                customizer = LoadBrandingCustomizer();
            }
            options.IdeCustomizer = customizer;

            int ret = -1;

            try {
                var exename = Path.GetFileNameWithoutExtension(Assembly.GetEntryAssembly().Location);
                if (!Platform.IsMac && !Platform.IsWindows)
                {
                    exename = exename.ToLower();
                }
                Runtime.SetProcessName(exename);
                var app = new IdeStartup();
                ret = app.Run(options);
            } catch (Exception ex) {
                LoggingService.LogFatalError(
                    string.Format(
                        "{0} failed to start. Some of the assemblies required to run {0} (for example gtk-sharp)" +
                        "may not be properly installed in the GAC.",
                        BrandingService.ApplicationName
                        ), ex);

                if (Platform.IsWindows)
                {
                    string url     = "http://monodevelop.com/Download";
                    string caption = "Fatal Error";
                    string message =
                        "{0} failed to start. Some of the assemblies required to run {0} (for example GTK#) " +
                        "may not be properly installed in the GAC.\n\r\n\r" +
                        "Please click OK to open the download page, where " +
                        "you can download the necessary dependencies for {0} to run.";

                    if (DisplayWindowsOkCancelMessage(
                            string.Format(message, BrandingService.ApplicationName, url), caption)
                        )
                    {
                        Process.Start(url);
                    }
                }
            } finally {
                Runtime.Shutdown();
            }

            LoggingService.Shutdown();

            return(ret);
        }