public static WordsLogic GetInstance() { if (wordsLogic == null) { wordsLogic = new WordsLogic(); } return(wordsLogic); }
public GenerateOrCreateTestLogic() { wordsLogic = WordsLogic.GetInstance(); ruWords = new Dictionary <string, bool>(); enWords = new Dictionary <string, bool>(); countSelectWords = 0; LoadDataRu(wordsLogic.GetRuAllWords()); LoadDataEn(wordsLogic.GetEnAllWords()); }
//private delegate void OperationDelegate(string wordForTranslate, string wordByTranslate); //private OperationDelegate operationForWord; private TranslateLogic() { wordsLogic = WordsLogic.GetInstance(); hashtableLang = new Hashtable(); for (int i = 1072; i <= 1103; i++) { hashtableLang.Add(i, "ru-en"); } hashtableLang.Add(1105, "ru-en"); for (int i = 97; i <= 122; i++) { hashtableLang.Add(i, "en-ru"); } symbols = new char[80]; for (int i = 0; i < 7; i++) { symbols[i] = (char)(i + 32); } for (int i = 7; i < 32; i++) { symbols[i] = (char)(i + 33); } for (int i = 32; i < 38; i++) { symbols[i] = (char)(i + 59); } for (int i = 38; i < 44; i++) { symbols[i] = (char)(i + 85); } for (int i = 44; i < 71; i++) { symbols[i] = (char)(i + 117); } for (int i = 71; i < 77; i++) { symbols[i] = (char)(i + 177); } symbols[77] = (char)191; symbols[78] = (char)215; symbols[79] = (char)247; cancelTokenSource = new CancellationTokenSource(); token = cancelTokenSource.Token; }
public (string[], string[]) GetWordsForGame() { List <string> enList = WordsLogic.GetInstance().GetEnAllWords(); int index = 0; int maxWords = enList.Count >= 5 ? 5 : enList.Count; string[] fullWords = new string[maxWords]; string[] clippedWords = new string[maxWords]; while (index != maxWords) { string word = enList[new Random().Next(0, enList.Count)]; if (word.Length > 1 && !fullWords.Contains(word)) { fullWords[index] = word; clippedWords[index] = TrimWord(fullWords[index]); index++; } } return(fullWords, clippedWords); }
public GameLogic() { logicDb = WordsLogic.GetInstance().GetLogicDb(); }