private void ffmpeg_Live_Load(object sender, EventArgs e) { try { var appSettings = ConfigurationManager.AppSettings; if (appSettings["Live_audiomode"] == null) { AddUpdateAppSettings("Live_audiomode", "0"); AudioMode.SelectedIndex = 0; } else { switch (appSettings["Live_audiomode"]) { case "0": AudioMode.SelectedIndex = 0; AudioBox.Hide(); uiLabel8.Hide(); uiLabel7.Show(); break; case "1": AudioMode.SelectedIndex = 1; AudioBox.Show(); uiLabel8.Show(); uiLabel7.Hide(); break; default: ShowErrorDialog(@"正常情况看不到这个,出现该弹窗请带上复现方法到GitHub提issue"); break; } } if (appSettings["Live_audiobit"] == null) { AddUpdateAppSettings("Live_audiobit", "192"); AudioBox.Text = @"192"; } else { AudioBox.Text = appSettings["Live_audiobit"]; } } catch (ConfigurationErrorsException) { Console.WriteLine(@"Error reading app settings"); } }
private void AudioMode_SelectedIndexChanged(object sender, EventArgs e) { switch (AudioMode.SelectedIndex) { case 0: AddUpdateAppSettings("Live_audiomode", "0"); AudioBox.Hide(); uiLabel8.Hide(); uiLabel7.Show(); break; case 1: AddUpdateAppSettings("Live_audiomode", "1"); AudioBox.Show(); uiLabel8.Show(); uiLabel7.Hide(); break; default: ShowErrorDialog(@"正常情况看不到这个,出现该弹窗请带上复现方法到GitHub提issue"); break; } }
private void EncoderBox_Load(object sender, EventArgs e) { try { var appSettings = ConfigurationManager.AppSettings; var result = appSettings["Code_rate_control_mode_selection"] ?? "Not Found"; switch (result) { case "1": uiRadioButton1.Checked = true; break; case "2": uiRadioButton2.Checked = true; break; case "3": uiRadioButton3.Checked = true; break; case "Not Found": AddUpdateAppSettings("Code_rate_control_mode_selection", "1"); uiRadioButton1.Checked = true; break; default: ShowErrorDialog(@"正常情况看不到这个,出现该弹窗请带上复现方法到GitHub提issue"); break; } if (appSettings["Raws_audiomode"] == null) { AddUpdateAppSettings("Raws_audiomode", "0"); AudioMode.SelectedIndex = 0; } else { switch (appSettings["Raws_audiomode"]) { case "0": AudioMode.SelectedIndex = 0; AudioBox.Hide(); uiLabel8.Hide(); uiLabel7.Show(); break; case "1": AudioMode.SelectedIndex = 1; AudioBox.Show(); uiLabel8.Show(); uiLabel7.Hide(); break; default: ShowErrorDialog(@"正常情况看不到这个,出现该弹窗请带上复现方法到GitHub提issue"); break; } } if (appSettings["Raws_audiobit"] == null) { AddUpdateAppSettings("Raws_audiobit", "192"); AudioBox.Text = @"192"; } else { AudioBox.Text = appSettings["Raws_audiobit"]; } if (appSettings["I"] == null) { AddUpdateAppSettings("I", "24"); IBox.Text = @"24"; } else { IBox.Text = appSettings["I"]; } if (appSettings["P"] == null) { AddUpdateAppSettings("P", "26"); PBox.Text = @"26"; } else { PBox.Text = appSettings["P"]; } if (appSettings["B"] == null) { AddUpdateAppSettings("B", "27"); BBox.Text = @"27"; } else { BBox.Text = appSettings["B"]; } if (appSettings["CBR"] == null) { AddUpdateAppSettings("CBR", "3000"); CBRBox.Text = @"3000"; } else { CBRBox.Text = appSettings["CBR"]; } if (appSettings["VBR"] == null) { AddUpdateAppSettings("VBR", "3000"); VBRBox.Text = @"3000"; } else { VBRBox.Text = appSettings["VBR"]; } } catch (ConfigurationErrorsException) { Console.WriteLine(@"Error reading app settings"); } }