ACAT.Extensions.Default.SpellCheckers.SpellChecker.Init C# (CSharp) Method

Init() public method

Initializes the spell checker. Reads the spell check file and loads the spellings into the list
public Init ( ) : bool
return bool
        public bool Init()
        {
            bool retVal = true;

            var spellingFile = UserManager.GetFullPath(SpellCheckFileName);

            var doc = new XmlDocument();

            try
            {
                if (File.Exists(spellingFile))
                {
                    doc.Load(spellingFile);

                    var spellingNodes = doc.SelectNodes("/ACAT/Spellings/Spelling");

                    if (spellingNodes != null)
                    {
                        // load all the spellings
                        foreach (XmlNode node in spellingNodes)
                        {
                            createAndAdd(node);
                        }
                    }
                }
                else
                {
                    Log.Debug("Spelling file " + spellingFile + " does not exist");
                    retVal = false;
                }
            }
            catch (Exception ex)
            {
                Log.Debug("Error processing spelling file " + spellingFile + ". Exception: " + ex.ToString());
                retVal = false;
            }

            return retVal;
        }