Пример #1
0
        /// <summary>
        /// Reads the exception fields from the specified log file reader.
        /// </summary>
        /// <param name="reader">The log file reader to read from.</param>
        /// <returns>The exception data.</returns>
        internal static FieldLogException Read(FieldLogFileReader reader)
        {
            FieldLogException ex = new FieldLogException();

            ex.Type = reader.ReadString();
            if (reader.FormatVersion >= 2)
            {
                ex.TypeModule = reader.ReadString();
                ex.Token      = reader.ReadInt32();
            }
            ex.Message = reader.ReadString();
            ex.Code    = reader.ReadInt32();
            ex.Data    = reader.ReadString();
            int frameCount = reader.ReadInt32();

            ex.StackFrames = new FieldLogStackFrame[frameCount];
            for (int i = 0; i < frameCount; i++)
            {
                ex.StackFrames[i] = FieldLogStackFrame.Read(reader);
            }
            int innerCount = reader.ReadInt32();

            ex.InnerExceptions = new FieldLogException[innerCount];
            for (int i = 0; i < innerCount; i++)
            {
                ex.InnerExceptions[i] = FieldLogException.Read(reader);
            }
            return(ex);
        }
Пример #2
0
        /// <summary>
        /// Reads the log item fields from the specified log file reader.
        /// </summary>
        /// <param name="reader">The log file reader to read from.</param>
        /// <returns>The read log item.</returns>
        internal static FieldLogTextItem Read(FieldLogFileReader reader)
        {
            FieldLogTextItem item = new FieldLogTextItem();

            item.ReadBaseData(reader);
            item.Text    = reader.ReadString();
            item.Details = reader.ReadString();
            return(item);
        }
Пример #3
0
        /// <summary>
        /// Reads the log item fields from the specified log file reader.
        /// </summary>
        /// <param name="reader">The log file reader to read from.</param>
        /// <returns>The read log item.</returns>
        internal static FieldLogDataItem Read(FieldLogFileReader reader)
        {
            FieldLogDataItem item = new FieldLogDataItem();

            item.ReadBaseData(reader);
            item.Name  = reader.ReadString();
            item.Value = reader.ReadString();
            return(item);
        }
Пример #4
0
        /// <summary>
        /// Reads the log item fields from the specified log file reader.
        /// </summary>
        /// <param name="reader">The log file reader to read from.</param>
        /// <param name="isRepeated">true if the log item is repeated from a previous file, false if it is written for the first time.</param>
        /// <returns>The read log item.</returns>
        internal static FieldLogScopeItem Read(FieldLogFileReader reader, bool isRepeated)
        {
            FieldLogScopeItem item = new FieldLogScopeItem();

            item.ReadBaseData(reader);
            item.IsRepeated = isRepeated;
            item.Type       = (FieldLogScopeType)reader.ReadByte();
            item.Level      = reader.ReadInt32();
            item.Name       = reader.ReadString();

            if (item.Type == FieldLogScopeType.ThreadStart)
            {
                byte flags = reader.ReadByte();
                item.IsBackgroundThread = (flags & 1) != 0;
                item.IsPoolThread       = (flags & 2) != 0;
            }
            if (item.Type == FieldLogScopeType.LogStart)
            {
                item.EnvironmentData = FieldLogEventEnvironment.Read(reader);
            }
            if (item.Type == FieldLogScopeType.WebRequestStart && reader.FormatVersion >= 2)
            {
                item.WebRequestData = FieldLogWebRequestData.Read(reader);
            }
            return(item);
        }
Пример #5
0
        /// <summary>
        /// Reads the stack frame fields from the specified log file reader.
        /// </summary>
        /// <param name="reader">The log file reader to read from.</param>
        /// <returns>The stack frame data.</returns>
        internal static FieldLogStackFrame Read(FieldLogFileReader reader)
        {
            FieldLogStackFrame frame = new FieldLogStackFrame();

            frame.Module = reader.ReadString();
            if (reader.FormatVersion >= 2)
            {
                frame.Token    = reader.ReadInt32();
                frame.ILOffset = reader.ReadInt32();
            }
            frame.TypeName        = reader.ReadString();
            frame.MethodName      = reader.ReadString();
            frame.MethodSignature = reader.ReadString();
            frame.FileName        = reader.ReadString();
            frame.Line            = reader.ReadInt32();
            frame.Column          = reader.ReadInt32();
            return(frame);
        }
Пример #6
0
        /// <summary>
        /// Reads the log item fields from the specified log file reader.
        /// </summary>
        /// <param name="reader">The log file reader to read from.</param>
        /// <returns>The read log item.</returns>
        internal static FieldLogExceptionItem Read(FieldLogFileReader reader)
        {
            FieldLogExceptionItem item = new FieldLogExceptionItem();

            item.ReadBaseData(reader);
            item.Exception       = FieldLogException.Read(reader);
            item.Context         = reader.ReadString();
            item.EnvironmentData = FieldLogEventEnvironment.Read(reader);
            return(item);
        }
        /// <summary>
        /// Reads the FieldLogWebRequestData data from a log file reader.
        /// </summary>
        /// <param name="reader">Log file reader.</param>
        /// <returns>The web request data.</returns>
        internal static FieldLogWebRequestData Read(FieldLogFileReader reader)
        {
            FieldLogWebRequestData data = new FieldLogWebRequestData();
            data.RequestUrl = reader.ReadString();
            data.Method = reader.ReadString();
            data.ClientAddress = reader.ReadString();
            data.ClientHostName = reader.ReadString();
            data.Referrer = reader.ReadString();
            data.UserAgent = reader.ReadString();
            data.AcceptLanguages = reader.ReadString();
            data.Accept = reader.ReadString();
            data.WebSessionId = reader.ReadString();
            data.AppUserId = reader.ReadString();
            data.AppUserName = reader.ReadString();

            // Check if the environment is actually empty
            if (string.IsNullOrEmpty(data.RequestUrl))
                return FieldLogWebRequestData.Empty;

            return data;
        }
Пример #8
0
        /// <summary>
        /// Reads the FieldLogWebRequestData data from a log file reader.
        /// </summary>
        /// <param name="reader">Log file reader.</param>
        /// <returns>The web request data.</returns>
        internal static FieldLogWebRequestData Read(FieldLogFileReader reader)
        {
            FieldLogWebRequestData data = new FieldLogWebRequestData();

            data.RequestUrl      = reader.ReadString();
            data.Method          = reader.ReadString();
            data.ClientAddress   = reader.ReadString();
            data.ClientHostName  = reader.ReadString();
            data.Referrer        = reader.ReadString();
            data.UserAgent       = reader.ReadString();
            data.AcceptLanguages = reader.ReadString();
            data.Accept          = reader.ReadString();
            data.WebSessionId    = reader.ReadString();
            data.AppUserId       = reader.ReadString();
            data.AppUserName     = reader.ReadString();

            // Check if the environment is actually empty
            if (string.IsNullOrEmpty(data.RequestUrl))
            {
                return(FieldLogWebRequestData.Empty);
            }

            return(data);
        }
        /// <summary>
        /// Reads the FieldLogEventEnvironment data from a log file reader.
        /// </summary>
        /// <param name="reader">Log file reader.</param>
        /// <returns>The environment data.</returns>
        internal static FieldLogEventEnvironment Read(FieldLogFileReader reader)
        {
            FieldLogEventEnvironment env = new FieldLogEventEnvironment();

            env.OSType             = (OSType)reader.ReadByte();
            env.OSVersion          = (OSVersion)reader.ReadByte();
            env.OSEdition          = (OSEdition)reader.ReadByte();
            env.OSServicePack      = reader.ReadString();
            env.OSBuild            = reader.ReadInt32();
            env.OSServicePackBuild = reader.ReadInt32();
            env.OSProductName      = reader.ReadString();
            env.OSLanguage         = reader.ReadString();
            env.OSLastBootTime     = new DateTime(reader.ReadInt64(), DateTimeKind.Utc);
            env.AppCompatLayer     = reader.ReadString();
            env.ClrType            = reader.ReadString();
            env.MouseButtons       = reader.ReadByte();
            env.MaxTouchPoints     = reader.ReadByte();
            env.ScreenDpi          = reader.ReadUInt16();

            env.CultureName          = reader.ReadString();
            env.CurrentDirectory     = reader.ReadString();
            env.EnvironmentVariables = reader.ReadString();
            env.CpuCount             = reader.ReadUInt16();
            env.HostName             = reader.ReadString();
            env.UserName             = reader.ReadString();
            env.ExecutablePath       = reader.ReadString();
            env.CommandLine          = reader.ReadString();
            env.AppVersion           = reader.ReadString();
            if (reader.FormatVersion >= 2)
            {
                env.AppAsmConfiguration = reader.ReadString();
            }
            env.ClrVersion                     = reader.ReadString();
            env.LocalTimeZoneOffset            = TimeSpan.FromMinutes(reader.ReadInt16());
            env.ProcessMemory                  = reader.ReadInt64();
            env.PeakProcessMemory              = reader.ReadInt64();
            env.TotalMemory                    = reader.ReadInt64();
            env.AvailableMemory                = reader.ReadInt64();
            env.ProcessId                      = reader.ReadInt32();
            env.PrimaryScreenWidth             = reader.ReadUInt16();
            env.PrimaryScreenHeight            = reader.ReadUInt16();
            env.PrimaryScreenBitsPerPixel      = reader.ReadByte();
            env.PrimaryScreenWorkingAreaLeft   = reader.ReadUInt16();
            env.PrimaryScreenWorkingAreaTop    = reader.ReadUInt16();
            env.PrimaryScreenWorkingAreaWidth  = reader.ReadUInt16();
            env.PrimaryScreenWorkingAreaHeight = reader.ReadUInt16();
            env.ScreenCount                    = reader.ReadByte();

            byte flags = reader.ReadByte();

            env.OSIs64Bit        = (flags & 1) != 0;
            env.OSIsAppServer    = (flags & 2) != 0;
            env.OSIsFailSafeBoot = (flags & 4) != 0;
            env.IsInteractive    = (flags & 8) != 0;
            env.IsProcess64Bit   = (flags & 16) != 0;
            env.IsAdministrator  = (flags & 32) != 0;

            // Check if the environment is actually empty
            if (env.CpuCount == 0)
            {
                return(FieldLogEventEnvironment.Empty);
            }

            return(env);
        }
Пример #10
0
 /// <summary>
 /// Reads the stack frame fields from the specified log file reader.
 /// </summary>
 /// <param name="reader">The log file reader to read from.</param>
 /// <returns>The stack frame data.</returns>
 internal static FieldLogStackFrame Read(FieldLogFileReader reader)
 {
     FieldLogStackFrame frame = new FieldLogStackFrame();
     frame.Module = reader.ReadString();
     if (reader.FormatVersion >= 2)
     {
         frame.Token = reader.ReadInt32();
         frame.ILOffset = reader.ReadInt32();
     }
     frame.TypeName = reader.ReadString();
     frame.MethodName = reader.ReadString();
     frame.MethodSignature = reader.ReadString();
     frame.FileName = reader.ReadString();
     frame.Line = reader.ReadInt32();
     frame.Column = reader.ReadInt32();
     return frame;
 }
        /// <summary>
        /// Reads the FieldLogEventEnvironment data from a log file reader.
        /// </summary>
        /// <param name="reader">Log file reader.</param>
        /// <returns>The environment data.</returns>
        internal static FieldLogEventEnvironment Read(FieldLogFileReader reader)
        {
            FieldLogEventEnvironment env = new FieldLogEventEnvironment();
            env.OSType = (OSType)reader.ReadByte();
            env.OSVersion = (OSVersion)reader.ReadByte();
            env.OSEdition = (OSEdition)reader.ReadByte();
            env.OSServicePack = reader.ReadString();
            env.OSBuild = reader.ReadInt32();
            env.OSServicePackBuild = reader.ReadInt32();
            env.OSProductName = reader.ReadString();
            env.OSLanguage = reader.ReadString();
            env.OSLastBootTime = new DateTime(reader.ReadInt64(), DateTimeKind.Utc);
            env.AppCompatLayer = reader.ReadString();
            env.ClrType = reader.ReadString();
            env.MouseButtons = reader.ReadByte();
            env.MaxTouchPoints = reader.ReadByte();
            env.ScreenDpi = reader.ReadUInt16();

            env.CultureName = reader.ReadString();
            env.CurrentDirectory = reader.ReadString();
            env.EnvironmentVariables = reader.ReadString();
            env.CpuCount = reader.ReadUInt16();
            env.HostName = reader.ReadString();
            env.UserName = reader.ReadString();
            env.ExecutablePath = reader.ReadString();
            env.CommandLine = reader.ReadString();
            env.AppVersion = reader.ReadString();
            if (reader.FormatVersion >= 2)
            {
                env.AppAsmConfiguration = reader.ReadString();
            }
            env.ClrVersion = reader.ReadString();
            env.LocalTimeZoneOffset = TimeSpan.FromMinutes(reader.ReadInt16());
            env.ProcessMemory = reader.ReadInt64();
            env.PeakProcessMemory = reader.ReadInt64();
            env.TotalMemory = reader.ReadInt64();
            env.AvailableMemory = reader.ReadInt64();
            env.ProcessId = reader.ReadInt32();
            env.PrimaryScreenWidth = reader.ReadUInt16();
            env.PrimaryScreenHeight = reader.ReadUInt16();
            env.PrimaryScreenBitsPerPixel = reader.ReadByte();
            env.PrimaryScreenWorkingAreaLeft = reader.ReadUInt16();
            env.PrimaryScreenWorkingAreaTop = reader.ReadUInt16();
            env.PrimaryScreenWorkingAreaWidth = reader.ReadUInt16();
            env.PrimaryScreenWorkingAreaHeight = reader.ReadUInt16();
            env.ScreenCount = reader.ReadByte();

            byte flags = reader.ReadByte();
            env.OSIs64Bit = (flags & 1) != 0;
            env.OSIsAppServer = (flags & 2) != 0;
            env.OSIsFailSafeBoot = (flags & 4) != 0;
            env.IsInteractive = (flags & 8) != 0;
            env.IsProcess64Bit = (flags & 16) != 0;
            env.IsAdministrator = (flags & 32) != 0;

            // Check if the environment is actually empty
            if (env.CpuCount == 0)
                return FieldLogEventEnvironment.Empty;

            return env;
        }
Пример #12
0
 /// <summary>
 /// Reads the exception fields from the specified log file reader.
 /// </summary>
 /// <param name="reader">The log file reader to read from.</param>
 /// <returns>The exception data.</returns>
 internal static FieldLogException Read(FieldLogFileReader reader)
 {
     FieldLogException ex = new FieldLogException();
     ex.Type = reader.ReadString();
     if (reader.FormatVersion >= 2)
     {
         ex.TypeModule = reader.ReadString();
         ex.Token = reader.ReadInt32();
     }
     ex.Message = reader.ReadString();
     ex.Code = reader.ReadInt32();
     ex.Data = reader.ReadString();
     int frameCount = reader.ReadInt32();
     ex.StackFrames = new FieldLogStackFrame[frameCount];
     for (int i = 0; i < frameCount; i++)
     {
         ex.StackFrames[i] = FieldLogStackFrame.Read(reader);
     }
     int innerCount = reader.ReadInt32();
     ex.InnerExceptions = new FieldLogException[innerCount];
     for (int i = 0; i < innerCount; i++)
     {
         ex.InnerExceptions[i] = FieldLogException.Read(reader);
     }
     return ex;
 }
Пример #13
0
        /// <summary>
        /// Reads the log item fields from the specified log file reader.
        /// </summary>
        /// <param name="reader">The log file reader to read from.</param>
        /// <param name="isRepeated">true if the log item is repeated from a previous file, false if it is written for the first time.</param>
        /// <returns>The read log item.</returns>
        internal static FieldLogScopeItem Read(FieldLogFileReader reader, bool isRepeated)
        {
            FieldLogScopeItem item = new FieldLogScopeItem();
            item.ReadBaseData(reader);
            item.IsRepeated = isRepeated;
            item.Type = (FieldLogScopeType)reader.ReadByte();
            item.Level = reader.ReadInt32();
            item.Name = reader.ReadString();

            if (item.Type == FieldLogScopeType.ThreadStart)
            {
                byte flags = reader.ReadByte();
                item.IsBackgroundThread = (flags & 1) != 0;
                item.IsPoolThread = (flags & 2) != 0;
            }
            if (item.Type == FieldLogScopeType.LogStart)
            {
                item.EnvironmentData = FieldLogEventEnvironment.Read(reader);
            }
            if (item.Type == FieldLogScopeType.WebRequestStart && reader.FormatVersion >= 2)
            {
                item.WebRequestData = FieldLogWebRequestData.Read(reader);
            }
            return item;
        }
Пример #14
0
 /// <summary>
 /// Reads the log item fields from the specified log file reader.
 /// </summary>
 /// <param name="reader">The log file reader to read from.</param>
 /// <returns>The read log item.</returns>
 internal static FieldLogExceptionItem Read(FieldLogFileReader reader)
 {
     FieldLogExceptionItem item = new FieldLogExceptionItem();
     item.ReadBaseData(reader);
     item.Exception = FieldLogException.Read(reader);
     item.Context = reader.ReadString();
     item.EnvironmentData = FieldLogEventEnvironment.Read(reader);
     return item;
 }
Пример #15
0
 /// <summary>
 /// Reads the log item fields from the specified log file reader.
 /// </summary>
 /// <param name="reader">The log file reader to read from.</param>
 /// <returns>The read log item.</returns>
 internal static FieldLogDataItem Read(FieldLogFileReader reader)
 {
     FieldLogDataItem item = new FieldLogDataItem();
     item.ReadBaseData(reader);
     item.Name = reader.ReadString();
     item.Value = reader.ReadString();
     return item;
 }
Пример #16
0
 /// <summary>
 /// Reads the log item fields from the specified log file reader.
 /// </summary>
 /// <param name="reader">The log file reader to read from.</param>
 /// <returns>The read log item.</returns>
 internal static FieldLogTextItem Read(FieldLogFileReader reader)
 {
     FieldLogTextItem item = new FieldLogTextItem();
     item.ReadBaseData(reader);
     item.Text = reader.ReadString();
     item.Details = reader.ReadString();
     return item;
 }