/// <summary> /// Initialize /// </summary> private static void Initialize() { var configuration = (TranslatorProviderConfiguration)ConfigurationManager.GetSection("translatorProvider"); if (configuration == null) { throw new ConfigurationErrorsException ("SampleProvider configuration section is not set correctly."); } _providers = new TranslatorProviderCollection(); ProvidersHelper.InstantiateProviders(configuration.Providers, _providers, typeof(TranslatorProvider)); _providers.SetReadOnly(); foreach (TranslatorProvider p in _providers) { p.CacheFilePath = configuration.CacheFilePath; } _defaultProvider = _providers[configuration.Default]; if (_defaultProvider == null) { throw new Exception("defaultProvider"); } }
/// <summary> /// Initialize /// </summary> private static void Initialize() { var configuration = (TranslatorProviderConfiguration)ConfigurationManager.GetSection("translatorProvider"); if (configuration == null) throw new ConfigurationErrorsException ("SampleProvider configuration section is not set correctly."); _providers = new TranslatorProviderCollection(); ProvidersHelper.InstantiateProviders(configuration.Providers, _providers, typeof (TranslatorProvider)); _providers.SetReadOnly(); foreach (TranslatorProvider p in _providers) { p.CacheFilePath = configuration.CacheFilePath; } _defaultProvider = _providers[configuration.Default]; if (_defaultProvider == null) throw new Exception("defaultProvider"); }