MoltenMercury/DebugHelper.cs
(开头部分) 2KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Reflection;
using System.Windows.Forms;
/* ============================================================================
* DebugHelper.cs
* ----------------------------------------------------------------------------
* 2012 (C) Jieni Luchijinzhou a.k.a Aragorn Wyvernzora
*
* This is a helper class that handles debug logging.
* Pretty much everything here is self explanatory.
*
*/
namespace MoltenMercury
{
public static class DebugHelper
{
private static StreamWriter log = new StreamWriter(Path.Combine(Application.StartupPath, "debug.log"), false, Encoding.UTF8);
private static Boolean m_logEnabled = true;
public static Boolean LoggingEnabled
{
get { return m_logEnabled; }
set { m_logEnabled = value; }
}
public static void DebugPrint(String format, params object[] args)
{
if (!m_logEnabled) return;
System.Diagnostics.StackTrace stack = new System.Diagnostics.StackTrace();
#if DEBUG
System.Diagnostics.Debug.Print("{0,2}:{1,2}:{2,2}.{3,-10}{4,-30}{5}",
DateTime.Now.Hour, DateTime.Now.Minute, DateTime.Now.Second, DateTime.Now.Millisecond,
stack.GetFrame(1).GetMethod().Name,
String.Format(format, args));
#endif
log.WriteLine("{0,2}:{1,2}:{2,2}.{3,-10}{4,-30}{5}",
DateTime.Now.Hour, DateTime.Now.Minute, DateTime.Now.Second, DateTime.Now.Millisecond,
stack.GetFrame(1).GetMethod().Name,
String.Format(format, args));
log.Flush();
}
public static void ForceDebugPrint(String format, params object[] args)
{
System.Diagnostics.StackTrace stack = new System.Diagnostics.StackTrace();
#if DEBUG
System.Diagnostics.Debug.Print("{0,2}:{1,2}:{2,2}.{3,-10}{4,-30}{5}",
DateTime.Now.Hour, DateTime.Now.Minute, DateTime.Now.Second, DateTime.Now.Millisecond,
stack.GetFrame(1).GetMethod().Name,
后面还有 12 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。