Example #1
0
        static public void AppendMessageProperties(StringBuilder sb, ReflectInsightPackage package, MessageTextFlag flags)
        {
            if ((flags & MessageTextFlag.Properties) != MessageTextFlag.Properties)
            {
                return;
            }

            if ((flags & MessageTextFlag.Properties) != MessageTextFlag.Details)
            {
                sb.AppendLine();
            }

            sb.AppendLine("Message Properties");
            sb.AppendLine(FLine);
            sb.AppendFormat("{0,11}: {1}{2}", "Category", package.FCategory, Environment.NewLine);
            sb.AppendFormat("{0,11}: {1}{2}", "Computer", package.FMachineName, Environment.NewLine);
            sb.AppendFormat("{0,11}: {1}{2}", "Application", package.FApplication, Environment.NewLine);
            sb.AppendFormat("{0,11}: {1}{2}", "User Name", package.FUserName, Environment.NewLine);
            sb.AppendFormat("{0,11}: {1}{2}", "Process Id", package.FProcessID, Environment.NewLine);
            sb.AppendFormat("{0,11}: {1}{2}", "Thread Id", package.FThreadID, Environment.NewLine);
            sb.AppendFormat("{0,11}: {1}{2}", "Request Id", package.FRequestID, Environment.NewLine);
            sb.AppendFormat("{0,11}: {1}{2}", "Time", package.FDateTime.ToLocalTime(), Environment.NewLine);
            sb.AppendFormat("{0,11}: {1}{2}", "Session Id", package.FSessionID, Environment.NewLine);
            sb.AppendFormat("{0,11}: {1}{2}", "Domain Id", package.FDomainID, Environment.NewLine);
            sb.AppendFormat("{0,11}: {1}{2}", "User Domain", package.FUserDomainName, Environment.NewLine);
            sb.AppendLine();
        }
Example #2
0
        static public void AppendMessage(StringBuilder sb, ReflectInsightPackage package, String messagePattern, List <String> timePatterns, MessageTextFlag flags)
        {
            if ((flags & MessageTextFlag.Message) != MessageTextFlag.Message)
            {
                return;
            }

            String message = package.FMessage;

            switch (package.FMessageType)
            {
            case MessageType.AddCheckpoint: message = message.Replace("Checkpoint:", String.Format("[Checkpoint.{0}]: ", (Checkpoint)package.FMessageSubType)); break;

            case MessageType.SendCheckmark: message = message.Replace("Checkmark:", String.Format("[Checkmark.{0}]: ", (Checkmark)package.FMessageSubType)); break;

            case MessageType.SendLevel: message = String.Format("[Level.{0}]: {1}", (LevelType)package.FMessageSubType, message); break;
            }

            if (!string.IsNullOrWhiteSpace(messagePattern))
            {
                sb.AppendFormat("{0}", RIUtils.PrepareString(messagePattern, package, String.Empty, timePatterns));
            }
            else
            {
                sb.AppendFormat("{0}", message);
            }

            sb.AppendLine();
        }
Example #3
0
        static public void AppendMessageExtendedProperties(StringBuilder sb, ReflectInsightPackage package, MessageTextFlag flags)
        {
            if ((flags & MessageTextFlag.ExtendedProperties) != MessageTextFlag.ExtendedProperties || !package.HasExtendedProperties)
            {
                return;
            }

            if ((flags & MessageTextFlag.ExtendedProperties) != MessageTextFlag.Details)
            {
                sb.AppendLine();
            }

            foreach (ReflectInsightExtendedProperties exProps in package.FExtPropertyContainer.ExtendedProperties)
            {
                if (exProps.Properties.Count == 0)
                {
                    continue;
                }

                foreach (String key in exProps.Properties.AllKeys)
                {
                    sb.AppendFormat("{0,11}: {1}: {2}{3}", exProps.Caption, key, exProps.Properties[key], Environment.NewLine);
                }
            }

            sb.AppendLine();
        }
Example #4
0
        static public void AppendAttachment(StringBuilder sb, ReflectInsightPackage package)
        {
            ReflectInsightAttachmentInfo aInfo = package.GetSubDetails <ReflectInsightAttachmentInfo>();

            sb.AppendFormat("File name: {0}{1}", Path.GetFileName(aInfo.FileName), Environment.NewLine);
            sb.AppendFormat("File size: {0,7:0,0} bytes{1}", aInfo.FileSize, Environment.NewLine);
        }
Example #5
0
 static private void AppendPackage(StringBuilder sb, ReflectInsightPackage package, MessageTextFlag flags, String messagePattern, List <String> timePatterns)
 {
     AppendMessage(sb, package, messagePattern, timePatterns, flags);
     AppendMessageSubDetails(sb, package, flags);
     AppendMessageDetails(sb, package, flags);
     AppendMessageProperties(sb, package, flags);
     AppendMessageExtendedProperties(sb, package, flags);
 }
Example #6
0
        public virtual void Dispatch(ReflectInsightPackage userPackage, ListenerGroup lgroup)
        {
            if (!Enabled || !lgroup.Enabled)
            {
                return;
            }

            MessageQueue.SendMessage(new BoundReflectInsightPackage()
            {
                BindingGroupId = DestinationBindingGroupId, Package = userPackage
            });
        }
Example #7
0
 public static void Dispatch(ReflectInsightPackage package, Int32 destinationBindingGroupId)
 {
     try
     {
         MessageQueue.SendMessage(new BoundReflectInsightPackage()
         {
             BindingGroupId = destinationBindingGroupId, Package = package
         });
     }
     catch (Exception ex)
     {
         RIExceptionManager.PublishIfEvented(ex, "Failed during: ReflectInsightDispatcher.Dispatch()");
     }
 }
        public ReflectInsightPackage FilterMessage(ReflectInsightPackage message)
        {
            if (!FFilterDefined)
            {
                return(message);
            }

            if (IsPackageAllowed(message))
            {
                return(message);
            }

            return(null);
        }
Example #9
0
        static public void AppendMessageSubDetails(StringBuilder sb, ReflectInsightPackage package, MessageTextFlag flags)
        {
            if (((flags & MessageTextFlag.Details) != MessageTextFlag.Details) || !package.HasSubDetails)
            {
                return;
            }

            switch (package.FMessageType)
            {
            case MessageType.SendAttachment:
                sb.AppendLine();
                AppendAttachment(sb, package);
                sb.AppendLine();
                break;
            }
        }
        public static void HandleUnknownMessage(ReflectInsightPackage message)
        {
            if (!IsValidMessageType(message.FMessageType))
            {
                if (message.FMessageType > SimpleMessageTypeEndRange)
                {
                    // for complex type messages we must clear the Details
                    // because we have no clue what object type the
                    // details are and have no way to serialized them
                    message.FDetails    = null;
                    message.FSubDetails = null;
                }

                message.FMessageType    = MessageType.Unknown;
                message.FMessageSubType = 0;
            }
        }
Example #11
0
 static public void AppendData(StringBuilder sb, ReflectInsightPackage package)
 {
     if (package.IsDetail <DetailContainerDataSet>())
     {
         using (DetailContainerDataSet dsc = package.GetDetails <DetailContainerDataSet>())
         {
             AppendDataSet(sb, dsc.FData);
         }
     }
     else
     {
         using (DetailContainerDataTable tc = package.GetDetails <DetailContainerDataTable>())
         {
             sb.AppendFormat("[{0}]{1}", tc.FData.TableName, Environment.NewLine);
             AppendDataTable(sb, tc.FData);
         }
     }
 }
        /// <summary>
        /// Assigns to package.
        /// </summary>
        /// <param name="controlValue">The control value.</param>
        /// <param name="package">The package.</param>
        static internal void AssignToPackage(ControlValues controlValue, ReflectInsightPackage package)
        {
            List <ReflectInsightExtendedProperties> propertyList = new List <ReflectInsightExtendedProperties>();

            lock (AllRequests)
            {
                AppendExtendedProperties(propertyList, AllRequests);
            }

            AppendExtendedProperties(propertyList, controlValue.RequestMessageProperties);
            AppendExtendedProperties(propertyList, controlValue.SingleMessageProperties);

            if (propertyList.Count > 0)
            {
                package.FExtPropertyContainer = new ReflectInsightPropertiesContainer(propertyList.ToArray());
                controlValue.ResetSingleRequestProperties();
            }
        }
Example #13
0
        static public String Convert(ReflectInsightPackage package, MessageTextFlag flags, String messagePattern, List <String> timePatterns)
        {
            if (package.FMessageType == MessageType.Clear || RIUtils.IsViewerSpecificMessageType(package.FMessageType))
            {
                return(String.Empty);
            }

            StringBuilder sb = new StringBuilder();

            switch (package.FMessageType)
            {
            case MessageType.AddSeparator:
                sb.AppendLine(FSeparator);
                break;

            default:
                AppendPackage(sb, package, flags, messagePattern, timePatterns);
                break;
            }

            return(sb.ToString());
        }
        private Boolean IsPackageAllowed(ReflectInsightPackage package)
        {
            if (FMessages[package.FMessageType.GetHashCode()])
            {
                return(true);
            }

            if (package.FMessageType == MessageType.AddCheckpoint)
            {
                return(FCheckpoints[package.FMessageSubType - 1]);
            }

            if (package.FMessageType == MessageType.SendCheckmark)
            {
                return(FCheckmarks[package.FMessageSubType - 1]);
            }

            if (package.FMessageType == MessageType.SendLevel)
            {
                return(FLevels[package.FMessageSubType - 1]);
            }

            return(false);
        }
        public static String PrepareString(String pattern, ReflectInsightPackage package, String details, List <String> timePatterns)
        {
            StringBuilder sStr = new StringBuilder();

            if (!string.IsNullOrWhiteSpace(pattern))
            {
                sStr.Append(pattern);
                sStr.Replace("%message%", package.FMessage);
                sStr.Replace("%messagetype%", RIUtils.GetMessageTypeString(package.FMessageType));
                sStr.Replace("%sessionid%", package.FSessionID.ToString());
                sStr.Replace("%requestid%", package.FRequestID.ToString());
                sStr.Replace("%machine%", package.FMachineName);
                sStr.Replace("%category%", package.FCategory);
                sStr.Replace("%processid%", package.FProcessID.ToString());
                sStr.Replace("%threadid%", package.FThreadID.ToString());
                sStr.Replace("%requestid%", package.FRequestID.ToString());
                sStr.Replace("%domainid%", package.FDomainID.ToString());
                sStr.Replace("%application%", package.FApplication);
                sStr.Replace("%userdomain%", package.FUserDomainName);
                sStr.Replace("%username%", package.FUserName);
                sStr.Replace("%details%", details);

                if (timePatterns != null)
                {
                    foreach (String timePattern in timePatterns)
                    {
                        String[] parts = timePattern.Split(new Char[] { '|' }, StringSplitOptions.RemoveEmptyEntries);
                        DateTime dt    = String.Compare(parts[2], "U", false) == 0 ? package.FDateTime.ToUniversalTime() : package.FDateTime.ToLocalTime();

                        sStr.Replace(parts[0], dt.ToString(parts[1]));
                    }
                }
            }

            return(sStr.ToString());
        }
Example #16
0
 static public String Convert(ReflectInsightPackage package, MessageTextFlag flags)
 {
     return(Convert(package, flags, null, null));
 }
Example #17
0
 static public String Convert(ReflectInsightPackage package, MessageTextFlag flags, String messagePattern)
 {
     return(Convert(package, flags, messagePattern, null));
 }
 internal void AddInterimMessageQueue(ReflectInsightPackage package)
 {
     // this message queue doesn't have to be locked as its only
     // called from the Message Manager which is serialized
     InterimMessageQueue.Add(package);
 }
Example #19
0
 public static void Dispatch(ReflectInsightPackage package)
 {
     Dispatch(package, 0);
 }
Example #20
0
        static public void AppendMessageDetails(StringBuilder sb, ReflectInsightPackage package, MessageTextFlag flags)
        {
            if (((flags & MessageTextFlag.Details) != MessageTextFlag.Details) || !package.HasDetails)
            {
                return;
            }

            if (package.IsDetail <DetailContainerString>())
            {
                sb.AppendLine();
                sb.AppendLine(package.GetDetails <DetailContainerString>().FData);
                sb.AppendLine();

                return;
            }

            switch (package.FMessageType)
            {
            case MessageType.EnterMethod:
            case MessageType.SendObject:
            case MessageType.SendProcessInformation:
            case MessageType.SendThreadInformation:
            case MessageType.SendSystemInformation:
            case MessageType.SendLoadedAssemblies:
            case MessageType.SendLoadedProcesses:
            case MessageType.SendAppDomainInformation:
            case MessageType.SendMemoryStatus:
            case MessageType.SendHttpModuleInformation:
            case MessageType.SendMiniDumpFile:
            case MessageType.SendCustomData:
            case MessageType.SendHttpRequest:
                sb.AppendLine();
                AppendCustomData(sb, package);
                sb.AppendLine();
                break;

            case MessageType.SendCollection:
                sb.AppendLine();
                AppendCollection(sb, package);
                sb.AppendLine();
                break;

            case MessageType.SendDataSet:
            case MessageType.SendDataTable:
            case MessageType.SendDataView:
            case MessageType.SendDataSetSchema:
            case MessageType.SendDataTableSchema:
            case MessageType.SendLinqResults:
            case MessageType.SendTypedCollection:
                sb.AppendLine();
                AppendData(sb, package);
                sb.AppendLine();
                break;

            case MessageType.SendMemory:
            case MessageType.SendStream:
                sb.AppendLine();
                AppendMemory(sb, package);
                sb.AppendLine();
                break;

            case MessageType.SendColor:
                sb.AppendLine();
                AppendColor(sb, package);
                sb.AppendLine();
                break;

            default:
                break;
            }
        }
Example #21
0
 public ReflectInsightPackageArgs(ReflectInsightPackage userPackage)
 {
     UserPackage = userPackage;
     Cancel      = false;
 }
 public static String PrepareString(String pattern, ReflectInsightPackage package, String details)
 {
     return(PrepareString(pattern, package, details, null));
 }
Example #23
0
 static public void AppendColor(StringBuilder sb, ReflectInsightPackage package)
 {
     AppendColor(sb, package.GetDetails <ReflectInsightColorInfo>());
 }
Example #24
0
 static public void AppendCollection(StringBuilder sb, ReflectInsightPackage package)
 {
     AppendCollection(sb, package.GetDetails <RICustomData>());
 }
        private void RewriteFileIgnoreRequestor(RIFileHeader newHeader, FastBinaryFormatter ff, UInt32 sessionID, UInt32 requestID)
        {
            RIFileHeader tmpHeader = null;
            String       tmpFile   = String.Format("{0}.tmp", FFilePath);

            using (FileStream tmpStream = FileStreamAccess.OpenFileStreamForWriting(tmpFile, FileMode.Create))
            {
                // original file: set file pointer to top
                FFileStream.Seek(0, SeekOrigin.Begin);
                ff.Serialize(FFileStream, FFileHeader);

                // original file: move file pointer to the end of the file header
                FFileStream.Seek(0, SeekOrigin.Begin);
                ff.Deserialize <RIFileHeader>(FFileStream);

                // temp file: move file pointer to the end of the file header with new header info
                tmpHeader = newHeader;
                tmpHeader.FInitDateTime   = DateTime.MinValue;
                tmpHeader.FFirstDateTime  = DateTime.MinValue;
                tmpHeader.FLastDateTime   = DateTime.MinValue;
                tmpHeader.FNextSequenceId = FFileHeader.FNextSequenceId;
                tmpHeader.FMessageCount   = 0;
                ff.Serialize(tmpStream, tmpHeader);

                // start copying original messages to temp file
                for (Int32 i = 0; i < FFileHeader.FMessageCount; i++)
                {
                    ReflectInsightPackage message = ff.Deserialize <ReflectInsightPackage>(FFileStream);
                    if (message.FRequestID == requestID && message.FSessionID == sessionID)
                    {
                        continue;
                    }

                    if (tmpHeader.FInitDateTime == DateTime.MinValue)
                    {
                        tmpHeader.FInitDateTime  = message.FDateTime;
                        tmpHeader.FFirstDateTime = message.FDateTime;
                        tmpHeader.FLastDateTime  = message.FDateTime;
                    }

                    tmpHeader.FMessageCount++;
                    tmpHeader.FLastDateTime = message.FDateTime;
                    ff.Serialize(tmpStream, message);
                }

                // update the FileHeader with the temp file header and write it out
                // with latest info.
                FFileHeader = tmpHeader;
                tmpStream.Seek(0, SeekOrigin.Begin);
                ff.Serialize(tmpStream, FFileHeader);
            }

            if (tmpHeader != null)
            {
                // delete the original file first, then copy temp to original
                DeleteFile(false);
                try
                {
                    File.Move(tmpFile, FFilePath);
                }
                finally
                {
                    OpenFileStream();
                }
            }
        }
Example #26
0
 static private void AppendCustomData(StringBuilder sb, ReflectInsightPackage package)
 {
     AppendCustomData(sb, package.GetDetails <RICustomData>());
 }
Example #27
0
 static public void AppendMemory(StringBuilder sb, ReflectInsightPackage package)
 {
     AppendMemory(sb, package.GetDetails <DetailContainerByteArray>().FData);
 }