示例#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));
     }
 }
示例#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);
     }
 }
示例#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);
			}
		}
示例#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));
     }
 }
示例#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);
     }
 }
示例#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);
 }
示例#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);
        }
示例#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>();
 }
示例#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>();
		}
示例#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);
 }
示例#11
0
 public SafeDictionaryHandle(SafeBrokerHandle broker, IntPtr handle)
     : base(IntPtr.Zero, true)
 {
     _broker = broker;
     SetHandle(handle);
 }
示例#12
0
 private static extern void enchant_broker_set_ordering(SafeBrokerHandle broker,
                                                        IntPtr tag,
                                                        IntPtr ordering);
示例#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);
        }
示例#14
0
 private static extern int enchant_broker_dict_exists(SafeBrokerHandle broker, IntPtr tag);
示例#15
0
 public static extern void enchant_broker_free_dict(SafeBrokerHandle broker, IntPtr dict);
示例#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);
            }
        }
示例#17
0
 private static extern IntPtr enchant_broker_request_pwl_dict(
     SafeBrokerHandle broker, IntPtr pwl);
示例#18
0
 private static extern void enchant_broker_list_dicts(SafeBrokerHandle broker,
                                                      [MarshalAs(UnmanagedType.FunctionPtr)] EnchantDictDescribeFn
                                                      enchantDictDescribeFn,
                                                      IntPtr user_data);
示例#19
0
 private static extern int enchant_broker_dict_exists(SafeBrokerHandle broker, IntPtr tag);
示例#20
0
        private static extern void enchant_broker_list_dicts(SafeBrokerHandle broker,
																												 [MarshalAs(UnmanagedType.FunctionPtr)] EnchantDictDescribeFn
																													 enchantDictDescribeFn,
																												 IntPtr user_data);
示例#21
0
 public static extern string enchant_broker_get_error(SafeBrokerHandle broker);
示例#22
0
 public static extern void enchant_broker_free_dict(SafeBrokerHandle broker, IntPtr dict);
示例#23
0
        private static extern IntPtr enchant_broker_request_pwl_dict(
			SafeBrokerHandle broker, IntPtr pwl);
示例#24
0
        private static extern void enchant_broker_set_ordering(SafeBrokerHandle broker,
																													 IntPtr tag,
																													 IntPtr ordering);
示例#25
0
 public SafeDictionaryHandle(SafeBrokerHandle broker, IntPtr handle)
     : base(IntPtr.Zero, true)
 {
     _broker = broker;
     SetHandle(handle);
 }
示例#26
0
 public static extern string enchant_broker_get_error(SafeBrokerHandle broker);