void ConfigLoad(object sender, EventArgs e) { Config_File_Reader cfg_reader = new Config_File_Reader(); if (cfg_reader.exists) { YRC_Config file_cfg = cfg_reader.get_cfg(); this.TB_IP.Text = file_cfg.ip; this.TB_MV.Text = file_cfg.maximum_volume.ToString(); this.TB_SP.Text = file_cfg.silent_preset.ToString(); this.TB_MP.Text = file_cfg.medium_preset.ToString(); this.TB_LP.Text = file_cfg.loud_preset.ToString(); } }
public Config_File_Reader() { if (exists) { string[] cfg = File.ReadAllLines(cwd + config_file); string ip; int mv; int sp; int mp; int lp; // this thing is greedy, so please ensure that the config is always in the proper order ip = cfg[0].Substring(cfg[0].IndexOf("=") + 1); mv = Convert.ToInt32(cfg[1].Substring(cfg[1].IndexOf("=") + 1)); sp = Convert.ToInt32(cfg[2].Substring(cfg[2].IndexOf("=") + 1)); mp = Convert.ToInt32(cfg[3].Substring(cfg[3].IndexOf("=") + 1)); lp = Convert.ToInt32(cfg[4].Substring(cfg[4].IndexOf("=") + 1)); file_cfg = new YRC_Config(ip, mv, sp, mp, lp); } }
public MainForm() { // // The InitializeComponent() call is required for Windows Forms designer support. // InitializeComponent(); // // TODO: Add constructor code after the InitializeComponent() call. // cfg_reader = new Config_File_Reader(); Input_XML.ReadXml("input_list.xml"); bindingSource1.DataSource = Input_XML.Tables[0]; CB_Input.ValueMember = "value"; CB_Input.DisplayMember = "name"; if (cfg_reader.exists) { file_cfg = cfg_reader.get_cfg(); maximum_volume = file_cfg.maximum_volume; TRB_Volume_Free.Maximum = maximum_volume; TB_MaxVol.Text = maximum_volume.ToString(); IP = file_cfg.ip; sp = file_cfg.silent_preset; mp = file_cfg.medium_preset; lp = file_cfg.loud_preset; update_looper = get_new_basic_updater(); update_looper.Start(); } else { MessageBox.Show("No config file detected - please setup YRGUI", "Missing Config-File", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1); Config cfg_form = new Config(); cfg_form.Show(); } STST_Label_IP.Text = IP; }