Beispiel #1
0
        /// <summary>
        /// Carraga os dados do roteamento.
        /// </summary>
        /// <returns>True se os dados foram recarregados.</returns>
        public static bool LoadConfiguration()
        {
            bool needLoad = false;

            if (!loadDataConfig)
            {
                loadDataConfig = true;
                needLoad       = true;
                Configurator.AddSectionHandler("Colosoft.Route");
                Configurator.AddFileHandler("Route.config");
            }
            else if (Configurator.RefreshHandlers(f => f is RouteSectionHandler || f is Configuration.Handlers.FileConfigHandler))
            {
                needLoad = true;
            }
            if (needLoad)
            {
                lock (syncObject)
                {
                    _routesInfo.Clear();
                    _routesNavigate.Clear();
                    _complexRoutesNavigate.Clear();
                    try
                    {
                        Configurator.Configure(typeof(RouteSettings));
                        return(true);
                    }
                    catch (Exception ex)
                    {
                        if (ex is TargetInvocationException)
                        {
                            ex = ex.InnerException;
                        }
                        throw new Colosoft.Configuration.Exceptions.LoadConfigurationException(ex);
                    }
                }
            }
            return(false);
        }