Exemple #1
0
 public static int enchant_broker_dict_exists(SafeBrokerHandle broker, string tag)
 {
     using (Utf8Marshaller utf8Tag = new Utf8Marshaller(tag))
     {
         return(enchant_broker_dict_exists(broker, utf8Tag.MarshalledValue));
     }
 }
Exemple #2
0
 public static int enchant_broker_dict_exists(SafeBrokerHandle broker, string tag)
 {
     using (Utf8Marshaller utf8Tag = new Utf8Marshaller(tag))
     {
         return enchant_broker_dict_exists(broker, utf8Tag.MarshalledValue);
     }
 }
Exemple #3
0
		public static SafeDictionaryHandle enchant_broker_request_pwl_dict(SafeBrokerHandle broker,
																																			 string pwl)
		{
			using (Utf8Marshaller utf8Pwl = new Utf8Marshaller(pwl))
			{
				IntPtr handle = enchant_broker_request_pwl_dict(broker, utf8Pwl.MarshalledValue);
				return new SafeDictionaryHandle(broker, handle);
			}
		}
Exemple #4
0
 public static SafeDictionaryHandle enchant_broker_request_pwl_dict(SafeBrokerHandle broker,
                                                                    string pwl)
 {
     using (Utf8Marshaller utf8Pwl = new Utf8Marshaller(pwl))
     {
         IntPtr handle = enchant_broker_request_pwl_dict(broker, utf8Pwl.MarshalledValue);
         return(new SafeDictionaryHandle(broker, handle));
     }
 }
Exemple #5
0
 public static void enchant_broker_set_ordering(SafeBrokerHandle broker,
                                                string tag,
                                                string ordering)
 {
     using (
         Utf8Marshaller utf8Tag = new Utf8Marshaller(tag),
         utf8Ordering = new Utf8Marshaller(ordering))
     {
         enchant_broker_set_ordering(broker,
                                     utf8Tag.MarshalledValue,
                                     utf8Ordering.MarshalledValue);
     }
 }
Exemple #6
0
 public static void enchant_broker_describe(SafeBrokerHandle broker,
                                            EnchantBrokerDescribeDelegate describe)
 {
     enchant_broker_describe(broker,
                             delegate(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));
         describe(provider);
     },
                             IntPtr.Zero);
 }
Exemple #7
0
        public static void enchant_broker_describe(SafeBrokerHandle broker,
																							 EnchantBrokerDescribeDelegate describe)
        {
            enchant_broker_describe(broker,
                                                            delegate(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));
                                                                    describe(provider);
                                                                },
                                                            IntPtr.Zero);
        }
Exemple #8
0
 public Broker()
 {
     try
     {
         _handle = Bindings.enchant_broker_init();
         _isLibEnchantAvailable = true;
     }
     catch (DllNotFoundException)
     {
         _isLibEnchantAvailable = false;
     }
     if (_isLibEnchantAvailable == true)
     {
         VerifyNoErrors();
         if (_handle.IsInvalid)
         {
             throw new ApplicationException("Unable to initialize broker");
         }
     }
     _dictionaryCache    = new Dictionary <string, WeakReference>();
     _pwlDictionaryCache = new Dictionary <string, WeakReference>();
 }
Exemple #9
0
		public Broker()
		{
            try
            {
                _handle = Bindings.enchant_broker_init();
                _isLibEnchantAvailable = true;
            }
            catch (DllNotFoundException)
            {
                _isLibEnchantAvailable = false;
            }
            if (_isLibEnchantAvailable == true)
            {
                VerifyNoErrors();
                if (_handle.IsInvalid)
                {
                    throw new ApplicationException("Unable to initialize broker");
                }
            }
		    _dictionaryCache = new Dictionary<string, WeakReference>();
            _pwlDictionaryCache = new Dictionary<string, WeakReference>();
		}
Exemple #10
0
 public static void enchant_broker_list_dicts(SafeBrokerHandle broker,
                                              EnchantDictDescribeDelegate describe)
 {
     enchant_broker_list_dicts(broker,
                               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 SafeDictionaryHandle(SafeBrokerHandle broker, IntPtr handle)
     : base(IntPtr.Zero, true)
 {
     _broker = broker;
     SetHandle(handle);
 }
Exemple #12
0
 private static extern void enchant_broker_set_ordering(SafeBrokerHandle broker,
                                                        IntPtr tag,
                                                        IntPtr ordering);
Exemple #13
0
        public static void enchant_broker_list_dicts(SafeBrokerHandle broker,
																								 EnchantDictDescribeDelegate describe)
        {
            enchant_broker_list_dicts(broker,
                                                                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);
        }
Exemple #14
0
 private static extern int enchant_broker_dict_exists(SafeBrokerHandle broker, IntPtr tag);
Exemple #15
0
 public static extern void enchant_broker_free_dict(SafeBrokerHandle broker, IntPtr dict);
Exemple #16
0
        public static void enchant_broker_set_ordering(SafeBrokerHandle broker,
																									 string tag,
																									 string ordering)
        {
            using (
                Utf8Marshaller utf8Tag = new Utf8Marshaller(tag),
                                             utf8Ordering = new Utf8Marshaller(ordering))
            {
                enchant_broker_set_ordering(broker,
                                                                        utf8Tag.MarshalledValue,
                                                                        utf8Ordering.MarshalledValue);
            }
        }
Exemple #17
0
 private static extern IntPtr enchant_broker_request_pwl_dict(
     SafeBrokerHandle broker, IntPtr pwl);
Exemple #18
0
 private static extern void enchant_broker_list_dicts(SafeBrokerHandle broker,
                                                      [MarshalAs(UnmanagedType.FunctionPtr)] EnchantDictDescribeFn
                                                      enchantDictDescribeFn,
                                                      IntPtr user_data);
Exemple #19
0
 private static extern int enchant_broker_dict_exists(SafeBrokerHandle broker, IntPtr tag);
Exemple #20
0
        private static extern void enchant_broker_list_dicts(SafeBrokerHandle broker,
																												 [MarshalAs(UnmanagedType.FunctionPtr)] EnchantDictDescribeFn
																													 enchantDictDescribeFn,
																												 IntPtr user_data);
Exemple #21
0
 public static extern string enchant_broker_get_error(SafeBrokerHandle broker);
Exemple #22
0
 public static extern void enchant_broker_free_dict(SafeBrokerHandle broker, IntPtr dict);
Exemple #23
0
        private static extern IntPtr enchant_broker_request_pwl_dict(
			SafeBrokerHandle broker, IntPtr pwl);
Exemple #24
0
        private static extern void enchant_broker_set_ordering(SafeBrokerHandle broker,
																													 IntPtr tag,
																													 IntPtr ordering);
Exemple #25
0
 public SafeDictionaryHandle(SafeBrokerHandle broker, IntPtr handle)
     : base(IntPtr.Zero, true)
 {
     _broker = broker;
     SetHandle(handle);
 }
Exemple #26
0
 public static extern string enchant_broker_get_error(SafeBrokerHandle broker);