
TX Spell .NET 3.0 provides a new function to load dictionaries from memory. This allows you to add dictionaries to the DictionaryCollection from embedded resources or shared databases.
The OpenOfficeDictionary class got a new constructor accepting a dictionary (.dic) and an affix (.aff) file as a string array. The following code shows how to load a dictionary from embedded resources:
List dic = new List(); List aff = new List(); Assembly _assembly; StreamReader _textStreamReader; _assembly = Assembly.GetExecutingAssembly(); string line; _textStreamReader = new StreamReader( _assembly.GetManifestResourceStream("tx_spell_open_dict_resource.en_US.dic")); while ((line = _textStreamReader.ReadLine()) != null) { dic.Add(line); } _textStreamReader = new StreamReader( _assembly.GetManifestResourceStream("tx_spell_open_dict_resource.en_US.aff")); while ((line = _textStreamReader.ReadLine()) != null) { aff.Add(line); } OpenOfficeDictionary dic_enUS = new OpenOfficeDictionary( dic.ToArray(), aff.ToArray(), new CultureInfo("en-US")); txSpellChecker1.Dictionaries.Add(dic_enUS);
This is just another great idea of TX Spell .NET 3.0. Find out more about the new release in the What's New section.