Exemplo n.º 1
0
		private static void Main(string[] args)
		{
			// Parse command line arguments
			bool recover = false;
			foreach (string a in args)
			{
				if (a == "debug")
					System.Diagnostics.Debugger.Launch();
				else if (a == "recover")
					recover = true;
			}

			// Culture setup
			Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
			Thread.CurrentThread.CurrentUICulture = CultureInfo.InvariantCulture;

			Application.CurrentCulture = Thread.CurrentThread.CurrentCulture;
			Application.EnableVisualStyles();
			Application.SetCompatibleTextRenderingDefault(false);
			Application.ThreadException += Application_ThreadException;

			// Perform the initial package update - even before initializing the editor
			{
				PackageManager packageManager = new PackageManager();
				if (packageManager.IsPackageUpdateRequired)
				{
					Log.Editor.Write("Updating Packages...");
					Log.Editor.PushIndent();
					ProcessingBigTaskDialog setupDialog = new ProcessingBigTaskDialog(
						GeneralRes.TaskInstallPackages_Caption, 
						GeneralRes.TaskInstallPackages_Desc, 
						FirstTimeSetup, 
						packageManager);
					setupDialog.ShowInTaskbar = true;
					setupDialog.MainThreadRequired = false;
					setupDialog.ShowDialog();
					Log.Editor.PopIndent();
				}
				if (packageManager.ApplyUpdate())
				{
					Application.Exit();
					return;
				}
			}

			// Run the editor
			SplashScreen splashScreen = new SplashScreen(recover);
			splashScreen.Show();
			Application.Run();
		}
Exemplo n.º 2
0
        private static void Main(string[] args)
        {
            // Parse command line arguments
            bool recover = false;
            bool update = false;
            foreach (string a in args)
            {
                if (a == "debug")
                    System.Diagnostics.Debugger.Launch();
                else if (a == "recover")
                    recover = true;
                else if (a == "update")
                    update = true;
            }

            // Culture setup
            Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
            Thread.CurrentThread.CurrentUICulture = CultureInfo.InvariantCulture;

            // Only perform a quick update, don't do anything else.
            if (update)
            {
                Log.Editor.Write("Performing Duality Update");
                Log.Editor.PushIndent();
                try
                {
                    PackageManager packageManager = new PackageManager();
                    packageManager.VerifyPackages();
                    packageManager.ApplyUpdate(false);
                }
                catch (Exception e)
                {
                    Log.Editor.WriteError(Log.Exception(e));
                }
                Log.Editor.PopIndent();
            }
            // Run the editor regularly
            else
            {
                Application.CurrentCulture = Thread.CurrentThread.CurrentCulture;
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                Application.ThreadException += Application_ThreadException;

                SplashScreen splashScreen = new SplashScreen(recover);
                splashScreen.Show();

                Application.Run();
            }
        }
Exemplo n.º 3
0
        private static void Main(string[] args)
        {
            // Parse command line arguments
            bool recover = false;
            foreach (string a in args)
            {
                if (a == "debug")
                    System.Diagnostics.Debugger.Launch();
                else if (a == "recover")
                    recover = true;
            }

            // Culture setup
            Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
            Thread.CurrentThread.CurrentUICulture = CultureInfo.InvariantCulture;

            // Set up file logging
            StreamWriter logfileWriter = null;
            TextWriterLogOutput logfileOutput = null;
            try
            {
                // If there is an existing logfile, preserve it under a different name
                if (File.Exists(DualityEditorApp.EditorLogfilePath))
                {
                    if (File.Exists(DualityEditorApp.EditorPrevLogfilePath))
                        File.Delete(DualityEditorApp.EditorPrevLogfilePath);
                    File.Move(DualityEditorApp.EditorLogfilePath, DualityEditorApp.EditorPrevLogfilePath);
                }

                // Create a new logfile
                logfileWriter = new StreamWriter(DualityEditorApp.EditorLogfilePath);
                logfileWriter.AutoFlush = true;
                logfileOutput = new TextWriterLogOutput(logfileWriter);
                Log.AddGlobalOutput(logfileOutput);
            }
            catch (Exception e)
            {
                Log.Core.WriteWarning("Text Logfile unavailable: {0}", Log.Exception(e));
            }

            // Winforms Setup
            Application.CurrentCulture = Thread.CurrentThread.CurrentCulture;
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.ThreadException += Application_ThreadException;

            {
                PackageManager packageManager = new PackageManager();

                // On the first install startup, display a generic license agreement for Duality
                if (packageManager.IsFirstInstall)
                {
                    LicenseAcceptDialog licenseDialog = new LicenseAcceptDialog
                    {
                        DescriptionText = GeneralRes.LicenseAcceptDialog_FirstStartGeneric,
                        LicenseUrl = new Uri(DualityMainLicenseUrl)
                    };
                    DialogResult result = licenseDialog.ShowDialog();
                    if (result != DialogResult.OK)
                    {
                        Application.Exit();
                        return;
                    }
                }

                // Perform the initial package update - even before initializing the editor
                if (packageManager.IsPackageSyncRequired)
                {
                    Log.Editor.Write("Updating Packages...");
                    Log.Editor.PushIndent();
                    ProcessingBigTaskDialog setupDialog = new ProcessingBigTaskDialog(
                        GeneralRes.TaskInstallPackages_Caption,
                        GeneralRes.TaskInstallPackages_Desc,
                        SynchronizePackages,
                        packageManager);
                    setupDialog.ShowInTaskbar = true;
                    setupDialog.MainThreadRequired = false;
                    setupDialog.ShowDialog();
                    Log.Editor.PopIndent();
                }
                if (packageManager.ApplyUpdate())
                {
                    Application.Exit();
                    return;
                }
            }

            // Run the editor
            SplashScreen splashScreen = new SplashScreen(recover);
            splashScreen.Show();
            Application.Run();

            // Clean up the log file
            if (logfileWriter != null)
            {
                Log.RemoveGlobalOutput(logfileOutput);
                logfileWriter.Flush();
                logfileWriter.Close();
                logfileWriter = null;
                logfileOutput = null;
            }
        }