//--------------------------------
        #region Menu Items

        private void OnLaunchTerraria(object sender, RoutedEventArgs e)
        {
            try {
                if (File.Exists(Patcher.ExePath))
                {
                    ProcessStartInfo start = new ProcessStartInfo();
                    start.FileName         = Patcher.ExePath;
                    start.Arguments        = TerrariaLocator.FindTerraLauncherSaveDirectory(Patcher.ExePath);
                    start.WorkingDirectory = Patcher.ExeDirectory;
                    Process.Start(start);
                }
                else
                {
                    TriggerMessageBox.Show(this, MessageIcon.Warning, "Could not locate the Terraria executable! Cannot launch Terraria.", "Missing Executable");
                }
            }
            catch {
                TriggerMessageBox.Show(this, MessageIcon.Warning, "The current path to Terraria is invalid! Cannot launch Terraria.", "Invalid Path");
            }
        }
Esempio n. 2
0
        //--------------------------------
        #region Menu Items

        private void OnLaunchTerraria(object sender, RoutedEventArgs e)
        {
            if (Config.TerrariaContentDirectory != string.Empty)
            {
                try {
                    string dir      = Path.GetDirectoryName(Config.TerrariaContentDirectory);
                    string terraria = Path.Combine(dir, "Terraria.exe");
                    if (File.Exists(terraria))
                    {
                        ProcessStartInfo start = new ProcessStartInfo();
                        start.FileName         = terraria;
                        start.Arguments        = TerrariaLocator.FindTerraLauncherSaveDirectory(terraria);
                        start.WorkingDirectory = dir;
                        Process.Start(start);
                        return;
                    }
                }
                catch { }

                try {
                    string dir      = Config.TerrariaContentDirectory;
                    string terraria = Path.Combine(dir, "Terraria.exe");
                    if (File.Exists(terraria))
                    {
                        ProcessStartInfo start = new ProcessStartInfo();
                        start.FileName         = terraria;
                        start.Arguments        = TerrariaLocator.FindTerraLauncherSaveDirectory(terraria);
                        start.WorkingDirectory = dir;
                        Process.Start(start);
                        return;
                    }
                }
                catch { }
                TriggerMessageBox.Show(this, MessageIcon.Warning, "Failed to locate Terraria executable.", "Missing Exe");
            }
            else
            {
                TriggerMessageBox.Show(this, MessageIcon.Warning, "No path to Terraria specified.", "No Path");
            }
        }