| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117 | using System;using System.Collections.Generic;namespace Wayne.Lib.Log{                internal class ExternalLogWriterWrapper : LogWriter    {        #region Fields        private bool disposed;        private string externalLogType;        private string externalLogName;        private LogTextWritingParameters writingParameters;        private Dictionary<string, string> parameters;        #endregion        #region Construction        public ExternalLogWriterWrapper(string logName, LogConfigExternalLogWriterOutput output)            : base(logName)        {            externalLogType = output.ExternalLogType;            externalLogName = output.ExternalLogName;            writingParameters = new LogTextWritingParameters(output.DateTimeFormat, output.EntityLogKind, output.SuppressCategory, true);            parameters = new Dictionary<string, string>(output.Params);        }        #endregion        #region IDisposable Members                                                [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes")]        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2102:CatchNonClsCompliantExceptionsInGeneralHandlers")]        protected override void Dispose(bool disposing, string reason)        {            if (!disposed)            {                try                {                }                catch (Exception) { }                disposed = true;            }        }        #endregion        #region Public Properties        public string ExternalLogType        {            get { return externalLogType; }        }        public string ExternalLogName        {            get { return externalLogName; }        }        public LogTextWritingParameters WritingParameters        {            get { return writingParameters; }        }        public Dictionary<string, string> Parameters        {            get { return parameters; }        }        #endregion        #region Public Methods        public override void PerformWrite(LogEntry logEntry)        {            if (disposed)                return;            PerformLogEntry(logEntry);        }        public override bool Equals(object obj)        {            ExternalLogWriterWrapper externalLogWriterWrapper = obj as ExternalLogWriterWrapper;            if (externalLogWriterWrapper != null)            {                return externalLogWriterWrapper.externalLogType.Equals(externalLogType) &&                    externalLogWriterWrapper.externalLogName.Equals(externalLogName);            }            return false;        }        public override int GetHashCode()        {            return externalLogType.GetHashCode() ^ externalLogName.GetHashCode();        }        #endregion        #region Private Methods: Writing        private void PerformLogEntry(LogEntry logEntry)        {            Logger.PerformExternalLogEntry(this, logEntry);        }        #endregion    }}
 |