<commit_before>﻿using MB.Algodat;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml;
using System.Xml.Linq;

namespace POESKillTree.ViewModels.Items
{
    public enum ModType
    {
        Prefix,
        Suffix
    }

    public class Affix
    {
        private static List<Affix> _AllAffixes = null;

        public static List<Affix> AllAffixes
        {
            get 
            {
                if (_AllAffixes == null)
                {
                    if (File.Exists(@"Data\Equipment\Itemlist.xml"))
                    {
                        XElement xelm = XElement.Load(@"Data\Equipment\Affixlist.xml");
                        _AllAffixes = xelm.Elements().Select(x => new Affix(x)).ToList();
                    }
                }
                return Affix._AllAffixes; 
            }
        }


        public HashSet<GearGroup> ApplicableGear { get; set; }
        public ModType ModType { get; set; }

        public bool IsSignatureMod { get; set; }
        public bool IsLegacyMod { get; set; }
        public bool IsTwoHandedWeaponMod { get; set; }
        public bool IsOneHandedWeaponMod { get; set; }
        public string Category { get; set; }

        public Affix(string[] mod, IEnumerable<ItemModTier> modlist)
        {
            this.Mod = mod;

            if (modlist.Count() > 0)
            {
                this.Tiers = new RangeTree<float, ModWrapper>[this.Mod.Length];

                foreach (var item in modlist)<commit_msg>fixed optional affixlist loading<commit_after>﻿using MB.Algodat;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml;
using System.Xml.Linq;

namespace POESKillTree.ViewModels.Items
{
    public enum ModType
    {
        Prefix,
        Suffix
    }

    public class Affix
    {
        private static List<Affix> _AllAffixes = null;

        public static List<Affix> AllAffixes
        {
            get 
            {
                if (_AllAffixes == null)
                {
                    if (File.Exists(@"Data\Equipment\Affixlist.xml"))
                    {
                        XElement xelm = XElement.Load(@"Data\Equipment\Affixlist.xml");
                        _AllAffixes = xelm.Elements().Select(x => new Affix(x)).ToList();
                    }
                }
                return Affix._AllAffixes; 
            }
        }


        public HashSet<GearGroup> ApplicableGear { get; set; }
        public ModType ModType { get; set; }

        public bool IsSignatureMod { get; set; }
        public bool IsLegacyMod { get; set; }
        public bool IsTwoHandedWeaponMod { get; set; }
        public bool IsOneHandedWeaponMod { get; set; }
        public string Category { get; set; }

        public Affix(string[] mod, IEnumerable<ItemModTier> modlist)
        {
            this.Mod = mod;

            if (modlist.Count() > 0)
            {
                this.Tiers = new RangeTree<float, ModWrapper>[this.Mod.Length];

                foreach (var item in modlist)
{'fraction_non_alphanumeric': 0.09284818067754078, 'fraction_numerical': 0.0006273525721455458, 'mean_word_length': 1.6575, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, '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': '6329495', 'n_tokens_mistral': 949, 'n_tokens_neox': 893, 'n_words': 214}