/// <summary> /// Stops the specified timer. /// </summary> /// <param name="name">Name of the timer.</param> public static void StopTimer(string name) { DebugSession debugSession = GetSession(HttpContext.Current); if (debugSession.timers.ContainsKey(name)) { debugSession.timers[name].Stop(); } }
/// <summary> /// Starts the specified timer. /// </summary> /// <param name="name">Name of the timer.</param> public static void StartTimer(string name) { DebugSession debugSession = GetSession(HttpContext.Current); if (!debugSession.timers.ContainsKey(name)) { debugSession.timers.Add(name, new Stopwatch()); } debugSession.timers[name].Start(); }
/// <summary> /// Writes text to the debug console. /// </summary> /// <param name="textObject">Text to write to the debug console.</param> /// <param name="parameters">Parameters to be replaced in text.</param> public static void Write(object textObject, params object[] parameters) { DebugSession debugSession = GetSession(HttpContext.Current); string text = textObject != null?textObject.ToString() : ""; for (int parameter = 0; parameter < parameters.Length; parameter++) { text = text.Replace("{" + parameter + "}", parameters[parameter] != null ? parameters[parameter].ToString() : "{NULL}"); } debugSession.Output += text; }