예제 #1
0
        /// <summary>
        /// Build the exception report
        /// </summary>
        public ExceptionReport Build()
        {
            _stringBuilder = ExceptionReporterExtensions.AppendDottedLine(new StringBuilder());

            if (_reportInfo.ShowGeneralTab)
            {
                BuildGeneralInfo();
            }
            if (_reportInfo.ShowExceptionsTab)
            {
                BuildExceptionInfo();
            }
            if (_reportInfo.ShowAssembliesTab)
            {
                BuildAssemblyInfo();
            }
            if (_reportInfo.ShowConfigTab)
            {
                BuildConfigInfo();
            }
            if (_reportInfo.ShowSysInfoTab)
            {
                BuildSysInfo();
            }
            if (_reportInfo.ShowContactTab)
            {
                BuildContactInfo();
            }

            return(new ExceptionReport(_stringBuilder, _reportInfo));
        }
예제 #2
0
        private void BuildAssemblyInfo()
        {
            var digger = new AssemblyReferenceDigger(_reportInfo.AppAssembly);

            ExceptionReporterExtensions.AppendDottedLine(_stringBuilder.AppendLine("[Assembly Info]")
                                                         .AppendLine()
                                                         .AppendLine(digger.CreateReferencesString())).AppendLine();
        }
예제 #3
0
 private void BuildContactInfo()
 {
     ExceptionReporterExtensions.AppendDottedLine(_stringBuilder.AppendLine("[Contact Info]")
                                                  .AppendLine()
                                                  .AppendLine("Email:  " + _reportInfo.ContactEmail)
                                                  .AppendLine("Web:    " + _reportInfo.WebUrl)
                                                  .AppendLine("Phone:  " + _reportInfo.Phone)
                                                  .AppendLine("Fax:    " + _reportInfo.Fax)
                                                  ).AppendLine();
 }
예제 #4
0
        private void BuildExceptionInfo()
        {
            for (var index = 0; index < _reportInfo.Exceptions.Count; index++)
            {
                var exception = _reportInfo.Exceptions[index];

                //TODO maybe omit a number when there's only 1 exception
                ExceptionReporterExtensions.AppendDottedLine(_stringBuilder.AppendLine(string.Format("[Exception Info {0}]", index + 1))
                                                             .AppendLine()
                                                             .AppendLine(ExceptionHierarchyToString(exception))
                                                             .AppendLine()).AppendLine();
            }
        }
예제 #5
0
 private void BuildSysInfo()
 {
     try
     {
         _stringBuilder.AppendLine("[System Info]").AppendLine();
         _stringBuilder.Append(SysInfoResultMapper.CreateStringList(_sysInfoResults));
         ExceptionReporterExtensions.AppendDottedLine(_stringBuilder).AppendLine();
     }
     catch
     {
         _stringBuilder.AppendLine("Can't get system information");
         ExceptionReporterExtensions.AppendDottedLine(_stringBuilder).AppendLine();
     }
 }
예제 #6
0
 private void BuildConfigInfo()
 {
     try
     {
         _stringBuilder.AppendLine("[Config Settings]").AppendLine();
         _stringBuilder.AppendLine(_fileReader.ReadAll(ConfigReader.GetConfigFilePath()));
         ExceptionReporterExtensions.AppendDottedLine(_stringBuilder).AppendLine();
     }
     catch
     {
         _stringBuilder.AppendLine("No default config found");
         ExceptionReporterExtensions.AppendDottedLine(_stringBuilder).AppendLine();
     }
 }
예제 #7
0
        private void BuildGeneralInfo()
        {
            _stringBuilder.AppendLine("[General Info]")
            .AppendLine()
            .AppendLine("Application: " + _reportInfo.AppName)
            .AppendLine("Version:     " + _reportInfo.AppVersion)
            .AppendLine("Region:      " + _reportInfo.RegionInfo)
            .AppendLine("Machine:     " + _reportInfo.MachineName)
            .AppendLine("User:        "******"Date: " + _reportInfo.ExceptionDate.ToShortDateString())
            .AppendLine("Time: " + _reportInfo.ExceptionDate.ToShortTimeString())
            .AppendLine();

            ExceptionReporterExtensions.AppendDottedLine(_stringBuilder.AppendLine("User Explanation:")
                                                         .AppendLine()
                                                         .AppendFormat("{0} said \"{1}\"", _reportInfo.UserName, _reportInfo.UserExplanation)
                                                         .AppendLine()).AppendLine();
        }