Exemple #1
0
        public static void RunSelectedMod()
        {
            // First save the settings
            UserData.Instance.Save();

            ModSettings settings = ModSettings.Instance;

            // Check to see if the settings file exists
            if (!settings.Exists())
            {
                AppDialogMessage dialog = new AppDialogMessage("No settings file has been found. Is this a SINGLEPLAYER mod?",
                                                               "Singleplayer mod?", MessageButtons.YesNo, MessageIcon.Question);

                bool?result = dialog.ShowDialog();
                if (result == null || result.HasValue == false || result.Value != true)
                {
                    // ABORT!
                    return;
                }

                if (dialog.Result == MessageResult.Yes)
                {
                    settings.ModType = "Singleplayer";
                }
                else
                {
                    settings.ModType = "Multiplayer";
                }

                settings.Save();
            }

            string installPath = Preferences.InstallPath;
            string optional    = string.Empty;

            // Enable developer
            if (UserData.ModDeveloper)
            {
                optional = string.Format("{0} +set developer 1", optional);
            }

            // Enable developer_scipt
            if (UserData.ModDeveloperScript)
            {
                optional = string.Format("{0} +set developer_script 1", optional);
            }

            // Enable cheats
            if (UserData.ModCheats)
            {
                optional = string.Format("{0} +set thereisacow 1337", optional);
            }

            // Enable custom command line options
            if (UserData.ModCustom)
            {
                optional = string.Format("{0} {1}", optional, UserData.ModOptions);
            }

            SPiApp2.Components.Application.Launch(
                string.Format("{0}{1}bin{1}mod_run.bat", Environment.CurrentDirectory, System.IO.Path.DirectorySeparatorChar),
                installPath,
                string.Format("\"{0}\" {1} \"{2}\" {3} \"{4}\"", installPath, UserData.SelectedMod, Preferences.Executable, GetMultiplayerSign(), optional)
                );
        }