コード例 #1
0
ファイル: CorsHandler.cs プロジェクト: ts295983632/vrs
        /// <summary>
        /// Reloads the configuration if it has changed since the last time we fetched it.
        /// </summary>
        private void RefreshConfiguration()
        {
            if (_SharedConfiguration == null)
            {
                _SharedConfiguration = Factory.ResolveSingleton <ISharedConfiguration>();
            }

            var configurationChangedUtc = _SharedConfiguration.GetConfigurationChangedUtc();

            if (_ConfigurationLastParsed < configurationChangedUtc)
            {
                _ConfigurationLastParsed = configurationChangedUtc;

                var configuration = _SharedConfiguration.Get();
                var allowDomains  = (configuration.GoogleMapSettings.AllowCorsDomains ?? "").Trim();

                _CorsEnabled     = configuration.GoogleMapSettings.EnableCorsSupport;
                _AllowAllDomains = allowDomains == "*";
                _AllowedDomains  = _AllowAllDomains ? new string[0] :
                                   allowDomains
                                   .Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries)
                                   .Select(r => r.Trim().ToLowerInvariant())
                                   .Distinct()
                                   .ToArray();
            }
        }