コード例 #1
0
ファイル: Program.cs プロジェクト: TerenceWallace/bloodbox
 public static void Log_LogEvent(object sender, NetLogEventArgs e)
 {
     try
     {
         if (MainForm != null && !MainForm.Disposing && !MainForm.IsDisposed)
         {
             MainForm.rtbLog.AppendText(e.Entry.What + Environment.NewLine);
             Win32.ScrollRichTextBox(MainForm.rtbLog);
         }
     }
     catch { } // ignore disposal problems
 }
コード例 #2
0
ファイル: NetLog.cs プロジェクト: MicroWorldwide/MMOMahjong
        private void MakeEntry(NetLogEntryTypes type, string str)
        {
            if ((type & IgnoreTypes) == type)
            {
                return;
            }

            if (type != NetLogEntryTypes.Break)
            {
                ConsoleColor wasColor = Console.ForegroundColor;
                // TODO:
                //Console.ForegroundColor = LogEntryTypeColors[(int)type];
                Console.WriteLine(str);
                Console.ForegroundColor = wasColor;
            }

            NetLogEntry entry = new NetLogEntry();

            entry.TimeMillis = (long)(NetTime.Now * 1000.0);
            entry.Type       = type;
#if DEBUG
            // get call stack
            StackTrace trace  = new StackTrace(2, true);
            StackFrame frame  = trace.GetFrame(0);
            MethodBase method = frame.GetMethod();
            entry.Where = method.Name + "() in " + method.DeclaringType.Name;
#else
            entry.Where = "";
#endif
            entry.What = str;

            if (m_outputToFile)
            {
                m_entries.Enqueue(entry);
            }

            if (LogEvent != null)
            {
                NetLogEventArgs args = new NetLogEventArgs();
                args.Entry = entry;
                LogEvent(this, args);
            }

            if (Thread.CurrentThread == m_mainThread && m_entries.Count > 0)
            {
                Flush();
            }
        }
コード例 #3
0
ファイル: NetLog.cs プロジェクト: TerenceWallace/bloodbox
		private void MakeEntry(NetLogEntryTypes type, string str)
		{
			if ((type & IgnoreTypes) == type)
				return;

			if (type != NetLogEntryTypes.Break)
			{
				ConsoleColor wasColor = Console.ForegroundColor;
				// TODO:
				//Console.ForegroundColor = LogEntryTypeColors[(int)type];
				Console.WriteLine(str);
				Console.ForegroundColor = wasColor;
			}

			NetLogEntry entry = new NetLogEntry();
			entry.TimeMillis = (long)(NetTime.Now * 1000.0);
			entry.Type = type;
#if DEBUG
			// get call stack
			StackTrace trace = new StackTrace(2, true);
			StackFrame frame = trace.GetFrame(0);
			MethodBase method = frame.GetMethod();
			entry.Where = method.Name + "() in " + method.DeclaringType.Name;
#else
			entry.Where = "";
#endif
			entry.What = str;

			if (m_outputToFile)
				m_entries.Enqueue(entry);

			if (LogEvent != null)
			{
				NetLogEventArgs args = new NetLogEventArgs();
				args.Entry = entry;
				LogEvent(this, args);
			}

			if (Thread.CurrentThread == m_mainThread && m_entries.Count > 0)
				Flush();
		}
コード例 #4
0
ファイル: MMOServer.cs プロジェクト: lkw1830/mmomahjong
 void OnLogEvent(object sender, NetLogEventArgs e)
 {
     //Console.WriteLine(e.Entry.What);
 }