<commit_before>﻿using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;
using System.Diagnostics;

namespace Neo
{
    /// <summary>
    /// this class generate config / xml file by template
    /// </summary>
    public class ConvertTask : Task
    {
        [Required]
        public ITaskItem DataSource { get; set; }

        /// <summary>
        /// execute replace logic
        /// </summary>
        /// <returns>ture successful, false failure</returns>
        public override bool Execute()
        {
            var srcdll = this.DataSource.ToString();
            string dllname = System.IO.Path.GetFileName(srcdll);
            ProcessStartInfo pinfo = new ProcessStartInfo();
            pinfo.FileName = "cmd.exe";
            pinfo.WorkingDirectory = System.IO.Path.GetDirectoryName(srcdll);
            pinfo.UseShellExecute = false;
            pinfo.RedirectStandardInput = true;
            pinfo.RedirectStandardOutput = true;
            pinfo.CreateNoWindow = true;
            pinfo.StandardOutputEncoding = System.Text.Encoding.UTF8;

            Process p = Process.Start(pinfo);
            p.StandardInput.AutoFlush = true;
            p.StandardInput.WriteLine("neon " + dllname);
            p.StandardInput.WriteLine("exit");

            //前四行后一行不要
            string lastline = null;
            int count = 0;
            bool bSucc = false;
            while (p.StandardOutput.EndOfStream == false)
            {
                var line = p.StandardOutput.ReadLine();
                count++;
                if (count <= 4) continue;

                if (lastline != null && lastline.Length > 0)
                {
                    if (lastline[0] == '<')
                    {
                        if (lastline.IndexOf("<WARN>") == 0)<commit_msg>Update ConvertTask.cs (#42)<commit_after>﻿using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;
using System.Diagnostics;

namespace Neo
{
    /// <summary>
    /// this class generate config / xml file by template
    /// </summary>
    public class ConvertTask : Task
    {
        [Required]
        public ITaskItem DataSource { get; set; }

        /// <summary>
        /// execute replace logic
        /// </summary>
        /// <returns>ture successful, false failure</returns>
        public override bool Execute()
        {
            var srcdll = this.DataSource.ToString();
            string dllname = System.IO.Path.GetFileName(srcdll);
            ProcessStartInfo pinfo = new ProcessStartInfo();
            pinfo.FileName = "cmd.exe";
            pinfo.WorkingDirectory = System.IO.Path.GetDirectoryName(srcdll);
            pinfo.UseShellExecute = false;
            pinfo.RedirectStandardInput = true;
            pinfo.RedirectStandardOutput = true;
            pinfo.CreateNoWindow = true;
            pinfo.StandardOutputEncoding = System.Text.Encoding.UTF8;

            Process p = Process.Start(pinfo);
            p.StandardInput.AutoFlush = true;
            p.StandardInput.WriteLine($"neon {dllname} --compatible");
            p.StandardInput.WriteLine("exit");

            //前四行后一行不要
            string lastline = null;
            int count = 0;
            bool bSucc = false;
            while (p.StandardOutput.EndOfStream == false)
            {
                var line = p.StandardOutput.ReadLine();
                count++;
                if (count <= 4) continue;

                if (lastline != null && lastline.Length > 0)
                {
                    if (lastline[0] == '<')
                    {
                        if (lastline.IndexOf("<WARN>") == 0)
{'fraction_non_alphanumeric': 0.10918114143920596, 'fraction_numerical': 0.0038599393438103115, 'mean_word_length': 1.6462436177972284, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, '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': '3719758', 'n_tokens_mistral': 967, 'n_tokens_neox': 931, 'n_words': 210}