Exemplo n.º 1
0
        private void ReadSettingControl(SettingControl setCtrl)
        {
            //Info about section stored in Tag property
            var section = setCtrl.Tag.ToString();

            //Reading values to combobox
            var devName = RSIni.Read("Driver", section);

            (setCtrl.Controls["deviceCombo"] as ComboBox).SelectedItem = devName != string.Empty ? devName : "None";

            //Reading values to checkboxes
            (setCtrl.Controls["enableEndpointCheck"] as CheckBox).Checked = RSIni.Read("EnableSoftwareEndpointVolumeControl", section) == "1";
            (setCtrl.Controls["enableMasterCheck"] as CheckBox).Checked   = RSIni.Read("EnableSoftwareMasterVolumeControl", section) == "1";

            //Reading values to numeric
            decimal.TryParse(RSIni.Read("SoftwareMasterVolumePercent", section), out decimal volumePercent);
            (setCtrl.Controls["volumeNumeric"] as NumericUpDown).Value = volumePercent;


            //Exclude reading from Output section, there's no channel setting
            if (section != "Asio.Output")
            {
                decimal.TryParse(RSIni.Read("Channel", section), out decimal channelValue);
                (setCtrl.Controls["channelPanel"].Controls["channelNumeric"] as NumericUpDown).Value = channelValue;
            }
        }
Exemplo n.º 2
0
        private void WriteSettingControl(SettingControl setCtrl)
        {
            //Info about section stored in Tag property
            var section = setCtrl.Tag.ToString();

            //Saving values from combobox
            var devName = (setCtrl.Controls["deviceCombo"] as ComboBox).Text;

            RSIni.Write("Driver", devName != "None" ? devName : string.Empty, section);

            //Saving values from checkboxes
            RSIni.Write("EnableSoftwareEndpointVolumeControl", (setCtrl.Controls["enableEndpointCheck"] as CheckBox).Checked ? "1" : "0", section);
            RSIni.Write("EnableSoftwareMasterVolumeControl", (setCtrl.Controls["enableMasterCheck"] as CheckBox).Checked ? "1" : "0", section);

            //Saving values from numeric
            RSIni.Write("SoftwareMasterVolumePercent", (setCtrl.Controls["volumeNumeric"] as NumericUpDown).Value.ToString(), section);

            //Exclude writing to Output section, there's no channel setting
            if (section != "Asio.Output")
            {
                RSIni.Write("Channel", (setCtrl.Controls["channelPanel"].Controls["channelNumeric"] as NumericUpDown).Value.ToString(), section);
            }
        }