<commit_before>using System;
using System.Collections.Generic;
using System.IO;
using System.Runtime.CompilerServices;
using System.Text;
using System.Xml.Serialization;
using MetX.Library;

namespace MetX.Data
{
    [Serializable]
    [XmlType(Namespace = "", AnonymousType = true)]
    public class XlgQuickScriptFile : List<XlgQuickScript>
    {
        public XlgQuickScript Default { get; set; }
        public string FilePath { get; set; }
        public XlgQuickScriptFile(string filePath) { FilePath = filePath; }

        public bool Save()
        {
            if (Count == 0)
            {
                return true;
            }
            if (File.Exists(FilePath))
            {
                File.Move(FilePath, 
                    FilePath + "_" + 
                    DateTime.Now.ToString("s").Replace(":", "").Replace("-", "").Replace("T", " ") + 
                    ".xlgq"
                    );
            }
            StringBuilder content = new StringBuilder();
            foreach (XlgQuickScript script in this)
            {
                content.AppendLine(script.ToFileFormat(script.Id == Default.Id));
            }
            File.WriteAllText(FilePath, content.ToString());
            string[] history = Directory.GetFiles(FilePath.TokensBeforeLast(@"\"), "*_* *.xlgq");
            if (history.Length > 5)
            {
                Array.Sort(history);
                for (int i = 5; i < history.Length; i++)
                {
                    File.SetAttributes(history[i], FileAttributes.Normal);
                    try
                    {
                        File.Delete(history[i]);
                    }
                    catch {  }
                }
            }
            return true;
        }
<commit_msg>One more<commit_after>using System;
using System.Collections.Generic;
using System.IO;
using System.Runtime.CompilerServices;
using System.Text;
using System.Xml.Serialization;
using MetX.Library;

namespace MetX.Data
{
    [Serializable]
    [XmlType(Namespace = "", AnonymousType = true)]
    public class XlgQuickScriptFile : List<XlgQuickScript>
    {
        public XlgQuickScript Default { get; set; }
        public string FilePath { get; set; }
        public XlgQuickScriptFile(string filePath) { FilePath = filePath; }

        public bool Save()
        {
            if (Count == 0)
            {
                return true;
            }
            if (File.Exists(FilePath))
            {
                File.Move(FilePath, 
                    FilePath + "_" + 
                    DateTime.Now.ToString("s").Replace(":", "").Replace("-", "").Replace("T", " ") + 
                    ".xlgq"
                    );
            }
            StringBuilder content = new StringBuilder();
            foreach (XlgQuickScript script in this)
            {
                content.AppendLine(script.ToFileFormat(script.Id == Default.Id));
            }
            File.WriteAllText(FilePath, content.ToString());
            string[] history = Directory.GetFiles(FilePath.TokensBeforeLast(@"\"), "*_* *.xlgq");
            if (history.Length > 4)
            {
                Array.Sort(history);
                for (int i = 4; i < history.Length; i++)
                {
                    File.SetAttributes(history[i], FileAttributes.Normal);
                    try
                    {
                        File.Delete(history[i]);
                    }
                    catch {  }
                }
            }
            return true;
        }

{'fraction_non_alphanumeric': 0.11295307670694014, 'fraction_numerical': 0.0016858668165214948, 'mean_word_length': 1.3796791443850267, 'pattern_counts': {'":': 2, '<': 7, '<?xml version=': 0, '>': 7, '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': '1063717', 'n_tokens_mistral': 920, 'n_tokens_neox': 873, 'n_words': 181}