public static List <Slog> GenerateSlogs(bool isGlasFirst, bool IsGlasSecond) { List <Slog> slogsList = new List <Slog>(); List <char> glassSymbols = SymbolInfo.GetBaseCollectionSymbols(true); List <char> soglassSymbols = SymbolInfo.GetBaseCollectionSymbols(false); List <char> firstList = (isGlasFirst ? glassSymbols : soglassSymbols); List <char> secondList = (isGlasFirst ? (IsGlasSecond ? glassSymbols : soglassSymbols) : glassSymbols); for (int i = 0; i < firstList.Count; i++) { char ic = firstList[i]; for (int y = 0; y < secondList.Count; y++) { char yc = secondList[y]; if (ic != yc) { if (ic == 'й') { continue; } if (yc == 'й' && !isGlasFirst) { continue; } Slog slg = new Slog(String.Format("{0}{1}", ic, yc)); slogsList.Add(slg); } } } return(slogsList); }
private void SlogZvuk_CB_TextChanged(object sender, EventArgs e) { string s = SlogZvuk_CB.Text.Trim(); if (s.Length == 1) { //найдем совпадения в списке доступных букв слогов bool found = false; List <char> glasList = SymbolInfo.GetBaseCollectionSymbols(true); for (int i = 0; i < glasList.Count; i++) { if (s[0] == glasList[i]) { found = true; break; } } if (!found) { List <char> soglasList = SymbolInfo.GetBaseCollectionSymbols(false); for (int y = 0; y < soglasList.Count; y++) { if (s[0] == soglasList[y]) { found = true; break; } } } if (found) { Settings.SlogFilter = s[0]; } else { Settings.SlogFilter = null; MessageBox.Show("Вводите только 1 символ буквы из русского алфавита"); SlogZvuk_CB.Text = ""; } } else { if (s.Length > 1) { MessageBox.Show("Вводите только 1 символ буквы из русского алфавита"); } SlogZvuk_CB.Text = ""; Settings.SlogFilter = null; } RenderCurrent(); }