Ejemplo n.º 1
0
        /// <summary>
        /// Loads data vom current config to the form
        /// </summary>
        private void loadConfig()
        {
            if (currentConfig == null)
            {
                return;
            }

            //Full Server Name and Short Server Name
            this.full_server_name_textbox.Text  = currentConfig.ServerName;
            this.short_server_name_textbox.Text = currentConfig.ServerNameShort;

            switch (currentConfig.ServerType)
            {
            case DOL.eGameServerType.GST_PvP:
                this.game_type_selectbox.SelectedItem = "PvP";
                break;

            case DOL.eGameServerType.GST_PvE:
                this.game_type_selectbox.SelectedItem = "PvE";
                break;

            case DOL.eGameServerType.GST_Roleplay:
                this.game_type_selectbox.SelectedItem = "Roleplay";
                break;

            case DOL.eGameServerType.GST_Casual:
                this.game_type_selectbox.SelectedItem = "Casual";
                break;

            case DOL.eGameServerType.GST_Test:
                this.game_type_selectbox.SelectedItem = "Test";
                break;

            case DOL.eGameServerType.GST_Normal:
            default:
                this.game_type_selectbox.SelectedItem = "Normal";
                break;
            }

            //Parse Auto Account creation
            this.auto_account_creation_checkbox.Checked = currentConfig.AutoAccountCreation;

            //Ip and Port settings
            this.ip_textbox.Text                   = currentConfig.IP.ToString();
            this.port_textbox.Text                 = currentConfig.Port.ToString();
            this.udp_port_textbox.Text             = currentConfig.UDPPort.ToString();
            this.detect_region_ip_checkbox.Checked = currentConfig.DetectRegionIP;
            this.region_ip_textbox.Text            = currentConfig.RegionIP.ToString();
            this.region_port_textbox.Text          = currentConfig.RegionPort.ToString();

            //Database Settings
            this.database_autosave_checkbox.Checked      = currentConfig.AutoSave;
            this.database_autosave_interval_textbox.Text = currentConfig.SaveInterval.ToString();

            switch (currentConfig.DBType)
            {
            case ConnectionType.DATABASE_XML:
                this.database_type_selectbox.SelectedItem = "XML";
                this.xml_path_textbox.Text = currentConfig.DBConnectionString;
                break;

            case ConnectionType.DATABASE_SQLITE:
                this.database_type_selectbox.SelectedItem = "SQLITE";
                this.xml_path_textbox.Text = currentConfig.DBConnectionString;
                break;

            case ConnectionType.DATABASE_MYSQL:
            default:
                this.database_type_selectbox.SelectedItem = "MySQL";
                MySqlConnectionStringBuilder sb = new MySqlConnectionStringBuilder(currentConfig.DBConnectionString);
                this.mysql_host_textbox.Text          = sb.Server;
                this.mysql_port_textbox.Text          = sb.Port.ToString();
                this.mysql_database_name_textbox.Text = sb.Database;
                this.mysql_username_textbox.Text      = sb.UserID;
                this.mysql_password_textbox.Text      = sb.Password;

                break;
            }

            //Load extra options
            this.extraOptions = DOLConfigParser.loadExtraOptions();
            if (this.extraOptions != null)
            {
                extra_options_datagrid.DataSource = this.extraOptions;
            }
        }
Ejemplo n.º 2
0
        private void loadConfig()
        {
            if (currentConfig == null)
            {
                return;
            }

            //Full Server Name and Short Server Name
            full_server_name_textbox.Text  = currentConfig.ServerName;
            short_server_name_textbox.Text = currentConfig.ServerNameShort;

            switch (currentConfig.ServerType)
            {
            case DOL.eGameServerType.GST_PvP:
                game_type_selectbox.SelectedItem = "PvP";
                break;

            case DOL.eGameServerType.GST_PvE:
                game_type_selectbox.SelectedItem = "PvE";
                break;

            case DOL.eGameServerType.GST_Roleplay:
                game_type_selectbox.SelectedItem = "Roleplay";
                break;

            case DOL.eGameServerType.GST_Casual:
                game_type_selectbox.SelectedItem = "Casual";
                break;

            case DOL.eGameServerType.GST_Test:
                game_type_selectbox.SelectedItem = "Test";
                break;

            case DOL.eGameServerType.GST_Normal:
            default:
                game_type_selectbox.SelectedItem = "Normal";
                break;
            }

            //Parse Auto Account creation
            auto_account_creation_checkbox.Checked = currentConfig.AutoAccountCreation;

            //Ip and Port settings
            ip_textbox.Text                   = currentConfig.IP.ToString();
            port_textbox.Text                 = currentConfig.Port.ToString();
            udp_port_textbox.Text             = currentConfig.UDPPort.ToString();
            detect_region_ip_checkbox.Checked = currentConfig.DetectRegionIP;
            region_ip_textbox.Text            = currentConfig.RegionIP.ToString();
            region_port_textbox.Text          = currentConfig.RegionPort.ToString();

            //Database Settings
            database_autosave_checkbox.Checked      = currentConfig.AutoSave;
            database_autosave_interval_textbox.Text = currentConfig.SaveInterval.ToString();

            switch (currentConfig.DBType)
            {
            case ConnectionType.DATABASE_XML:
                database_type_selectbox.SelectedItem = "XML";
                xml_path_textbox.Text = currentConfig.DBConnectionString;
                break;

            case ConnectionType.DATABASE_SQLITE:
                database_type_selectbox.SelectedItem = "SQLite";
                xml_path_textbox.Text = currentConfig.DBConnectionString;
                break;

            case ConnectionType.DATABASE_MYSQL:
            default:
                database_type_selectbox.SelectedItem = "MySQL";
                var dbConfig = new DbConfig(currentConfig.DBConnectionString);
                mysql_host_textbox.Text          = dbConfig.GetValueOf("Server");
                mysql_port_textbox.Text          = dbConfig.GetValueOf("Port");
                mysql_database_name_textbox.Text = dbConfig.GetValueOf("Database");
                mysql_username_textbox.Text      = dbConfig.GetValueOf("UserID");
                mysql_password_textbox.Text      = dbConfig.GetValueOf("Password");
                break;
            }

            //Load extra options
            extraOptions = DOLConfigParser.loadExtraOptions();
            if (extraOptions != null)
            {
                extra_options_datagrid.DataSource = extraOptions;
            }
        }