/// <summary> /// Reads the common log item fields from the specified log file reader. /// </summary> /// <param name="reader">The log file reader to read from.</param> protected void ReadBaseData(FieldLogFileReader reader) { LogItemSourceFileName = reader.FileName; FileFormatVersion = reader.FormatVersion; Time = new DateTime(reader.ReadInt64(), DateTimeKind.Utc); EventCounter = reader.ReadInt32(); Priority = (FieldLogPriority)reader.ReadByte(); SessionId = new Guid(reader.ReadBytes(16)); ThreadId = reader.ReadInt32(); if (reader.FormatVersion >= 2) { WebRequestId = reader.ReadUInt32(); } }
/// <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; }
/// <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); }