private void SaveRegex() { var regexList = new List <string>(); foreach (var c in s_RegexForm.Controls) { var cb = c as CheckBox; if (cb == null) { continue; } Settings.StripDirectoryInFileName = cb.Checked; } foreach (var c in s_RegexForm.Controls) { var flowPanel = c as FlowLayoutPanel; if (flowPanel == null) { continue; } foreach (var c1 in flowPanel.Controls) { var panel = c1 as Panel; if (panel == null) { continue; } foreach (var c2 in panel.Controls) { var t = c2 as TextBox; if (t != null) { if (!string.IsNullOrEmpty(t.Text)) { regexList.Add(t.Text); } } } } } PlaylistForm.UpdatePlaylistWithRegexFilter(regexList, Settings.StripDirectoryInFileName); }