//-------------------------------------------------------------------- //private void ExampleHowToExtendTheHeader() //{ // // The code below shows how to extend the header. // // In this example, the MyExtraData must implement the IFastSerializer. // // Extending the header in the context of a text, has very little usage // // but nonetheless, is supported for those odd rare cases if needed. // // FFileHeader.FExtraData["MyExtraData"] = new FastSerializerObjectData(new MyExtraData()); //} /// ------------------------------------------------------------------- private void ProcessMessages(ReflectInsightPackage[] messages) { OpenFileStream(); try { Stream baseStream = (FFileStream as StreamWriter).BaseStream; DateTime dt = DateTime.Now.ToUniversalTime(); foreach (ReflectInsightPackage message in messages) { if (message.FMessageType == MessageType.PurgeLogFile) { PurgeLogFile(); continue; } if (message.FMessageType == MessageType.Clear || RIUtils.IsViewerSpecificMessageType(message.FMessageType)) { continue; } message.FDateTime = dt; message.FSequenceID = FFileHeader.GetNextSequenceId(); String txtMessage = MessageText.Convert(message, FDetails, FMessagePattern, FTimePatterns); if (FileHelper.ShouldAutoSave(FFileHeader, FAutoSave, baseStream, FOnSize, message.FDateTime, txtMessage.Length)) { ForceAutoSave(); message.FSequenceID = FFileHeader.GetNextSequenceId(); txtMessage = MessageText.Convert(message, FDetails, FMessagePattern, FTimePatterns); } if (FFileHeader.FInitDateTime == DateTime.MinValue) { FFileHeader.FInitDateTime = message.FDateTime; FFileHeader.FFirstDateTime = message.FDateTime; FFileHeader.FLastDateTime = message.FDateTime; } FFileHeader.FMessageCount++; FFileHeader.FLastDateTime = message.FDateTime; FFileStream.Write(txtMessage); DebugManager.Sleep(0); } } finally { CloseFileStream(true); } }
public virtual void Receive(ReflectInsightPackage[] messages) { DateTime dt = DateTime.Now.ToUniversalTime(); foreach (ReflectInsightPackage message in messages) { if (message.FMessageType == MessageType.Clear || message.FMessageType == MessageType.PurgeLogFile || RIUtils.IsViewerSpecificMessageType(message.FMessageType)) { continue; } message.FDateTime = dt; if (FColored) { switch (message.FMessageType) { case MessageType.SendDebug: Console.ForegroundColor = ConsoleColor.Green; break; case MessageType.SendInformation: Console.ForegroundColor = ConsoleColor.White; break; case MessageType.SendWarning: Console.ForegroundColor = ConsoleColor.Yellow; break; case MessageType.SendError: Console.ForegroundColor = ConsoleColor.Magenta; break; case MessageType.SendFatal: Console.ForegroundColor = ConsoleColor.Red; break; case MessageType.SendMiniDumpFile: Console.ForegroundColor = ConsoleColor.Red; break; case MessageType.SendException: Console.ForegroundColor = ConsoleColor.Red; break; } } Console.Write(MessageText.Convert(message, FDetails, FMessagePattern, FTimePatterns)); if (FColored) { Console.ForegroundColor = ConsoleColor.Gray; } DebugManager.Sleep(0); } }