Пример #1
0
        private void Form_Load(object sender, EventArgs e)
        {
            CheckForIllegalCrossThreadCalls = false;//防卡死
            YML yml = new YML();

            yml.Load(File.ReadAllText("config.yml"));                                                                                                                                       //读配置文件
            MoveWindow(this.Handle, int.Parse(yml.GetValue("LocationX")), int.Parse(yml.GetValue("LocationY")), int.Parse(yml.GetValue("Width")), int.Parse(yml.GetValue("Height")), true); //窗口位置和大小
            this.NumFrom.Text                  = yml.GetValue("NumFrom");                                                                                                                   //抽取号码范围从
            this.NumTo.Text                    = yml.GetValue("NumTo");                                                                                                                     //抽取号码范围到
            this.ContinuousBox.Checked         = Convert.ToBoolean(yml.GetValue("Continuous"));                                                                                             //是否连续抽取
            this.ContinuousNumBox.Text         = yml.GetValue("ContinuousNumBox");                                                                                                          //连续抽取个数
            this.ContinuousIntervalBox.Checked = Convert.ToBoolean(yml.GetValue("ContinuousInterval"));                                                                                     //连续抽取间隔时间开关
            this.IntervalTime.Text             = yml.GetValue("IntervalTime");                                                                                                              //连续抽取间隔时间
            this.NoRep.Checked                 = Convert.ToBoolean(yml.GetValue("NoRep"));                                                                                                  //抽取不重复开关
        }
Пример #2
0
        private void ImportConfig_Click(object sender, EventArgs e)
        {
            YML            yml = new YML();         //添加配置文件
            OpenFileDialog O   = new OpenFileDialog //打开打开文件对话框
            {
                Filter = "|*.yml"                   //文件后缀为.yml
            };

            if (O.ShowDialog() == DialogResult.OK)
            {
                yml.Load(File.ReadAllText(O.FileName));                                                                                                                                         //读配置文件
                MoveWindow(this.Handle, int.Parse(yml.GetValue("LocationX")), int.Parse(yml.GetValue("LocationY")), int.Parse(yml.GetValue("Width")), int.Parse(yml.GetValue("Height")), true); //窗口位置和大小
                this.NumFrom.Text                  = yml.GetValue("NumFrom");                                                                                                                   //抽取号码范围从
                this.NumTo.Text                    = yml.GetValue("NumTo");                                                                                                                     //抽取号码范围到
                this.ContinuousBox.Checked         = Convert.ToBoolean(yml.GetValue("Continuous"));                                                                                             //是否连续抽取
                this.ContinuousNumBox.Text         = yml.GetValue("ContinuousNumBox");                                                                                                          //连续抽取个数
                this.ContinuousIntervalBox.Checked = Convert.ToBoolean(yml.GetValue("ContinuousInterval"));                                                                                     //连续抽取间隔时间开关
                this.IntervalTime.Text             = yml.GetValue("IntervalTime");                                                                                                              //连续抽取间隔时间
                this.NoRep.Checked                 = Convert.ToBoolean(yml.GetValue("NoRep"));                                                                                                  //抽取不重复开关
                MessageBox.Show("读取配置文件完成");
            }
        }