<commit_before>﻿using FactorioModBuilder.Build.Data;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace FactorioModBuilder.Build.Extensions
{
    public class PrototypeItemsExtension : ExtensionBase<ItemData>
    {
        public PrototypeItemsExtension()
            : base(ExtensionType.PrototypeItems,
            ExtensionType.PrototypeEntities, ExtensionType.Prototypes)
        {
        }

        protected override bool BuildUnit(IEnumerable<ItemData> units, StreamWriter sw)
        {
            StringBuilder sb = new StringBuilder();
            sb.AppendLine("data:extend(");
            sb.AppendLine("{");
            foreach(var i in units)
            {
                // verify the item contents
                if (!this.SubGroupNames.Contains(i.SubGroup))
                    return false;
                if (!this.EntityNames.Contains(i.PlaceResult))
                    return false;<commit_msg>ItemExtension now property adds item names to the list of valid names<commit_after>﻿using FactorioModBuilder.Build.Data;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace FactorioModBuilder.Build.Extensions
{
    public class PrototypeItemsExtension : ExtensionBase<ItemData>
    {
        public PrototypeItemsExtension()
            : base(ExtensionType.PrototypeItems,
            ExtensionType.PrototypeEntities, ExtensionType.Prototypes)
        {
        }

        protected override bool BuildUnit(IEnumerable<ItemData> units, StreamWriter sw)
        {
            StringBuilder sb = new StringBuilder();
            sb.AppendLine("data:extend(");
            sb.AppendLine("{");
            foreach(var i in units)
            {
                // verify the item contents
                if (!this.SubGroupNames.Contains(i.SubGroup))
                    return false;
                if (!this.EntityNames.Contains(i.PlaceResult))
                    return false;
                if (!this.ItemNames.Add(i.Name))
                    return false;
{'fraction_non_alphanumeric': 0.08452655889145497, 'fraction_numerical': 0.0, 'mean_word_length': 2.2184249628528976, 'pattern_counts': {'":': 0, '<': 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': '2274892', 'n_tokens_mistral': 535, 'n_tokens_neox': 525, 'n_words': 122}