Inheritance: System.Windows.Window
Esempio n. 1
0
        public static void Main(string[] args)
        {
            System.AppDomain.CurrentDomain.UnhandledException += Program_UnhandledException;

            if (Configuration.Program.CheckForUpdates)
            {
                Models.Update update = CheckForUpdates();
                if (update != null && update.IsNewer)
                {
                    Views.UpdaterView updater = new Views.UpdaterView();

                    ViewModels.UpdaterViewModel context = (ViewModels.UpdaterViewModel)updater.DataContext;
                    context.Location = update.Location;
                    context.Details = update.Details;
                    context.CheckSum = update.CheckSum;

                    if (updater.ShowDialog() == true)
                    {
                        string temp = context.ExtractedPath;
                        string working = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);

                        UpdateProgram(temp, working);

                        return;
                    }
                }
            }

            if (args.Length > 1 && args[0].ToLower() == "--pid")
            {
                Process parent = Process.GetProcessById(Configuration.Convert.ToInteger(args[1]));
                if (parent != null)
                {
                    parent.Kill();
                }
            }

            string path = Configuration.Program.SEPath;
            if (!SandboxIsCopied(path))
            {
                if (!IsAdmin)
                {
                    string message = "SE Workbench needs to copy the sandbox files. Make sure Space Engineers and Steam are closed and then press OK to continue.";
                    MessageBox.ShowMessage(message);

                    Restart(true);
                }

                if (!ValidPath(path))
                {
                    path = GetSandboxPath();
                }

                bool success = CopySandbox(path);
                if (success)
                {
                    Configuration.Program.SEPath = path;

                    Restart();
                }
                else
                {
                    string message = String.Format("Workbench was unable to copy sandbox (path: {0}) and may not function properly.", path);
                    MessageBox.ShowMessage(message);
                }
            }

            Views.SplashScreenView splash = new Views.SplashScreenView();
            splash.Show();

            Interop.Engine.Initialize();
            Interop.Decompiler.LoadClasses();

            splash.Close();

            StartApp();
        }
Esempio n. 2
0
        public static void Main(string[] args)
        {
            System.AppDomain.CurrentDomain.UnhandledException += Program_UnhandledException;

            if (Configuration.Program.CheckForUpdates)
            {
                Models.Update update = CheckForUpdates();
                if (update != null && update.IsNewer)
                {
                    Views.UpdaterView updater = new Views.UpdaterView();

                    ViewModels.UpdaterViewModel context = (ViewModels.UpdaterViewModel)updater.DataContext;
                    context.Location = update.Location;
                    context.Details  = update.Details;
                    context.CheckSum = update.CheckSum;

                    if (updater.ShowDialog() == true)
                    {
                        string temp    = context.ExtractedPath;
                        string working = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);

                        UpdateProgram(temp, working);

                        return;
                    }
                }
            }

            if (args.Length > 1 && args[0].ToLower() == "--pid")
            {
                Process parent = Process.GetProcessById(Configuration.Convert.ToInteger(args[1]));
                if (parent != null)
                {
                    parent.Kill();
                }
            }

            string path = Configuration.Program.SEPath;

            if (!SandboxIsCopied(path))
            {
                if (!IsAdmin)
                {
                    string message = "SE Workbench needs to copy the sandbox files. Make sure Space Engineers and Steam are closed and then press OK to continue.";
                    MessageBox.ShowMessage(message);

                    Restart(true);
                }

                if (!ValidPath(path))
                {
                    path = GetSandboxPath();
                }

                bool success = CopySandbox(path);
                if (success)
                {
                    Configuration.Program.SEPath = path;

                    Restart();
                }
                else
                {
                    string message = String.Format("Workbench was unable to copy sandbox (path: {0}) and may not function properly.", path);
                    MessageBox.ShowMessage(message);
                }
            }

            Views.SplashScreenView splash = new Views.SplashScreenView();
            splash.Show();

            Interop.Engine.Initialize();
            Interop.Decompiler.LoadClasses();

            splash.Close();

            StartApp();
        }