/// <summary> /// Initializes the <see cref="Manager"/> class. /// </summary> static Manager() { // gets the assembly version of the rewriter RewriterVersion = typeof(Manager).Assembly.GetName().Version.Clone() as Version; try { // setup the rewriter proxy ProxyType = Type.GetType(Configuration.Rewriter.Proxy.ProxyType); // setup the async rewriter proxy ProxyAsyncType = Type.GetType(Configuration.Rewriter.Proxy.ProxyAsyncType); } catch { ProxyType = typeof(ProxyHandler); ProxyAsyncType = typeof(ProxyAsyncHandler); } finally { if (ProxyType == null) { ProxyType = typeof(ProxyHandler); } if (ProxyAsyncType == null) { ProxyAsyncType = typeof(ProxyAsyncHandler); } } // load engine switch (Configuration.Rules.Engine) { case RulesEngine.Apache: _rewriterEngine = new ApacheEngine(); break; case RulesEngine.Microsoft: _rewriterEngine = new MicrosoftEngine(); break; case RulesEngine.Other: { try { _rewriterEngine = (IRewriterEngine)Activator.CreateInstance(Type.GetType(Configuration.Rules.EngineType)); break; } catch (Exception exc) { throw new RewriterEngineException("The engine specified in the web.config cannot be found, " + Configuration.Rules.EngineType, exc); } } } // init engine _rewriterEngine.Init(); }
/// <summary> /// Initializes the <see cref="Manager"/> class. /// </summary> static Manager() { // gets the assembly version of the rewriter RewriterVersion = typeof(Manager).Assembly.GetName().Version.Clone() as Version; try { // setup the rewriter proxy ProxyType = Type.GetType(Configuration.Rewriter.Proxy.ProxyType); // setup the async rewriter proxy ProxyAsyncType = Type.GetType(Configuration.Rewriter.Proxy.ProxyAsyncType); } catch { ProxyType = typeof(ProxyHandler); ProxyAsyncType = typeof(ProxyAsyncHandler); } finally { if (ProxyType == null) ProxyType = typeof(ProxyHandler); if (ProxyAsyncType == null) ProxyAsyncType = typeof(ProxyAsyncHandler); } // load engine switch (Configuration.Rules.Engine) { case RulesEngine.Apache: _rewriterEngine = new ApacheEngine(); break; case RulesEngine.Microsoft: _rewriterEngine = new MicrosoftEngine(); break; case RulesEngine.Other: { try { _rewriterEngine = (IRewriterEngine)Activator.CreateInstance(Type.GetType(Configuration.Rules.EngineType)); break; } catch (Exception exc) { throw new RewriterEngineException("The engine specified in the web.config cannot be found, " + Configuration.Rules.EngineType, exc); } } } // init engine _rewriterEngine.Init(); }