<commit_before>﻿using System;
using System.Collections.Generic;
using System.IO;

namespace Assman
{
    internal class IndividuallyCompiledResource : ICompiledResource
    {
        public IResource Resource { get; set; }
        public ResourceMode Mode { get; set; }
        public string CompiledContent { get; set; }
        
        private string _compiledPath;
        public string CompiledPath
        {
            get
            {
                if(_compiledPath == null && Resource != null)
                {
                    _compiledPath = CalculateCompiledPath();
                }
                
                return _compiledPath;
            }
            set { _compiledPath = value; }
        }

        public DateTime LastModified
        {
            get { return new DateTime(); }
        }

        public IEnumerable<IResource> Resources
        {
            get { yield return Resource; }
        }

        public void WriteTo(Stream outputStream) {}

        private string CalculateCompiledPath()
        {
            var lastDotIndex = Resource.VirtualPath.LastIndexOf(".");
            var beforePeriod = Resource.VirtualPath.Substring(0, lastDotIndex);
            var afterPeriod = Resource.VirtualPath.Substring(lastDotIndex + 1);

            return beforePeriod + ".min." + afterPeriod;
        }
    }
}<commit_msg>Slightly refactored the way the compiled path for an individually compiled resource is calculated.<commit_after>﻿using System;
using System.Collections.Generic;
using System.IO;

namespace Assman
{
    internal class IndividuallyCompiledResource : ICompiledResource
    {
        public IResource Resource { get; set; }
        public ResourceMode Mode { get; set; }
        public string CompiledContent { get; set; }
        
        private string _compiledPath;
        public string CompiledPath
        {
            get
            {
                if(_compiledPath == null && Resource != null)
                {
                    _compiledPath = CalculateCompiledPath();
                }
                
                return _compiledPath;
            }
            set { _compiledPath = value; }
        }

        public DateTime LastModified
        {
            get { return new DateTime(); }
        }

        public IEnumerable<IResource> Resources
        {
            get { yield return Resource; }
        }

        public void WriteTo(Stream outputStream) {}

        private string CalculateCompiledPath()
        {
            var resourceType = ResourceType.FromPath(Resource.VirtualPath);
            
            var lastDotIndex = Resource.VirtualPath.LastIndexOf(".");
            var baseName = Resource.VirtualPath.Substring(0, lastDotIndex);

            return baseName + ".min" + resourceType.DefaultFileExtension;
        }
    }
}
{'fraction_non_alphanumeric': 0.07256076083127862, 'fraction_numerical': 0.0010567101091933778, 'mean_word_length': 1.679245283018868, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '3005964', 'n_tokens_mistral': 690, 'n_tokens_neox': 654, 'n_words': 174}