public static void enchant_dict_remove(SafeDictionaryHandle dict, string word) { using (Utf8Marshaller utf8Word = new Utf8Marshaller(word)) { enchant_dict_remove(dict, utf8Word.MarshalledValue, utf8Word.MarshalledSize); } }
public static int enchant_dict_check(SafeDictionaryHandle dict, string word) { using (Utf8Marshaller utf8Word = new Utf8Marshaller(word)) { return(enchant_dict_check(dict, utf8Word.MarshalledValue, utf8Word.MarshalledSize)); } }
private Dictionary CreatePwlDictionary(string pwlFile) { SafeDictionaryHandle handle = Bindings.enchant_broker_request_pwl_dict(this._handle, pwlFile); VerifyNoErrors(); if (handle.IsInvalid) { throw new ApplicationException("Unable to create pwl file " + pwlFile); } return(CreateAndRegisterDictionary(handle, this._pwlDictionaryCache, pwlFile)); }
internal Dictionary(SafeDictionaryHandle handle) { if (handle == null) { throw new ArgumentNullException("handle"); } if (handle.IsInvalid) { throw new ArgumentException("handle is invalid"); } _handle = handle; }
internal Dictionary(SafeDictionaryHandle handle) { if (handle == null) { throw new ArgumentNullException("handle"); } if (handle.IsInvalid) { throw new ArgumentException("handle is invalid"); } _handle = handle; }
private Dictionary CreateDictionary(string language_tag) { SafeDictionaryHandle handle = Bindings.enchant_broker_request_dict(this._handle, language_tag); VerifyNoErrors(); if (handle.IsInvalid) { throw new ApplicationException("There is no provider that supplies a dictionary for " + language_tag); } return(CreateAndRegisterDictionary(handle, this._dictionaryCache, language_tag)); }
private Dictionary CreateAndRegisterDictionary(SafeDictionaryHandle handle, IDictionary <string, WeakReference> cache, string language_tag) { Dictionary dictionary; dictionary = new Dictionary(handle); dictionary.Disposed += OnDictionaryDisposed; // always store the dictionaries we have created // so that we can dispose of them cleanly and give a // better error message (ObjectDisposed) instead of a crash // if someone tries to use a dictionary after the broker // that created it has been disposed. cache[language_tag] = new WeakReference(dictionary); return(dictionary); }
public static void enchant_dict_store_replacement(SafeDictionaryHandle dict, string mis, string cor) { using ( Utf8Marshaller utf8Mis = new Utf8Marshaller(mis), utf8Cor = new Utf8Marshaller(cor)) { enchant_dict_store_replacement(dict, utf8Mis.MarshalledValue, utf8Mis.MarshalledSize, utf8Cor.MarshalledValue, utf8Cor.MarshalledSize); } }
public static List <string> enchant_dict_suggest(SafeDictionaryHandle dict, string word) { int suggsCount; IntPtr suggs; using (Utf8Marshaller utf8Word = new Utf8Marshaller(word)) { suggs = enchant_dict_suggest(dict, utf8Word.MarshalledValue, utf8Word.MarshalledSize, out suggsCount); } List <string> result = Utf8Marshaller.MarshalFromUtf8Array(suggs, suggsCount); enchant_dict_free_string_list(dict, suggs); return(result); }
public static void enchant_dict_describe(SafeDictionaryHandle dict, EnchantDictDescribeDelegate describe) { enchant_dict_describe(dict, delegate(IntPtr lang_tag, IntPtr provider_name, IntPtr provider_desc, IntPtr provider_dll_file, IntPtr user_data) { ProviderInfo provider = new ProviderInfo( Utf8Marshaller.MarshalFromUtf8(provider_name), Utf8Marshaller.MarshalFromUtf8(provider_desc), Utf8Marshaller.MarshalFromUtf8(provider_dll_file)); DictionaryInfo dictionary = new DictionaryInfo( Utf8Marshaller.MarshalFromUtf8(lang_tag), provider); describe(dictionary); }, IntPtr.Zero); }
private static extern void enchant_dict_free_string_list(SafeDictionaryHandle dict, IntPtr string_list);
private static extern void enchant_dict_describe(SafeDictionaryHandle dict, [MarshalAs(UnmanagedType.FunctionPtr)] EnchantDictDescribeFn enchantDictDescribeFn, IntPtr user_data);
public static List<string> enchant_dict_suggest(SafeDictionaryHandle dict, string word) { int suggsCount; IntPtr suggs; using (Utf8Marshaller utf8Word = new Utf8Marshaller(word)) { suggs = enchant_dict_suggest(dict, utf8Word.MarshalledValue, utf8Word.MarshalledSize, out suggsCount); } List<string> result = Utf8Marshaller.MarshalFromUtf8Array(suggs, suggsCount); enchant_dict_free_string_list(dict, suggs); return result; }
private static extern IntPtr enchant_dict_get_error_(SafeDictionaryHandle dict);
private Dictionary CreateAndRegisterDictionary(SafeDictionaryHandle handle, IDictionary<string, WeakReference> cache, string language_tag) { Dictionary dictionary; dictionary = new Dictionary(handle); dictionary.Disposed += OnDictionaryDisposed; // always store the dictionaries we have created // so that we can dispose of them cleanly and give a // better error message (ObjectDisposed) instead of a crash // if someone tries to use a dictionary after the broker // that created it has been disposed. cache[language_tag] = new WeakReference(dictionary); return dictionary; }
private static extern void enchant_dict_remove_from_session(SafeDictionaryHandle dict, IntPtr word, int len);
private static extern void enchant_dict_store_replacement(SafeDictionaryHandle dict, IntPtr mis, int mis_len, IntPtr cor, int cor_len);
private static extern IntPtr enchant_dict_suggest(SafeDictionaryHandle dict, IntPtr word, int len, [MarshalAs(UnmanagedType.U4)] out int out_n_suggs);
private static extern void enchant_dict_add_to_session(SafeDictionaryHandle dict, IntPtr word, int len);
private static extern void enchant_dict_remove_from_session(SafeDictionaryHandle dict, IntPtr word, int len);
private static extern void enchant_dict_store_replacement(SafeDictionaryHandle dict, IntPtr mis, int mis_len, IntPtr cor, int cor_len);
private static extern int enchant_dict_is_removed(SafeDictionaryHandle dict, IntPtr word, int len);
private static extern IntPtr enchant_dict_get_error_(SafeDictionaryHandle dict);
private static extern void enchant_dict_free_string_list(SafeDictionaryHandle dict, IntPtr string_list);
private static extern void enchant_dict_add_to_session(SafeDictionaryHandle dict, IntPtr word, int len);
private static extern void enchant_dict_describe(SafeDictionaryHandle dict, [MarshalAs(UnmanagedType.FunctionPtr)] EnchantDictDescribeFn enchantDictDescribeFn, IntPtr user_data);
public static void enchant_dict_describe(SafeDictionaryHandle dict, EnchantDictDescribeDelegate describe) { enchant_dict_describe(dict, delegate(IntPtr lang_tag, IntPtr provider_name, IntPtr provider_desc, IntPtr provider_dll_file, IntPtr user_data) { ProviderInfo provider = new ProviderInfo( Utf8Marshaller.MarshalFromUtf8(provider_name), Utf8Marshaller.MarshalFromUtf8(provider_desc), Utf8Marshaller.MarshalFromUtf8(provider_dll_file)); DictionaryInfo dictionary = new DictionaryInfo( Utf8Marshaller.MarshalFromUtf8(lang_tag), provider); describe(dictionary); }, IntPtr.Zero); }
public static void enchant_dict_remove_from_session(SafeDictionaryHandle dict, string word) { using (Utf8Marshaller utf8Word = new Utf8Marshaller(word)) { enchant_dict_remove_from_session(dict, utf8Word.MarshalledValue, utf8Word.MarshalledSize); } }
private static extern int enchant_dict_is_removed(SafeDictionaryHandle dict, IntPtr word, int len);
private static extern int enchant_dict_check(SafeDictionaryHandle dict, IntPtr word, int len);
public static void enchant_dict_store_replacement(SafeDictionaryHandle dict, string mis, string cor) { using ( Utf8Marshaller utf8Mis = new Utf8Marshaller(mis), utf8Cor = new Utf8Marshaller(cor)) { enchant_dict_store_replacement(dict, utf8Mis.MarshalledValue, utf8Mis.MarshalledSize, utf8Cor.MarshalledValue, utf8Cor.MarshalledSize); } }
public static string enchant_dict_get_error(SafeDictionaryHandle dict) { IntPtr message = enchant_dict_get_error_(dict); return Utf8Marshaller.MarshalFromUtf8(message); }
public static string enchant_dict_get_error(SafeDictionaryHandle dict) { IntPtr message = enchant_dict_get_error_(dict); return(Utf8Marshaller.MarshalFromUtf8(message)); }
private static extern IntPtr enchant_dict_suggest(SafeDictionaryHandle dict, IntPtr word, int len, [MarshalAs(UnmanagedType.U4)] out int out_n_suggs);
public static int enchant_dict_is_removed(SafeDictionaryHandle dict, string word) { using (Utf8Marshaller utf8Word = new Utf8Marshaller(word)) { return enchant_dict_is_removed(dict, utf8Word.MarshalledValue, utf8Word.MarshalledSize); } }
private static extern int enchant_dict_check(SafeDictionaryHandle dict, IntPtr word, int len);