<commit_before>﻿using System;
using System.Windows.Threading;
using NLog;
using Saber.Infrastructure;
using Saber.Infrastructure.Exception;

namespace Saber.Helper
{
    public static class ErrorReporting
    {
        private static void Report(Exception e)
        {
            var logger = LogManager.GetLogger("UnHandledException");
            logger.Fatal(ExceptionFormatter.FormatExcpetion(e));
            var reportWindow = new ReportWindow(e);
            reportWindow.Show();
        }

        public static void UnhandledExceptionHandle(object sender, UnhandledExceptionEventArgs e)
        {
            //handle non-ui thread exceptions
            Report((Exception)e.ExceptionObject);
        }

        public static void DispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
        {
            //handle ui thread exceptions
            Report(e.Exception);
            //prevent application exist, so the user can copy prompted error info
            e.Handled = true;
        }

        public static string RuntimeInfo()
        {
            var info = $"\nWox version: {Constant.Version}" +
                       $"\nOS Version: {Environment.OSVersion.VersionString}" +
                       $"\nIntPtr Length: {IntPtr.Size}" +<commit_msg>更改version 描述文字<commit_after>﻿using System;
using System.Windows.Threading;
using NLog;
using Saber.Infrastructure;
using Saber.Infrastructure.Exception;

namespace Saber.Helper
{
    public static class ErrorReporting
    {
        private static void Report(Exception e)
        {
            var logger = LogManager.GetLogger("UnHandledException");
            logger.Fatal(ExceptionFormatter.FormatExcpetion(e));
            var reportWindow = new ReportWindow(e);
            reportWindow.Show();
        }

        public static void UnhandledExceptionHandle(object sender, UnhandledExceptionEventArgs e)
        {
            //handle non-ui thread exceptions
            Report((Exception)e.ExceptionObject);
        }

        public static void DispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
        {
            //handle ui thread exceptions
            Report(e.Exception);
            //prevent application exist, so the user can copy prompted error info
            e.Handled = true;
        }

        public static string RuntimeInfo()
        {
            var info = $"\nSaber version: {Constant.Version}" +
                       $"\nOS Version: {Environment.OSVersion.VersionString}" +
                       $"\nIntPtr Length: {IntPtr.Size}" +
{'fraction_non_alphanumeric': 0.08150711264898117, 'fraction_numerical': 0.0, 'mean_word_length': 2.228287841191067, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3602550', 'n_tokens_mistral': 647, 'n_tokens_neox': 631, 'n_words': 165}