<commit_before>﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;

namespace Drey.Configuration.Repositories.OnDisk
{
    public class OnDiskPackageRepository : IPackageRepository
    {
        static Regex VERSION_PARSER = new Regex(@"(\d+)(.(\d+)?)(.(\d+)?)(.(\d+)?)", RegexOptions.Compiled);

        readonly Drey.Nut.INutConfiguration _configurationManager;

        public OnDiskPackageRepository(Drey.Nut.INutConfiguration configurationManager)
        {
            _configurationManager = configurationManager;
        }

        public IEnumerable<DataModel.Release> All()
        {
            DirectoryInfo dir = new DirectoryInfo(Drey.Utilities.PathUtilities.MapPath(_configurationManager.HordeBaseDirectory));
            return dir.EnumerateDirectories("*", SearchOption.TopDirectoryOnly).Select(x =>
            {
                string version = "";
                var versionMatches = VERSION_PARSER.Match(x.Name);

                if (versionMatches.Success)
                {
                    var matchedVersion = versionMatches.Groups[0];
                    version = matchedVersion.Value;
                }

                return new DataModel.Release
                {
                    CreatedOn = DateTime.Now,
                    Description = x.Name,
                    Id = x.Name.Replace(version, string.Empty).Trim('.'),
                    Version = version.Trim('.'),
                    UpdatedOn = DateTime.Now,
                    Title = x.Name,
                    Summary = string.Empty,
                    IconUrl = string.Empty,
                    Listed = true,
                    Published = DateTime.Now,
                    ReleaseNotes = string.Empty,
                    SHA1 = string.Empty,<commit_msg>Path resolution issues for .<commit_after>﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;

namespace Drey.Configuration.Repositories.OnDisk
{
    public class OnDiskPackageRepository : IPackageRepository
    {
        static Regex VERSION_PARSER = new Regex(@"(\d+).(\d+)(.(\d+)?)(.(\d+)?)", RegexOptions.Compiled);

        readonly Drey.Nut.INutConfiguration _configurationManager;

        public OnDiskPackageRepository(Drey.Nut.INutConfiguration configurationManager)
        {
            _configurationManager = configurationManager;
        }

        public IEnumerable<DataModel.Release> All()
        {
            DirectoryInfo dir = new DirectoryInfo(Drey.Utilities.PathUtilities.MapPath(_configurationManager.HordeBaseDirectory));
            return dir.EnumerateDirectories("*", SearchOption.TopDirectoryOnly).Select(x =>
            {
                string version = "";
                var versionMatches = VERSION_PARSER.Match(x.Name);

                if (versionMatches.Success)
                {
                    var matchedVersion = versionMatches.Groups[versionMatches.Groups.Count - 1];
                    version = matchedVersion.Value;
                }

                return new DataModel.Release
                {
                    CreatedOn = DateTime.Now,
                    Description = x.Name,
                    Id = x.Name.Replace(version, string.Empty).Trim('.'),
                    Version = version.Trim('.'),
                    UpdatedOn = DateTime.Now,
                    Title = x.Name,
                    Summary = string.Empty,
                    IconUrl = string.Empty,
                    Listed = true,
                    Published = DateTime.Now,
                    ReleaseNotes = string.Empty,
                    SHA1 = string.Empty,
{'fraction_non_alphanumeric': 0.09412081984897519, 'fraction_numerical': 0.0010787486515641855, 'mean_word_length': 1.7413155949741315, 'pattern_counts': {'":': 0, '<': 5, '<?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': '6891010', 'n_tokens_mistral': 934, 'n_tokens_neox': 880, 'n_words': 164}