コード例 #1
0
 public Launcher(LaunchSetting setting)
 {
     if (setting == null)
     {
         throw new ArgumentNullException("setting");
     }
     m_Setting = setting;
 }
コード例 #2
0
        private void DoLaunch(LaunchSetting setting)
        {
            if (String.IsNullOrEmpty(m_CurrentSetting.ClientPath))
            {
                DisplayInformalMessage("The location of the client.exe could not be determined automatically. Please specify the location manually.");
                return;
            }

            int authenticationPort;
            if (Int32.TryParse(c_TextBox_Port.Text, out authenticationPort) == false)
            {
                DisplayWarningMessage("Please enter a valid port number.");
                c_TextBox_Port.SelectAll();
                c_TextBox_Port.Focus();
                return;
            }
            else if (authenticationPort <= 0 || authenticationPort > ushort.MaxValue)
            {
                DisplayWarningMessage("Please enter a valid port number between 1 and 65535.");
                c_TextBox_Port.SelectAll();
                c_TextBox_Port.Focus();
                return;
            }

            try
            {
                // Add Settings
                HostConfigurationElement serverConfig;
                ServerConfigurationElement emulatorConfig;
                if (TryGetSelectedServer(out emulatorConfig, out serverConfig) == false)
                {
                    DisplayWarningMessage("Please select an emulator/server.");
                    return;
                }

                setting.UseSecureAuthentication = c_CheckBox_SecureAuthentication.Checked;
                setting.AuthenticationPort = authenticationPort;

                if (c_ComboBox_Servers.SelectedIndex == -1)
                {
                    setting.Hostname = c_ComboBox_Servers.Text;
                }
                else
                {
                    setting.Hostname = serverConfig.Hostname;
                }

                setting.LaunchName = emulatorConfig.GetLaunchName();
                setting.UseClientDetours = c_CheckBox_ClientDetours.Checked;
                setting.UseLocalCert = c_CheckBox_LocalCert.Checked;

                // Save State
                Properties.Settings.Default.UseClientDetours = c_CheckBox_ClientDetours.Checked;
                Properties.Settings.Default.LastEmulatorName = emulatorConfig.Name;
                Properties.Settings.Default.UseLocalCert = c_CheckBox_LocalCert.Checked;

                if (c_ComboBox_Servers.Items.Count > 0 && c_ComboBox_Servers.SelectedIndex == -1)
                {
                    Properties.Settings.Default.LastServerName = c_ComboBox_Servers.Text;
                }
                else
                {
                    Properties.Settings.Default.LastServerName = serverConfig.Hostname;
                }
                Properties.Settings.Default.UseSecureAuthentication = c_CheckBox_SecureAuthentication.Checked;
                Properties.Settings.Default.AuthenticationPort = c_TextBox_Port.Text;
                Properties.Settings.Default.Save();

                // Launcher Server/Client
                Launcher launcher = new Launcher(setting);
                launcher.Launch();

                // Close Launcher
                this.Close();
            }
            catch (Exception e)
            {
                DisplayErrorMessage("Error while launching client.", e);
            }
        }
コード例 #3
0
        private void DoLaunch(LaunchSetting setting)
        {
            if (String.IsNullOrEmpty(m_CurrentSetting.ClientPath))
            {
                DisplayInformalMessage("The location of the client.exe could not be determined automatically. Please specify the location manually.");
                return;
            }

            int authenticationPort;

            if (Int32.TryParse(c_TextBox_Port.Text, out authenticationPort) == false)
            {
                DisplayWarningMessage("Please enter a valid port number.");
                c_TextBox_Port.SelectAll();
                c_TextBox_Port.Focus();
                return;
            }
            else if (authenticationPort <= 0 || authenticationPort > ushort.MaxValue)
            {
                DisplayWarningMessage("Please enter a valid port number between 1 and 65535.");
                c_TextBox_Port.SelectAll();
                c_TextBox_Port.Focus();
                return;
            }

            try
            {
                // Add Settings
                HostConfigurationElement   serverConfig;
                ServerConfigurationElement emulatorConfig;
                if (TryGetSelectedServer(out emulatorConfig, out serverConfig) == false)
                {
                    DisplayWarningMessage("Please select an emulator/server.");
                    return;
                }

                setting.UseSecureAuthentication = c_CheckBox_SecureAuthentication.Checked;
                setting.AuthenticationPort      = authenticationPort;

                if (c_ComboBox_Servers.SelectedIndex == -1)
                {
                    setting.Hostname = c_ComboBox_Servers.Text;
                }
                else
                {
                    setting.Hostname = serverConfig.Hostname;
                }

                setting.LaunchName       = emulatorConfig.GetLaunchName();
                setting.UseClientDetours = c_CheckBox_ClientDetours.Checked;
                setting.UseLocalCert     = c_CheckBox_LocalCert.Checked;


                // Save State
                Properties.Settings.Default.UseClientDetours = c_CheckBox_ClientDetours.Checked;
                Properties.Settings.Default.LastEmulatorName = emulatorConfig.Name;
                Properties.Settings.Default.UseLocalCert     = c_CheckBox_LocalCert.Checked;

                if (c_ComboBox_Servers.Items.Count > 0 && c_ComboBox_Servers.SelectedIndex == -1)
                {
                    Properties.Settings.Default.LastServerName = c_ComboBox_Servers.Text;
                }
                else
                {
                    Properties.Settings.Default.LastServerName = serverConfig.Hostname;
                }
                Properties.Settings.Default.UseSecureAuthentication = c_CheckBox_SecureAuthentication.Checked;
                Properties.Settings.Default.AuthenticationPort      = c_TextBox_Port.Text;
                Properties.Settings.Default.Save();

                // Launcher Server/Client
                Launcher launcher = new Launcher(setting);
                launcher.Launch();

                // Close Launcher
                this.Close();
            }
            catch (Exception e)
            {
                DisplayErrorMessage("Error while launching client.", e);
            }
        }
コード例 #4
0
 public Launcher(LaunchSetting setting)
 {
     if (setting == null) throw new ArgumentNullException("setting");
     m_Setting = setting;
 }