Files
libremetaverse/Programs/WinGridProxy/FireEventAppender.cs
Jim Radford de8c3131a1 LIBOMV-492 WinGridProxy - Automatically colorize packet details in view
* Log Viewer built into WinGridProxy
* New Decoder system supports the ability to do custom decoding on packet fields, PacketToString moved from Helpers to its own class.
* GridProxy library now uses log4net library to do logging, WinGridProxy logging configuration added to make use of this.
LIBOMV-512 WinGridProxy decodes KeyValue pairs

* Added Invert & Mirror flags to sculptType enum
* Converted SoundManager to use the SoundFlags enum in the AttachedSound callback
* TestClient "who" command now shows agents logal ID

git-svn-id: http://libopenmetaverse.googlecode.com/svn/libopenmetaverse/trunk@2805 52acb1d6-8a22-11de-b505-999d5b087335
2009-05-25 19:00:28 +00:00

83 lines
2.4 KiB
C#

#region Copyright & License
//
// Copyright 2001-2004 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
#endregion
using System;
using log4net.Core;
namespace WinGridProxy
{
public delegate void MessageLoggedEventHandler(object sender, MessageLoggedEventArgs e);
public class MessageLoggedEventArgs : EventArgs
{
private LoggingEvent m_loggingEvent;
public MessageLoggedEventArgs(LoggingEvent loggingEvent)
{
m_loggingEvent = loggingEvent;
}
public LoggingEvent LoggingEvent
{
get { return m_loggingEvent; }
}
}
public class FireEventAppender : log4net.Appender.AppenderSkeleton
{
private static FireEventAppender m_instance;
private FixFlags m_fixFlags = FixFlags.All;
// Event handler
public event MessageLoggedEventHandler MessageLoggedEvent;
// Easy singleton, gets the last instance created
public static FireEventAppender Instance
{
get { return m_instance; }
}
public FireEventAppender()
{
// Store the instance created
m_instance = this;
}
virtual public FixFlags Fix
{
get { return m_fixFlags; }
set { m_fixFlags = value; }
}
override protected void Append(LoggingEvent loggingEvent)
{
// Because we the LoggingEvent may be used beyond the lifetime
// of the Append() method we must fix any volatile data in the event
loggingEvent.Fix = this.Fix;
// Raise the event
MessageLoggedEventHandler handler = MessageLoggedEvent;
if (handler != null)
{
handler(this, new MessageLoggedEventArgs(loggingEvent));
}
}
}
}