コード例 #1
0
        /// <summary>
        /// Build the exception report
        /// </summary>
        public ExceptionReport Build()
        {
            _stringBuilder = new StringBuilder();
            ExceptionReporterExtensions.AppendDottedLine(_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));
        }
コード例 #2
0
 private void BuildSysInfo()
 {
     _stringBuilder.AppendLine("[System Info]").AppendLine();
     _stringBuilder.Append(SysInfoResultMapper.CreateStringList(_sysInfoResults));
     ExceptionReporterExtensions.AppendDottedLine(_stringBuilder);
     _stringBuilder.AppendLine();
 }
コード例 #3
0
        private void BuildAssemblyInfo()
        {
            var digger = new AssemblyReferenceDigger(_reportInfo.AppAssembly);

            _stringBuilder.AppendLine("[Assembly Info]")
            .AppendLine()
            .AppendLine(digger.CreateReferencesString());
            ExceptionReporterExtensions.AppendDottedLine(_stringBuilder);
            _stringBuilder.AppendLine();
        }
コード例 #4
0
 private void BuildContactInfo()
 {
     _stringBuilder.AppendLine("[Contact Info]")
     .AppendLine()
     .AppendLine("Email:  " + _reportInfo.ContactEmail)
     .AppendLine("Web:    " + _reportInfo.WebUrl)
     .AppendLine("Phone:  " + _reportInfo.Phone)
     .AppendLine("Fax:    " + _reportInfo.Fax);
     ExceptionReporterExtensions.AppendDottedLine(_stringBuilder);
     _stringBuilder.AppendLine();
 }
コード例 #5
0
        private void BuildConfigInfo()
        {
            var configFilePath = ConfigReader.GetConfigFilePath();

            if (!File.Exists(configFilePath))
            {
                return;
            }
            _stringBuilder.AppendLine("[Config Settings]").AppendLine();
            _stringBuilder.AppendLine(_fileReader.ReadAll(configFilePath));
            ExceptionReporterExtensions.AppendDottedLine(_stringBuilder);
            _stringBuilder.AppendLine();
        }
コード例 #6
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
                _stringBuilder.AppendLine(string.Format("[Exception Info {0}]", index + 1))
                .AppendLine()
                .AppendLine(ExceptionHierarchyToString(exception))
                .AppendLine();
                ExceptionReporterExtensions.AppendDottedLine(_stringBuilder);
                _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();

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