예제 #1
0
        public static bool SupportModule(params ModuleInfo[] modules)
        {
            if (modules == null || modules.Length == 0 || CheckServiceAvailability())
            {
                return(false);
            }

            try
            {
                using (var service = new TextIndexServiceClient())
                {
                    return(service.SupportModule(modules.Select(r => r.Name).ToArray()));
                }
            }
            catch (Exception e)
            {
                if (e is CommunicationException || e is TimeoutException)
                {
                    lastErrorTime = DateTime.Now;
                }

                log.Error(e);
            }

            return(false);
        }
예제 #2
0
        public static bool SupportModule(string module)
        {
            var result = false;

            if (IsServiceProbablyNotAvailable())
            {
                return(result);
            }

            using (var service = new TextIndexServiceClient())
            {
                try
                {
                    result = service.SupportModule(module);
                }
                catch (FaultException fe)
                {
                    LogError(fe);
                }
                catch (CommunicationException ce)
                {
                    LogError(ce);
                    lastErrorTime = DateTime.Now;
                }
                catch (TimeoutException te)
                {
                    LogError(te);
                    lastErrorTime = DateTime.Now;
                }
            }
            return(result);
        }
예제 #3
0
        public static bool SupportModule(params ModuleInfo[] modules)
        {
            if (modules == null || modules.Length == 0 || CheckServiceAvailability())
            {
                return(false);
            }

            var names  = modules.Select(m => m.Name).ToArray();
            var key    = string.Join("", names);
            var result = cache.Get <string>(key);

            if (result != null)
            {
                return(bool.Parse(result));
            }

            try
            {
                using (var service = new TextIndexServiceClient())
                {
                    var support = service.SupportModule(names);
                    cache.Insert(key, support.ToString(), DateTime.Now.AddHours(1));
                    return(support);
                }
            }
            catch (Exception e)
            {
                if (e is CommunicationException || e is TimeoutException)
                {
                    lastErrorTime = DateTime.Now;
                }
                log.Error(e);
            }
            return(false);
        }
예제 #4
0
        public static bool SupportModule(params string[] modules)
        {
            if (modules == null || modules.Length == 0 || IsServiceProbablyNotAvailable())
            {
                return(false);
            }

            try
            {
                using (var service = new TextIndexServiceClient())
                {
                    try
                    {
                        return(service.SupportModule(modules));
                    }
                    catch (FaultException fe)
                    {
                        LogError(fe);
                    }
                    catch (CommunicationException ce)
                    {
                        LogError(ce);
                        lastErrorTime = DateTime.Now;
                    }
                    catch (TimeoutException te)
                    {
                        LogError(te);
                        lastErrorTime = DateTime.Now;
                    }
                }
            }
            catch (Exception e)
            {
                LogError(e);
                lastErrorTime = DateTime.Now;
            }

            return(false);
        }