<commit_before>﻿using System;
using System.IO;
using System.Windows.Forms;

using dnlib.DotNet;
using dnlib.DotNet.Resources;

namespace osu_BackgroundChanger
{
    internal class OsuSeasonal
    {
        private const string ResourceName = "osu_seasonal.ResourcesStore.resources";

        public EmbeddedResource Resource;

        private readonly ModuleDefMD _module;
        private ResourceElementSet _elementSet;

        public OsuSeasonal(string path) //TODO: save path in string? for Save/Save as 
        {
            _module = ModuleDefMD.Load(path);
            if (_module.Resources.Count != 1) throw new Exception("Didn't find the right amount of resources.");

            Resource = _module.Resources[0] as EmbeddedResource ?? throw new Exception("Didn't find any resources in the file.");
        }
<commit_msg>Read module from byte[] instead of disk, fixes #2<commit_after>﻿using System;
using System.IO;
using System.Windows.Forms;

using dnlib.DotNet;
using dnlib.DotNet.Resources;

namespace osu_BackgroundChanger
{
    internal class OsuSeasonal
    {
        private const string ResourceName = "osu_seasonal.ResourcesStore.resources";

        public EmbeddedResource Resource;

        private readonly ModuleDefMD _module;
        private ResourceElementSet _elementSet;

        public OsuSeasonal(string path) //TODO: save path in string? for Save/Save as 
        {
            _module = ModuleDefMD.Load(File.ReadAllBytes(path));
            if (_module.Resources.Count != 1) throw new Exception("Didn't find the right amount of resources.");

            Resource = _module.Resources[0] as EmbeddedResource ?? throw new Exception("Didn't find any resources in the file.");
        }

{'fraction_non_alphanumeric': 0.0809551543389633, 'fraction_numerical': 0.0029120559114735, 'mean_word_length': 3.1699029126213594, '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': '6798255', 'n_tokens_mistral': 479, 'n_tokens_neox': 453, 'n_words': 144}