Removed DebugConsole functionality in non-debug builds

This commit is contained in:
biwa 2020-04-26 00:58:42 +02:00
parent f15c0e0eb1
commit 594fe0403d
2 changed files with 33 additions and 2 deletions

View file

@ -2,6 +2,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing; using System.Drawing;
using System.Globalization; using System.Globalization;
using System.Windows.Forms; using System.Windows.Forms;
@ -97,13 +98,28 @@ namespace CodeImp.DoomBuilder
#region ================== Methods #region ================== Methods
[Conditional("DEBUG")]
public static void StoreText(string text) { storedtext += text + Environment.NewLine; } public static void StoreText(string text) { storedtext += text + Environment.NewLine; }
[Conditional("DEBUG")]
public static void SetStoredText() { Write(DebugMessageType.INFO, storedtext, false); storedtext = string.Empty; } public static void SetStoredText() { Write(DebugMessageType.INFO, storedtext, false); storedtext = string.Empty; }
[Conditional("DEBUG")]
public static void SetText(string text) { Write(DebugMessageType.INFO, text, false); } // Useful to display frequently updated text without flickering public static void SetText(string text) { Write(DebugMessageType.INFO, text, false); } // Useful to display frequently updated text without flickering
[Conditional("DEBUG")]
public static void WriteLine(string text) { Write(DebugMessageType.INFO, text + Environment.NewLine, true); } public static void WriteLine(string text) { Write(DebugMessageType.INFO, text + Environment.NewLine, true); }
[Conditional("DEBUG")]
public static void WriteLine(DebugMessageType type, string text) { Write(type, text + Environment.NewLine, true); } public static void WriteLine(DebugMessageType type, string text) { Write(type, text + Environment.NewLine, true); }
[Conditional("DEBUG")]
public static void Write(string text) { Write(DebugMessageType.INFO, text, true); } public static void Write(string text) { Write(DebugMessageType.INFO, text, true); }
[Conditional("DEBUG")]
public static void Write(DebugMessageType type, string text) { Write(type, text, true); } public static void Write(DebugMessageType type, string text) { Write(type, text, true); }
[Conditional("DEBUG")]
public static void Write(DebugMessageType type, string text, bool append) public static void Write(DebugMessageType type, string text, bool append)
{ {
if (General.MainWindow == null) if (General.MainWindow == null)
@ -119,6 +135,7 @@ namespace CodeImp.DoomBuilder
}); });
} }
[Conditional("DEBUG")]
public static void Clear() public static void Clear()
{ {
if (General.MainWindow == null) if (General.MainWindow == null)
@ -130,11 +147,13 @@ namespace CodeImp.DoomBuilder
}); });
} }
[Conditional("DEBUG")]
public static void StartTimer() public static void StartTimer()
{ {
starttime = Clock.Timer.ElapsedMilliseconds; starttime = Clock.Timer.ElapsedMilliseconds;
} }
[Conditional("DEBUG")]
public static void PauseTimer() public static void PauseTimer()
{ {
if(starttime == -1) throw new InvalidOperationException("DebugConsole.StartTimer() must be called before DebugConsole.PauseTimer()!"); if(starttime == -1) throw new InvalidOperationException("DebugConsole.StartTimer() must be called before DebugConsole.PauseTimer()!");
@ -142,6 +161,7 @@ namespace CodeImp.DoomBuilder
storedtime += Clock.Timer.ElapsedMilliseconds - starttime; storedtime += Clock.Timer.ElapsedMilliseconds - starttime;
} }
[Conditional("DEBUG")]
public static void StopTimer(string message) public static void StopTimer(string message)
{ {
if(starttime == -1) throw new InvalidOperationException("DebugConsole.StartTimer() must be called before DebugConsole.StopTimer()!"); if(starttime == -1) throw new InvalidOperationException("DebugConsole.StartTimer() must be called before DebugConsole.StopTimer()!");
@ -163,13 +183,19 @@ namespace CodeImp.DoomBuilder
storedtime = 0; storedtime = 0;
} }
[Conditional("DEBUG")]
public static void IncrementCounter() { IncrementCounter(1); } public static void IncrementCounter() { IncrementCounter(1); }
[Conditional("DEBUG")]
public static void IncrementCounter(int incrementby) public static void IncrementCounter(int incrementby)
{ {
counter += incrementby; counter += incrementby;
} }
[Conditional("DEBUG")]
public static void ResetCounter() { ResetCounter(string.Empty); } public static void ResetCounter() { ResetCounter(string.Empty); }
[Conditional("DEBUG")]
public static void ResetCounter(string message) public static void ResetCounter(string message)
{ {
if(!string.IsNullOrEmpty(message)) if(!string.IsNullOrEmpty(message))
@ -185,6 +211,7 @@ namespace CodeImp.DoomBuilder
counter = 0; counter = 0;
} }
[Conditional("PROFILE")]
public static void StartProfiler() public static void StartProfiler()
{ {
#if PROFILE #if PROFILE
@ -203,7 +230,10 @@ namespace CodeImp.DoomBuilder
#endif #endif
} }
[Conditional("PROFILE")]
public static void StopProfiler() { StopProfiler(true); } public static void StopProfiler() { StopProfiler(true); }
[Conditional("PROFILE")]
public static void StopProfiler(bool savesnapshot) public static void StopProfiler(bool savesnapshot)
{ {
#if PROFILE #if PROFILE
@ -224,6 +254,7 @@ namespace CodeImp.DoomBuilder
#endif #endif
} }
[Conditional("DEBUG")]
private void AddMessage(DebugMessageType type, string text, bool scroll, bool append) private void AddMessage(DebugMessageType type, string text, bool scroll, bool append)
{ {
text = textheaders[type] + text; text = textheaders[type] + text;
@ -245,6 +276,7 @@ namespace CodeImp.DoomBuilder
if(scroll && autoscroll.Checked) console.ScrollToCaret(); if(scroll && autoscroll.Checked) console.ScrollToCaret();
} }
[Conditional("DEBUG")]
private void UpdateFilters(ToolStripMenuItem item) private void UpdateFilters(ToolStripMenuItem item)
{ {
DebugMessageType flag = (DebugMessageType)(int)item.Tag; DebugMessageType flag = (DebugMessageType)(int)item.Tag;
@ -258,6 +290,7 @@ namespace CodeImp.DoomBuilder
} }
} }
[Conditional("DEBUG")]
private void UpdateMessages() private void UpdateMessages()
{ {
console.Clear(); console.Clear();

View file

@ -4264,8 +4264,6 @@ namespace CodeImp.DoomBuilder.BuilderModes
if (j.sidedef.Marked) if (j.sidedef.Marked)
continue; continue;
DebugConsole.WriteLine("Aligning " + j.sidedef);
if(j.forward) if(j.forward)
{ {
// Apply alignment // Apply alignment