From 024f4c5c4e18088a0f6fe35e09dde2d21ab4a3d9 Mon Sep 17 00:00:00 2001 From: inga-lovinde <52715130+inga-lovinde@users.noreply.github.com> Date: Sun, 6 Jun 2010 17:54:54 +0000 Subject: [PATCH] More debug added to DebugHandler; config now initializes only once --- Common/Config.cs | 3 +++ Core/Config.cs | 6 ++++++ IISMainHandler/MainHandler.cs | 2 +- IISMainHandler/handlers/DebugHandler.cs | 1 + 4 files changed, 11 insertions(+), 1 deletion(-) diff --git a/Common/Config.cs b/Common/Config.cs index 0f1e0cd..e7afc60 100644 --- a/Common/Config.cs +++ b/Common/Config.cs @@ -8,7 +8,10 @@ namespace FLocal.Common { public class Config : FLocal.Core.Config { + public readonly string InitTime; + protected Config(NameValueCollection data) : base(data) { + this.InitTime = DateTime.Now.ToLongTimeString(); } public static void Init(NameValueCollection data) { diff --git a/Core/Config.cs b/Core/Config.cs index 4d624af..4a51ea2 100644 --- a/Core/Config.cs +++ b/Core/Config.cs @@ -43,5 +43,11 @@ namespace FLocal.Core { } } + public static bool isInitialized { + get { + return _instance != null; + } + } + } } diff --git a/IISMainHandler/MainHandler.cs b/IISMainHandler/MainHandler.cs index f00bc48..1e6139d 100644 --- a/IISMainHandler/MainHandler.cs +++ b/IISMainHandler/MainHandler.cs @@ -13,7 +13,7 @@ namespace FLocal.IISHandler { } public void ProcessRequest(HttpContext httpcontext) { - FLocal.Common.Config.ReInit(ConfigurationManager.AppSettings); + if(!FLocal.Common.Config.isInitialized) FLocal.Common.Config.Init(ConfigurationManager.AppSettings); WebContext context = new WebContext(httpcontext); ISpecificHandler handler = HandlersFactory.getHandler(context); diff --git a/IISMainHandler/handlers/DebugHandler.cs b/IISMainHandler/handlers/DebugHandler.cs index 6576dc3..52449ff 100644 --- a/IISMainHandler/handlers/DebugHandler.cs +++ b/IISMainHandler/handlers/DebugHandler.cs @@ -19,6 +19,7 @@ namespace FLocal.IISHandler.handlers { context.httpresponse.WriteLine("Path: " + context.httprequest.Path); context.httpresponse.WriteLine("PathInfo: " + context.httprequest.PathInfo); context.httpresponse.WriteLine("AppInfo: " + context.config.AppInfo); + context.httpresponse.WriteLine("InitTime: " + context.config.InitTime); } }