<commit_before>using System;
using System.IO;
using System.Diagnostics;
using System.Collections.Generic;

class PacBuilder
{
    const string BLACKLISTPATH = "blacklist.txt";
    const string WHITELISTPATH = "whitelist.txt";
    const string FINDPROXY = @"
var proxy = '__PROXY__';
var direct = 'DIRECT;';
var hop = Object.hasOwnProperty;

function FindProxyForURL(url, host) {
    if(hop.call(whitelist, host))
        return direct;

    var suffix;
    var pos = host.lastIndexOf('.');
    pos = host.lastIndexOf('.', pos - 1);
    while(1) {
        if (pos <= 0) {
            if (hop.call(blacklist, host))
                return proxy;
            else
                return direct;
        }
        suffix = host.substring(pos + 1);
        if (hop.call(blacklist, suffix))
            return proxy;
        pos = host.lastIndexOf('.', pos - 1);
    }
}";
    const string FINDPROXYMINIFY = "var proxy='__PROXY__',direct='DIRECT;',hop=Object.hasOwnProperty;function FindProxyForURL(r,t){if(hop.call(whitelist,t))return direct;var l,i=t.lastIndexOf('.');for(i=t.lastIndexOf('.',i-1);;){if(i<=0)return hop.call(blacklist,t)?proxy:direct;if(l=t.substring(i+1),hop.call(blacklist,l))return proxy;i=t.lastIndexOf('.',i-1)}}";

    static void Main()
    {
        try
        {
            string[] userBlackList = File.ReadAllLines(BLACKLISTPATH);
            string[] userWhiteList = File.ReadAllLines(WHITELISTPATH);
            string blackList = "blacklist = " + GetStringiObj(userBlackList);
            string whiteList = "whitelist = " + GetStringiObj(userWhiteList);
            if (File.Exists("pac.txt"))
                File.Copy("pac.txt", "pac.txt.bak", true);
            File.WriteAllText("pac.txt", blackList + whiteList + FINDPROXYMINIFY);

            var ps = Process.Start("node.exe pac.txt");
            ps.WaitForExit();
            if (ps.ExitCode != 0)
                throw new Exception("Validation failed.");

        }
        catch(System.ComponentModel.Win32Exception)
        {
            Console.WriteLine("Node isn't installed. Skip checking.");
        }
        catch (Exception ex)
        {
            var color = Console.ForegroundColor;
            Console.ForegroundColor = ConsoleColor.Red;
            Console.WriteLine(ex);
            Console.ForegroundColor = color;
            Console.ReadKey();
        }<commit_msg>兼容一下新版<commit_after>using System;
using System.IO;
using System.Diagnostics;
using System.Collections.Generic;

class PacBuilder
{
    const string BLACKLISTPATH = "blacklist.txt";
    const string WHITELISTPATH = "whitelist.txt";
    const string FINDPROXY = @"
var proxy = '__PROXY__';
var direct = 'DIRECT;';
var hop = Object.hasOwnProperty;
if (proxy === '__PRO'+'XY__')
    proxy = eval('__PRO'+'XY__');

function FindProxyForURL(url, host) {
    if(hop.call(whitelist, host))
        return direct;

    var suffix;
    var pos = host.lastIndexOf('.');
    pos = host.lastIndexOf('.', pos - 1);
    while(1) {
        if (pos <= 0) {
            if (hop.call(blacklist, host))
                return proxy;
            else
                return direct;
        }
        suffix = host.substring(pos + 1);
        if (hop.call(blacklist, suffix))
            return proxy;
        pos = host.lastIndexOf('.', pos - 1);
    }
}";
    const string FINDPROXYMINIFY = "var proxy='__PROXY__',direct='DIRECT;',hop=Object.hasOwnProperty;if(proxy==='__PRO'+'XY__')proxy=eval('__PRO'+'XY__');function FindProxyForURL(r,t){if(hop.call(whitelist,t))return direct;var l,i=t.lastIndexOf('.');for(i=t.lastIndexOf('.',i-1);;){if(i<=0)return hop.call(blacklist,t)?proxy:direct;if(l=t.substring(i+1),hop.call(blacklist,l))return proxy;i=t.lastIndexOf('.',i-1)}}";

    static void Main()
    {
        try
        {
            string[] userBlackList = File.ReadAllLines(BLACKLISTPATH);
            string[] userWhiteList = File.ReadAllLines(WHITELISTPATH);
            string blackList = "blacklist = " + GetStringiObj(userBlackList);
            string whiteList = "whitelist = " + GetStringiObj(userWhiteList);
            if (File.Exists("pac.txt"))
                File.Copy("pac.txt", "pac.txt.bak", true);
            File.WriteAllText("pac.txt", blackList + whiteList + FINDPROXYMINIFY);

            var ps = Process.Start("node.exe pac.txt");
            ps.WaitForExit();
            if (ps.ExitCode != 0)
                throw new Exception("Validation failed.");

        }
        catch(System.ComponentModel.Win32Exception)
        {
            Console.WriteLine("Node isn't installed. Skip checking.");
        }
        catch (Exception ex)
        {
            var color = Console.ForegroundColor;
            Console.ForegroundColor = ConsoleColor.Red;
            Console.WriteLine(ex);
            Console.ForegroundColor = color;
            Console.ReadKey();
        }
{'fraction_non_alphanumeric': 0.1407986825854261, 'fraction_numerical': 0.004940304652120214, 'mean_word_length': 2.4608262108262107, 'pattern_counts': {'":': 0, '<': 7, '<?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': '1063599', 'n_tokens_mistral': 1509, 'n_tokens_neox': 1489, 'n_words': 279}