Ejemplo n.º 1
0
        void LoadConfig()
        {
            try
            {
                string fileName = Path.Combine(Program.MainForm.UserDir, "sru\\sru.xml");
                _config = SruConfig.From(fileName);

                var servers = _config.ListTargets("*");
                this.Invoke((Action)(() =>
                {
                    this.comboBox_server.Items.Clear();
                    foreach (var server in servers)
                    {
                        this.comboBox_server.Items.Add(server.Name);
                    }
                }));
            }
            catch (Exception ex)
            {
                this.Invoke((Action)(() =>
                {
                    MessageBox.Show(this, $"装载 sru.xml 出现异常: {ex.Message}");
                }));
            }
        }
Ejemplo n.º 2
0
        public static SruConfig From(string fileName)
        {
            SruConfig result = new SruConfig(fileName);

            return(result);
        }