<commit_before>﻿using BitSharp.Core.Storage;
using System;
using System.Diagnostics;
using System.IO;

namespace BitSharp.Core.Test.Storage
{
    public abstract class BaseTestStorageProvider : ITestStorageProvider
    {
        // create a random temp directory for this test instance
        public void TestInitialize()
        {
            TestDirectory = TempDirectory.CreateTempDirectory();
        }

        // cleanup this processes random temp directory
        public void TestCleanup()
        {
            TempDirectory.DeleteDirectory(TestDirectory);
        }

        public string TestDirectory { get; private set; }

        public abstract string Name { get; }

        public abstract IStorageManager OpenStorageManager();

        private static void CreateDirectory(string path)
        {
            try
            {
                if (!Directory.Exists(path))
                    Directory.CreateDirectory(path);
            }
            catch (Exception) { }
        }

        private static void DeleteDirectory(string path)
        {
            try
            {
                if (Directory.Exists(path))
                    Directory.Delete(path, recursive: true);
            }
            catch (Exception) { }
        }

        private static void CleanCreateDirectory(string path)
        {
            DeleteDirectory(path);
            CreateDirectory(path);
        }

        private static bool IsProcessRunning(int processId)
        {
            try
            {
                using (Process.GetProcessById(processId))
                    return true;
            }
            catch (Exception)
            {
                return false;
            }
        }<commit_msg>cleanup missed code that moved to TempDirectory<commit_after>﻿using BitSharp.Core.Storage;
using System;
using System.Diagnostics;
using System.IO;

namespace BitSharp.Core.Test.Storage
{
    public abstract class BaseTestStorageProvider : ITestStorageProvider
    {
        // create a random temp directory for this test instance
        public void TestInitialize()
        {
            TestDirectory = TempDirectory.CreateTempDirectory();
        }

        // cleanup this processes random temp directory
        public void TestCleanup()
        {
            TempDirectory.DeleteDirectory(TestDirectory);
        }

        public string TestDirectory { get; private set; }

        public abstract string Name { get; }

        public abstract IStorageManager OpenStorageManager();
{'fraction_non_alphanumeric': 0.0659253375694996, 'fraction_numerical': 0.0, 'mean_word_length': 1.7895902547065339, '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': '6266892', 'n_tokens_mistral': 574, 'n_tokens_neox': 550, 'n_words': 159}