#region --------------- Copyright Dresser Wayne Pignone ------------- /* * $Log: /Wrk/WayneLibraries/Wrk/Log/EventLogEntry.cs $ * * 2 08-02-13 9:26 Mattias.larsson * FxCop fixes. */ #endregion using System.Xml; using System.Diagnostics.CodeAnalysis; namespace Wayne.Lib.Log { /// <summary> /// LogEntry for Events. /// </summary> public class EventLogEntry : LogEntry { #region Construction /// <summary> /// Constructor. /// </summary> /// <param name="entity"></param> /// <param name="logObject">The object to log.</param> [SuppressMessage("Microsoft.Naming", "CA1720:IdentifiersShouldNotContainTypeNames", MessageId = "object")] public EventLogEntry(IIdentifiableEntity entity, object logObject) : base(entity, logObject) { LogLevel = DebugLogLevel.Normal; } /// <summary> /// Constructor. /// </summary> /// <param name="entity"></param> /// <param name="logObject">The object to log.</param> /// <param name="category"></param> [SuppressMessage("Microsoft.Naming", "CA1720:IdentifiersShouldNotContainTypeNames", MessageId = "object")] public EventLogEntry(IIdentifiableEntity entity, object logObject, object category) : base(entity, logObject, category) { LogLevel = DebugLogLevel.Normal; } /// <summary> /// Constructor. /// </summary> /// <param name="logEntryNode">XML node.</param> [SuppressMessage("Microsoft.Design", "CA1059:MembersShouldNotExposeCertainConcreteTypes", MessageId = "System.Xml.XmlNode")] public EventLogEntry(XmlElement logEntryNode) : base(logEntryNode) { LogLevel = DebugLogLevel.Normal; } /// <summary> /// Log level of this log entry. /// </summary> public DebugLogLevel LogLevel { get; set; } #endregion /// <summary> /// Deserializing from an XML-element. /// </summary> /// <param name="xmlElement"></param> /// <returns></returns> [SuppressMessage("Microsoft.Design", "CA1059:MembersShouldNotExposeCertainConcreteTypes", MessageId = "System.Xml.XmlNode")] public static DeserializedLogEntry Deserialize(XmlElement xmlElement) { /* string typeName = "Wayne.Lib.Log.EventLogEntry";//"xmlElement.Attributes["ReflectionType"].Value; string assemblyNameString = "Wayne.Lib.Log";// xmlElement.Attributes["Assembly"].Value; AssemblyName name = new AssemblyName(); name.Name = assemblyNameString; // : If assembly is not found, create a plain log entry.... System.Reflection.Assembly assembly = System.Reflection.Assembly.Load(name); Type type = assembly.GetType(typeName); ConstructorInfo ci = type.GetConstructor(new Type[] { typeof(XmlElement) }); if (ci != null) { return ci.Invoke(new object[] { xmlElement }) as LogEntry; } */ //If the deserialization did not succeed, deserialize into an ordinary log entry. return new DeserializedLogEntry(xmlElement); } } }