Пример #1
0
		/// <summary>
		/// The main entry point for the application.
		/// </summary>
		public static void Main(string[] args)
		{
			string error = null;
			GameMain main = null;
			if (Debugger.IsAttached)
			{
				main = new GameMain();
				try
				{
					main.Run();
				}
				catch (GameMain.ExitException)
				{

				}
			}
			else
			{
				try
				{
					main = new GameMain();
					main.Run();
				}
				catch (Exception e)
				{
					if (!(e is GameMain.ExitException))
						error = e.ToString();
				}
			}
			if (main != null)
				main.Cleanup();
#if ANALYTICS
			if (main.MapFile.Value == null || main.EditorEnabled)
				main.SessionRecorder.Reset();
			if (error == null)
				main.SessionRecorder.RecordEvent("Exit");
			else
				main.SessionRecorder.RecordEvent("Crash", error);
			main.SaveAnalytics();

#if MONOGAME
			// TODO: MonoGame analytics form
#else
			System.Windows.Forms.Application.EnableVisualStyles();
			AnalyticsForm analyticsForm = new AnalyticsForm(main, error);
			System.Windows.Forms.Application.Run(analyticsForm);
#endif
#else
#if MONOGAME
			// TODO: MonoGame error form
#else
			if (error != null)
			{
				System.Windows.Forms.Application.EnableVisualStyles();
				ErrorForm errorForm = new ErrorForm(error);
				System.Windows.Forms.Application.Run(errorForm);
			}
#endif
#endif
		}
Пример #2
0
        public static void Main(string[] args)
        {
            System.Windows.Forms.Application.EnableVisualStyles();
#if VR
            bool vr = args.Select(x => x.ToLower()).Contains("-vr");
#endif

            int monitor = 0;
            if (GraphicsAdapter.Adapters.Count > 1)
            {
                AdapterSelectorForm selectorForm = new AdapterSelectorForm(vr);
                System.Windows.Forms.Application.Run(selectorForm);
                if (!selectorForm.Go)
                {
                    return;
                }

                vr      = selectorForm.VR;
                monitor = selectorForm.Monitor;
            }

            Main main = null;
            if (Debugger.IsAttached)
            {
#if VR
                main = new Main(monitor, vr);
#else
                main = new Main(monitor);
#endif
                try
                {
                    main.Run();
                }
                catch (Main.ExitException)
                {
                }
                main.Cleanup();
            }
            else
            {
                try
                {
#if VR
                    main = new Main(monitor, vr);
#else
                    main = new Main(monitor);
#endif
                    main.Run();
                }
                catch (Main.ExitException)
                {
#if ANALYTICS
                    main.SessionRecorder.RecordEvent("Exit");
                    if (!main.IsChallengeMap(main.MapFile) && main.MapFile.Value != Lemma.Main.MenuMap)
                    {
                        main.SaveAnalytics();
                    }
#endif
                }
#if !DEBUG
                catch (Exception e)
                {
                    string uuid = main != null ? (main.Settings != null ? main.Settings.UUID : null) : null;
                    Lemma.Main.Config.RecordAnalytics analytics = main != null ? (main.Settings != null ? main.Settings.Analytics : Lemma.Main.Config.RecordAnalytics.Off) : Lemma.Main.Config.RecordAnalytics.Off;
                    ErrorForm errorForm = new ErrorForm(e.ToString(), uuid, analytics == Lemma.Main.Config.RecordAnalytics.On);
#if ANALYTICS
                    if (main != null)
                    {
                        main.SessionRecorder.RecordEvent("Crash", e.ToString());
                        main.SaveAnalytics();
                        errorForm.Session = main.SessionRecorder;
                    }
#endif
                    System.Windows.Forms.Application.Run(errorForm);
                }
#endif
                finally
                {
                    if (main != null)
                    {
                        main.Cleanup();
                    }
                }
            }
        }
Пример #3
0
		public static void Main(string[] args)
		{
			System.Windows.Forms.Application.EnableVisualStyles();
#if VR
			bool vr = args.Select(x => x.ToLower()).Contains("-vr");
#endif

			int monitor = 0;
			if (GraphicsAdapter.Adapters.Count > 1)
			{
				AdapterSelectorForm selectorForm = new AdapterSelectorForm(vr);
				System.Windows.Forms.Application.Run(selectorForm);
				if (!selectorForm.Go)
					return;

				vr = selectorForm.VR;
				monitor = selectorForm.Monitor;
			}

			Main main = null;
			if (Debugger.IsAttached)
			{
#if VR
				main = new Main(monitor, vr);
#else
				main = new Main(monitor);
#endif
				try
				{
					main.Run();
				}
				catch (Main.ExitException)
				{
				}
				main.Cleanup();
			}
			else
			{
				try
				{
#if VR
					main = new Main(monitor, vr);
#else
					main = new Main(monitor);
#endif
					main.Run();
				}
				catch (Main.ExitException)
				{
#if ANALYTICS
					main.SessionRecorder.RecordEvent("Exit");
					if (!main.IsChallengeMap(main.MapFile) && main.MapFile.Value != Lemma.Main.MenuMap)
						main.SaveAnalytics();
#endif
				}
#if !DEBUG
				catch (Exception e)
				{
					string uuid = main != null ? (main.Settings != null ? main.Settings.UUID : null) : null;
					Lemma.Main.Config.RecordAnalytics analytics = main != null ? (main.Settings != null ? main.Settings.Analytics : Lemma.Main.Config.RecordAnalytics.Off) : Lemma.Main.Config.RecordAnalytics.Off;
					ErrorForm errorForm = new ErrorForm(e.ToString(), uuid, analytics == Lemma.Main.Config.RecordAnalytics.On);
#if ANALYTICS
					if (main != null)
					{
						main.SessionRecorder.RecordEvent("Crash", e.ToString());
						main.SaveAnalytics();
						errorForm.Session = main.SessionRecorder;
					}
#endif
					System.Windows.Forms.Application.Run(errorForm);
				}
#endif
				finally
				{
					if (main != null)
						main.Cleanup();
				}
			}
		}
Пример #4
0
        public static void Main(string[] args)
        {
#if VR
            bool vr = args.Contains("-vr");
#endif
            Main main = null;
            if (Debugger.IsAttached)
            {
#if VR
                main = new Main(vr);
#else
                main = new Main();
#endif
                try
                {
                    main.Run();
                }
                catch (Main.ExitException)
                {
                }
            }
            else
            {
                try
                {
#if VR
                    main = new Main(vr);
#else
                    main = new Main();
#endif
                    main.Run();
                }
                catch (Main.ExitException)
                {
#if ANALYTICS
                    main.SessionRecorder.RecordEvent("Exit");
                    if (!main.IsChallengeMap(main.MapFile))
                    {
                        main.SaveAnalytics();
                    }
#endif
                }
#if !DEBUG
                catch (Exception e)
                {
                    System.Windows.Forms.Application.EnableVisualStyles();
                    ErrorForm errorForm = new ErrorForm(e.ToString(), main != null ? (main.Settings != null ? main.Settings.UUID : null) : null);
#if ANALYTICS
                    if (main != null)
                    {
                        main.SessionRecorder.RecordEvent("Crash", e.ToString());
                        main.SaveAnalytics();
                        errorForm.Session = main.SessionRecorder;
                    }
#endif
                    System.Windows.Forms.Application.Run(errorForm);
                }
#endif
                finally
                {
                    if (main != null)
                    {
                        main.Cleanup();
                    }
                }
            }
        }
Пример #5
0
        public static void Main(string[] args)
        {
#if DEVELOPMENT
            Lemma.Main.AllowEditingGameMaps = true;
#else
            Lemma.Main.AllowEditingGameMaps = args.Contains("-dev");
#endif

#if VR
            bool vr = args.Contains("-vr");
#endif
            string error = null;
            Main   main  = null;
            if (Debugger.IsAttached)
            {
#if VR
                main = new Main(vr);
#else
                main = new Main();
#endif
                try
                {
                    main.Run();
                }
                catch (Main.ExitException)
                {
                }
            }
            else
            {
                try
                {
#if VR
                    main = new Main(vr);
#else
                    main = new Main();
#endif
                    main.Run();
                }
                catch (Exception e)
                {
                    if (!(e is Main.ExitException))
                    {
                        error = e.ToString();
                    }
                }
            }

            if (main != null)
            {
                main.Cleanup();
            }

#if ANALYTICS
            if (main != null)
            {
                if (error == null)
                {
                    main.SessionRecorder.RecordEvent("Exit");
                }
                else
                {
                    main.SessionRecorder.RecordEvent("Crash", error);
                }
                main.SaveAnalytics();
            }

            System.Windows.Forms.Application.EnableVisualStyles();
            string anonymousId = "";
            if (main != null && main.Settings != null)
            {
                anonymousId = main.Settings.UUID;
            }
            AnalyticsForm analyticsForm = new AnalyticsForm(main, anonymousId, error);
            System.Windows.Forms.Application.Run(analyticsForm);
#else
            if (error != null)
            {
                System.Windows.Forms.Application.EnableVisualStyles();
                ErrorForm errorForm = new ErrorForm(error);
                System.Windows.Forms.Application.Run(errorForm);
            }
#endif
        }