Exemple #1
0
        /// <summary>
        /// Launch SA:MP server
        /// </summary>
        public static void LaunchSAMPServer()
        {
            LauncherConfigDataContract lcdc = LauncherConfigIO;

            if (File.Exists("sampctl.exe"))
            {
                try
                {
                    CloseLastServer();
                    ProcessStartInfo process_start_info = new ProcessStartInfo(Path.Combine(Directory.GetCurrentDirectory(), "sampctl.exe"), "server run");
                    process_start_info.WorkingDirectory = lcdc.DevelopmentDirectory;
                    lastServerProcess = Process.Start(process_start_info);
                }
                catch (Exception e)
                {
                    Console.Error.WriteLine(e);
                    MessageBox.Show(e.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                if (MessageBox.Show(string.Format(Utils.Translator.GetTranslation("SAMPCTL_MISSING"), SAMPCTLProvider.SAMPCTLURI), Utils.Translator.GetTranslation("SAMPCTL_MISSING_TITLE"), MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
                {
                    try
                    {
                        Process.Start(SAMPCTLProvider.SAMPCTLURI);
                    }
                    catch (Exception e)
                    {
                        Console.Error.WriteLine(e);
                    }
                }
            }
        }
 /// <summary>
 /// Save settings
 /// </summary>
 public void SaveSettings()
 {
     if (launcherConfig == null)
     {
         launcherConfig = SAMP.LauncherConfigIO;
     }
     SAMP.LauncherConfigIO = launcherConfig;
 }
Exemple #3
0
        /// <summary>
        /// Launch SA:MP server
        /// </summary>
        public static void LaunchSAMPServer()
        {
            LauncherConfigDataContract lcdc = LauncherConfigIO;

            if (File.Exists("sampctl.exe"))
            {
                try
                {
                    CloseLastServer();
                    lastServerProcess = Process.Start("sampctl.exe", "run --dir " + lcdc.DevelopmentDirectory);
                }
                catch (Exception e)
                {
                    MessageBox.Show(e.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                MessageBox.Show("Get \"sampctl.exe\" from https://github.com/Southclaws/sampctl/releases to run a server.", "\"sampctl\" missing", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }