<commit_before>﻿using System.IO;
using System.Net;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using System.Windows.Forms;

namespace App
{
    class Updater
    {
        internal static void CheckNewVersion(MainForm mainForm)
        {
            Thread thread = new Thread(new ThreadStart(() =>
            {

                var resp = QueryGitHubReleases();
                if (resp == null)
                {
                    Log.E("새 업데이트 정보를 받아오지 못했습니다");
                    return;
                }

                Regex pattern = new Regex("\"tag_name\":\"(v.+?)\",");
                Match m = pattern.Match(resp);
                if (!m.Success)
                {
                    Log.E("새 업데이트 정보에 문제가 있습니다");
                    return;
                }

                string latest = m.Groups[1].Value;
                Log.I("현재 버전: {0}", Global.VERSION);
                Log.I("최신 버전: {0}", latest);

                if (Global.VERSION == latest)
                {
                    Log.S("최신 버전을 이용중입니다");
                }
                else
                {
                    Log.S("새로운 업데이트가 존재합니다");

                    mainForm.Invoke((MethodInvoker)delegate
                    {
                        mainForm.linkLabel_NewUpdate.Visible = true;
                        mainForm.Show();
                    });
                }
            }));
            thread.Start();
        }

        static string QueryGitHubReleases()
        {
            var url = string.Format("https://api.github.com/repos/{0}/releases/latest", Global.GITHUB_REPO);
            var request = (HttpWebRequest)WebRequest.Create(url);
            request.UserAgent = "DFA";
            request.Timeout = 1000;

            string resp = null;
            try
            {
                using (var response = (HttpWebResponse)request.GetResponse())
                {
                    var encoding = Encoding.GetEncoding(response.CharacterSet);

                    using (var responseStream = response.GetResponseStream())
                    using (var reader = new StreamReader(responseStream, encoding))
                        resp = reader.ReadToEnd();
                }
            }
            catch (WebException) { }

            return resp;
        }
    }
}
<commit_msg>Increase update checker timeout to 10 seconds<commit_after>﻿using System.IO;
using System.Net;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using System.Windows.Forms;

namespace App
{
    class Updater
    {
        internal static void CheckNewVersion(MainForm mainForm)
        {
            Thread thread = new Thread(new ThreadStart(() =>
            {

                var resp = QueryGitHubReleases();
                if (resp == null)
                {
                    Log.E("새 업데이트 정보를 받아오지 못했습니다");
                    return;
                }

                Regex pattern = new Regex("\"tag_name\":\"(v.+?)\",");
                Match m = pattern.Match(resp);
                if (!m.Success)
                {
                    Log.E("새 업데이트 정보에 문제가 있습니다");
                    return;
                }

                string latest = m.Groups[1].Value;
                Log.I("현재 버전: {0}", Global.VERSION);
                Log.I("최신 버전: {0}", latest);

                if (Global.VERSION == latest)
                {
                    Log.S("최신 버전을 이용중입니다");
                }
                else
                {
                    Log.S("새로운 업데이트가 존재합니다");

                    mainForm.Invoke((MethodInvoker)delegate
                    {
                        mainForm.linkLabel_NewUpdate.Visible = true;
                        mainForm.Show();
                    });
                }
            }));
            thread.Start();
        }

        static string QueryGitHubReleases()
        {
            var url = string.Format("https://api.github.com/repos/{0}/releases/latest", Global.GITHUB_REPO);
            var request = (HttpWebRequest)WebRequest.Create(url);
            request.UserAgent = "DFA";
            request.Timeout = 10000;

            string resp = null;
            try
            {
                using (var response = (HttpWebResponse)request.GetResponse())
                {
                    var encoding = Encoding.GetEncoding(response.CharacterSet);

                    using (var responseStream = response.GetResponseStream())
                    using (var reader = new StreamReader(responseStream, encoding))
                        resp = reader.ReadToEnd();
                }
            }
            catch (WebException) { }

            return resp;
        }
    }
}

{'fraction_non_alphanumeric': 0.10263991552270327, 'fraction_numerical': 0.004012671594508976, 'mean_word_length': 1.1478458049886622, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 2, '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': '710479', 'n_tokens_mistral': 1327, 'n_tokens_neox': 1318, 'n_words': 246}