private void LoadDictionary() { var rd = new RelativeDirectory(); rd.UpTo("CodeClub-AnagramSolver"); rd.Down("CodeGolf.AnagramSolver"); string filename = Path.Combine(rd.Path, @"words"); _dictionary = new Dictionary(filename); _dictionary.Load(); _anagrams = new Anagrams(_dictionary); _anagrams.Generate(); }
public IList<String> BuildDictionaryFromFile() { var rd = new RelativeDirectory(); rd.UpTo("CodeClub-AnagramSolver"); rd.Down("CodeGolf.AnagramSolver"); string filename = Path.Combine(rd.Path, @"words"); var words = new List<String>(); using (var sr = new StreamReader(filename)) { String line; while ((line = sr.ReadLine()) != null) { words.Add(line.ToLower()); } } return words.Distinct().ToList(); }