<commit_before>﻿using System;
using System.Collections.Generic;
using Interpreter.Vm;

namespace CrayonRuntime
{
    internal class Program
    {
        private static readonly HashSet<string> COMPATIBLE_VERSIONS = new HashSet<string>() {
            "0.2.0",
        };

        public static void Main(string[] args)
        {
            try
            {
                Run(args);
            }
            catch (Exception e)
            {
                Console.Error.WriteLine(e.Message);
            }
        }

        private static void Run(string[] args)
        {
            if (args.Length < 2) throw new Exception("Incorrect number of args. Requires path to a cbx file and parent process ID.");

            List<string> argsList = new List<string>(args);
            string cbxPath = argsList[0];
			string vmpidRaw = argsList[1];
            argsList.RemoveAt(0);
            argsList.RemoveAt(0);
            args = argsList.ToArray();

			int vmPid = 0;
            if (!cbxPath.ToLower().EndsWith(".cbx")) throw new Exception("File must be a CBX file.");
            if (!System.IO.File.Exists(cbxPath)) throw new Exception("Given CBX file does not exist.");
			if (!vmpidRaw.StartsWith("vmpid:") || !int.TryParse(vmpidRaw.Substring("vmpid:".Length), out vmPid)) throw new Exception("Invalid VM Process ID.");

			if (vmPid > 0)
			{
				new System.Threading.Thread(ParentChecker).Start(vmPid);
			}

            byte[] cbxData = System.IO.File.ReadAllBytes(cbxPath);

            CbxDecoder cbxDecoder = new CbxDecoder(cbxData);<commit_msg>Check-for-parent-termination thread should be a background thread.<commit_after>﻿using System;
using System.Collections.Generic;
using Interpreter.Vm;

namespace CrayonRuntime
{
    internal class Program
    {
        private static readonly HashSet<string> COMPATIBLE_VERSIONS = new HashSet<string>() {
            "0.2.0",
        };

        public static void Main(string[] args)
        {
            try
            {
                Run(args);
            }
            catch (Exception e)
            {
                Console.Error.WriteLine(e.Message);
            }
        }

        private static void Run(string[] args)
        {
            if (args.Length < 2) throw new Exception("Incorrect number of args. Requires path to a cbx file and parent process ID.");

            List<string> argsList = new List<string>(args);
            string cbxPath = argsList[0];
			string vmpidRaw = argsList[1];
            argsList.RemoveAt(0);
            argsList.RemoveAt(0);
            args = argsList.ToArray();

			int vmPid = 0;
            if (!cbxPath.ToLower().EndsWith(".cbx")) throw new Exception("File must be a CBX file.");
            if (!System.IO.File.Exists(cbxPath)) throw new Exception("Given CBX file does not exist.");
			if (!vmpidRaw.StartsWith("vmpid:") || !int.TryParse(vmpidRaw.Substring("vmpid:".Length), out vmPid)) throw new Exception("Invalid VM Process ID.");

			if (vmPid > 0)
			{
                System.Threading.Thread thread = new System.Threading.Thread(ParentChecker);
                thread.IsBackground = true;
                thread.Start(vmPid);
			}

            byte[] cbxData = System.IO.File.ReadAllBytes(cbxPath);

            CbxDecoder cbxDecoder = new CbxDecoder(cbxData);
{'fraction_non_alphanumeric': 0.11370527592480291, 'fraction_numerical': 0.006064281382656155, 'mean_word_length': 2.0976525821596246, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, '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': '7309583', 'n_tokens_mistral': 994, 'n_tokens_neox': 939, 'n_words': 238}