Exemplo n.º 1
0
        private void com_ServerInfo_SelectedIndexChanged(object sender, EventArgs e)
        {
            var server = com_ServerInfo.SelectedItem as ServerInfo;

            if (server != null)
            {
                this.txt_Server.Text   = server.address;
                this.txt_ServerID.Text = server.id;
                this.g2DPropertyGrid1.SetSelectedObject(XmlUtil.CloneObject(server));
            }
        }
Exemplo n.º 2
0
        public void Start()
        {
            var config = XmlUtil.CloneObject(Config);

            try
            {
                if (BotLauncher.IsAuto == false)
                {
                    var save = XmlUtil.ObjectToXml(Config);
                    XmlUtil.SaveXML(Application.StartupPath + "/bot_config.save", save);
                }
                var desc = this.prop_Config.SelectedDescriptorObject;
                this.prop_Config.AppendCurrentToHistory();
                try
                {
                    bot_config_history.List = desc.GetOptionalsMap();
                }
                catch { }
                if (BotLauncher.IsAuto == false)
                {
                    var save_history = XmlUtil.ObjectToXml(bot_config_history);
                    XmlUtil.SaveXML(Application.StartupPath + "/bot_config_history.save", save_history);
                }
                this.Hide();
                BotFactory.Instance.Init(config);
            }
            catch (Exception err)
            {
                MessageBox.Show("初始化失败: " + err.Message);
                this.Show();
                return;
            }
            LastConfig = config;
            if (m_OnStart != null)
            {
                m_OnStart.Invoke(this, config);
            }
        }