static private void OnStartup()
        {
            try
            {
                RIExceptionManager.OnStartup();
                MessageQueue.OnStartup();
                MessageManager.OnStartup();
                RIListenerGroupManager.OnStartup();
                DebugManager.OnStartup();
                RILogManager.OnStartup();
                RIMessageColors.OnStartup();
                TraceMethod.OnStartup();
                ReflectInsight.OnStartup();
                RIEventManager.DoOnStartup();

                RITraceListener.OnStartup();
            }
            catch (Exception ex)
            {
                RIExceptionManager.Publish(ex, "Failed during: static ReflectInsightService.OnStartup()");
            }
        }
        //--------------------------------------------------------------------
        //private void ExampleHowToExtendTheHeader()
        //{
        //    // The code below shows how to extend the header.
        //    // Keep in mind that when you extend the header, you must rewrite
        //    // the file. Try to avoid extending the header frequently as this will
        //    // impact performance.
        //    //
        //    // In this example, the MyExtraData must implement the IFastSerializer.

        //    //RIFileHeader newHeader = (RIFileHeader)FFileHeader.Clone();
        //    //newHeader.FExtraData["MyExtraData"] = new FastSerializerObjectData(new MyExtraData());
        //}
        ///--------------------------------------------------------------------
        private void ProcessMessages(ReflectInsightPackage[] messages)
        {
            if (FCreateDirectory)
            {
                Directory.CreateDirectory(Path.GetDirectoryName(FFilePath));
                FCreateDirectory = false;
            }

            OpenFileStream();

            try
            {
                using (var pool = FastFormatterPool.Pool.Container())
                {
                    DateTime dt = DateTime.Now.ToUniversalTime();

                    foreach (ReflectInsightPackage message in messages)
                    {
                        if (message.FMessageType == MessageType.PurgeLogFile)
                        {
                            PurgeLogFile();
                            continue;
                        }

                        if (message.FMessageType != MessageType.Clear)
                        {
                            if (RIUtils.IsViewerSpecificMessageType(message.FMessageType))
                            {
                                continue;
                            }

                            // serialize the message
                            message.FDateTime   = dt;
                            message.FSequenceID = FFileHeader.GetNextSequenceId();
                            Byte[] bMessage = pool.Instance.Serialize(message);

                            if (FileHelper.ShouldAutoSave(FFileHeader, FAutoSave, FFileStream, FOnSize, message.FDateTime, bMessage.Length))
                            {
                                ForceAutoSave();

                                // because the previous message was serialized with the previous last sequence id
                                // we need to re-serialize the message with the new sequence id

                                message.FSequenceID = FFileHeader.GetNextSequenceId();
                                bMessage            = pool.Instance.Serialize(message);
                            }

                            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(bMessage, 0, bMessage.Length);
                        }
                        else // clear
                        {
                            RewriteFileIgnoreRequestor((RIFileHeader)FFileHeader.Clone(), pool.Instance, message.FSessionID, message.FRequestID);
                        }

                        DebugManager.Sleep(0);
                    }
                }
            }
            finally
            {
                CloseFileStream(true);
            }
        }