Ejemplo n.º 1
0
 private void ReleaseUnmangedResources()
 {
     if (_hunspellHandle != IntPtr.Zero)
     {
         Unamanaged.Hunspell_destroy(_hunspellHandle);
         _hunspellHandle = IntPtr.Zero;
     }
 }
Ejemplo n.º 2
0
 public LinuxHunspell(string affDirectory, string dicDictory)
 {
     //Also search - /usr/share/hunspell
     try {
         _hunspellHandle = Unamanaged.Hunspell_create(affDirectory, dicDictory);
     } catch {
         System.Windows.Forms.MessageBox.Show("Unable to start hunspell spell checker - make sure hunspell is installed!");
         throw;
     }
 }
Ejemplo n.º 3
0
        private object GetDllType(Type type, string name)
        {
            IntPtr address = Unamanaged.GetProcAddress(_libDll, name);

            if (address != IntPtr.Zero)
            {
                return(Marshal.GetDelegateForFunctionPointer(address, type));
            }
            return(null);
        }
Ejemplo n.º 4
0
        private void ReleaseUnmangedResources()
        {
            try {
                if (_libVoikko != IntPtr.Zero)
                {
                    _voikkoTerminate(_libVoikko);
                    _libVoikko = IntPtr.Zero;
                }

                if (_libDll != IntPtr.Zero)
                {
                    Unamanaged.FreeLibrary(_libDll);
                    _libDll = IntPtr.Zero;
                }
            } catch {
            }
        }
Ejemplo n.º 5
0
        public override List <string> Suggest(string word)
        {
            IntPtr        pointerToAddressStringArray = Marshal.AllocHGlobal(IntPtr.Size);
            int           resultCount        = Unamanaged.Hunspell_suggest(_hunspellHandle, pointerToAddressStringArray, word);
            IntPtr        addressStringArray = Marshal.ReadIntPtr(pointerToAddressStringArray);
            List <string> results            = new List <string>();

            for (int i = 0; i < resultCount; i++)
            {
                IntPtr addressCharArray = Marshal.ReadIntPtr(addressStringArray, i * IntPtr.Size);
                string suggestion       = Marshal.PtrToStringAuto(addressCharArray);
                if (!string.IsNullOrEmpty(suggestion))
                {
                    results.Add(suggestion);
                }
            }
            Unamanaged.Hunspell_free_list(_hunspellHandle, pointerToAddressStringArray, resultCount);
            Marshal.FreeHGlobal(pointerToAddressStringArray);

            return(results);
        }
Ejemplo n.º 6
0
 public override bool Spell(string word)
 {
     return(Unamanaged.Hunspell_spell(_hunspellHandle, word) != 0);
 }
Ejemplo n.º 7
0
 public MacHunspell(string affDirectory, string dicDictory)
 {
     //Also search - /usr/share/hunspell
     _hunspellHandle = Unamanaged.Hunspell_create(affDirectory, dicDictory);
 }