<commit_before>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Jint;

using CDS.Common;

namespace CDS.Data
{
    public class CDSCode
    {
        public string Code;
        public CDSCode() { }
        public static CDSCode FromRaw(byte[] Raw) 
        {
            return new CDSCode() { Code = Encoding.Unicode.GetString(Raw); };
        }
        public byte[] ToRaw() 
        {
            return Encoding.Unicode.GetBytes(Code);
        }
        public CDSData Read() 
        {
            CDSData data = new CDSData();
            Engine e = new Engine();
            e.Execute(Code);
            e.SetValue("OutData", data);
            e.Execute("OnRead();");
            return data;
        }
    }
}<commit_msg>added OnWrite call<commit_after>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Jint;

using CDS.Common;

namespace CDS.Data
{
    public class CDSCode
    {
        public string Code;
        public CDSCode() { }
        public static CDSCode FromRaw(byte[] Raw) 
        {
            return new CDSCode() { Code = Encoding.Unicode.GetString(Raw); };
        }
        public byte[] ToRaw() 
        {
            return Encoding.Unicode.GetBytes(Code);
        }
        public CDSData Read() 
        {
            CDSData data = new CDSData();
            Engine e = new Engine();
            e.Execute(Code);
            e.SetValue("OutData", data);
            e.Execute("OnRead();");
            return data;
        }
        public void Write(CDSData data)
        {
            Engine e = new Engine();
            e.Execute(Code);
            e.SetValue("InData", data);
            e.Execute("OnWrite();");
        }
    }
}
{'fraction_non_alphanumeric': 0.11331133113311331, 'fraction_numerical': 0.0, 'mean_word_length': 1.71898355754858, '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': '5291854', 'n_tokens_mistral': 523, 'n_tokens_neox': 525, 'n_words': 126}